summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/include/includes.h10
-rw-r--r--source4/libcli/nbt/namequery.c2
-rw-r--r--source4/libcli/nbt/namerefresh.c4
-rw-r--r--source4/libcli/nbt/nameregister.c4
-rw-r--r--source4/libcli/nbt/nbtsocket.c4
-rw-r--r--source4/librpc/config.mk2
-rw-r--r--source4/librpc/idl/misc.idl4
-rw-r--r--source4/librpc/idl/nbt.idl2
-rw-r--r--source4/librpc/ndr/ndr_misc.c10
-rw-r--r--source4/nbt_server/query.c2
-rw-r--r--source4/nbt_server/winsserver.c3
11 files changed, 30 insertions, 17 deletions
diff --git a/source4/include/includes.h b/source4/include/includes.h
index ce24525158..a185669abd 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -91,14 +91,6 @@
typedef int BOOL;
-/*
- we use struct ipv4_addr to avoid having to include all the
- system networking headers everywhere
-*/
-struct ipv4_addr {
- uint32_t addr;
-};
-
#ifndef HAVE_STRERROR
extern char *sys_errlist[];
#define strerror(i) sys_errlist[i]
@@ -126,7 +118,6 @@ extern int errno;
#include "pstring.h"
#include "smb_macros.h"
#include "smb.h"
-#include "ads.h"
#include "lib/socket/socket.h"
#include "libcli/ldap/ldap.h"
#include "byteorder.h"
@@ -142,6 +133,7 @@ extern int errno;
#include "ntvfs/ntvfs.h"
#include "cli_context.h"
#include "nsswitch/winbind_client.h"
+#include "ads.h"
#define malloc_p(type) (type *)malloc(sizeof(type))
#define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count)
diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c
index 36fbfc8dd0..d77482fc2b 100644
--- a/source4/libcli/nbt/namequery.c
+++ b/source4/libcli/nbt/namequery.c
@@ -102,7 +102,7 @@ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
}
for (i=0;i<io->out.num_addrs;i++) {
- in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[i].ipaddr);
+ in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[i].ipaddr.addr);
addr = inet_ntoa(in);
if (addr == NULL) {
talloc_free(req);
diff --git a/source4/libcli/nbt/namerefresh.c b/source4/libcli/nbt/namerefresh.c
index 47fcae4f7c..c121d9c920 100644
--- a/source4/libcli/nbt/namerefresh.c
+++ b/source4/libcli/nbt/namerefresh.c
@@ -64,7 +64,7 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
struct nbt_rdata_address, 1);
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
- packet->additional[0].rdata.netbios.addresses[0].ipaddr = htonl(inet_addr(io->in.address));
+ packet->additional[0].rdata.netbios.addresses[0].ipaddr.addr = htonl(inet_addr(io->in.address));
req = nbt_name_request_send(nbtsock, io->in.dest_addr, lp_nbt_port(), packet,
timeval_current_ofs(io->in.timeout, 0), False);
@@ -112,7 +112,7 @@ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
talloc_free(req);
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr);
+ in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr.addr);
addr = inet_ntoa(in);
if (addr == NULL) {
talloc_free(req);
diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c
index 7e0134c283..7bed37cf78 100644
--- a/source4/libcli/nbt/nameregister.c
+++ b/source4/libcli/nbt/nameregister.c
@@ -67,7 +67,7 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
struct nbt_rdata_address, 1);
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
- packet->additional[0].rdata.netbios.addresses[0].ipaddr = htonl(inet_addr(io->in.address));
+ packet->additional[0].rdata.netbios.addresses[0].ipaddr.addr = htonl(inet_addr(io->in.address));
req = nbt_name_request_send(nbtsock, io->in.dest_addr, lp_nbt_port(), packet,
timeval_current_ofs(io->in.timeout, 0), False);
@@ -115,7 +115,7 @@ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
talloc_free(req);
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr);
+ in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr.addr);
addr = inet_ntoa(in);
if (addr == NULL) {
talloc_free(req);
diff --git a/source4/libcli/nbt/nbtsocket.c b/source4/libcli/nbt/nbtsocket.c
index 3f16bf6921..3d1397e019 100644
--- a/source4/libcli/nbt/nbtsocket.c
+++ b/source4/libcli/nbt/nbtsocket.c
@@ -390,6 +390,10 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
talloc_set_destructor(req, nbt_name_request_destructor);
+ if (DEBUGLVL(10)) {
+ NDR_PRINT_DEBUG(nbt_name_packet, request);
+ }
+
status = ndr_push_struct_blob(&req->encoded, req, request,
(ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 75582c2adc..3f0dea9ce1 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -291,7 +291,7 @@ REQUIRED_SUBSYSTEMS = LIBNDR
INIT_OBJ_FILES = librpc/gen_ndr/ndr_nbt.o
INIT_FUNCTION = dcerpc_nbt_init
NOPROTO = YES
-REQUIRED_SUBSYSTEMS = LIBNDR
+REQUIRED_SUBSYSTEMS = LIBNDR NDR_MISC
[SUBSYSTEM::NDR_ALL]
diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl
index 13306b6876..4b69d1089b 100644
--- a/source4/librpc/idl/misc.idl
+++ b/source4/librpc/idl/misc.idl
@@ -6,6 +6,10 @@
interface misc
{
+ typedef [public,noprint] struct {
+ uint32 addr;
+ } ipv4_addr;
+
typedef [public,noprint,gensize] struct {
uint32 time_low;
uint16 time_mid;
diff --git a/source4/librpc/idl/nbt.idl b/source4/librpc/idl/nbt.idl
index caca7fa336..9dc42fccba 100644
--- a/source4/librpc/idl/nbt.idl
+++ b/source4/librpc/idl/nbt.idl
@@ -102,7 +102,7 @@ interface nbt
typedef struct {
nb_flags nb_flags;
- uint32 ipaddr;
+ ipv4_addr ipaddr;
} nbt_rdata_address;
typedef struct {
diff --git a/source4/librpc/ndr/ndr_misc.c b/source4/librpc/ndr/ndr_misc.c
index a538dd3033..b9edc0ae9c 100644
--- a/source4/librpc/ndr/ndr_misc.c
+++ b/source4/librpc/ndr/ndr_misc.c
@@ -24,6 +24,16 @@
*/
#include "includes.h"
+#include "system/network.h"
+
+void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip)
+{
+ struct ipv4_addr ip;
+
+ ip.addr = htonl(_ip->addr);
+
+ ndr->print(ndr, "%-25s: %s", name, sys_inet_ntoa(ip));
+}
/*
build a GUID from a string
diff --git a/source4/nbt_server/query.c b/source4/nbt_server/query.c
index 859a9c7f26..9b9d1e29b9 100644
--- a/source4/nbt_server/query.c
+++ b/source4/nbt_server/query.c
@@ -60,7 +60,7 @@ static void nbt_name_query_reply(struct nbt_name_socket *nbtsock,
struct nbt_rdata_address, 1);
if (packet->answers[0].rdata.netbios.addresses == NULL) goto failed;
packet->answers[0].rdata.netbios.addresses[0].nb_flags = nb_flags;
- packet->answers[0].rdata.netbios.addresses[0].ipaddr = htonl(inet_addr(address));
+ packet->answers[0].rdata.netbios.addresses[0].ipaddr.addr = htonl(inet_addr(address));
DEBUG(7,("Sending name query reply for %s<%02x> at %s to %s:%d\n",
name->name, name->type, src_address, address, src_port));
diff --git a/source4/nbt_server/winsserver.c b/source4/nbt_server/winsserver.c
index a659772cb3..7810bebd24 100644
--- a/source4/nbt_server/winsserver.c
+++ b/source4/nbt_server/winsserver.c
@@ -32,4 +32,7 @@ void nbt_query_wins(struct nbt_name_socket *nbtsock,
const char *src_address, int src_port)
{
DEBUG(0,("WINS query from %s\n", src_address));
+ if (DEBUGLVL(10)) {
+ NDR_PRINT_DEBUG(nbt_name_packet, packet);
+ }
}