svn commit: samba r5145 - in branches/SAMBA_4_0/source: include libcli/nbt librpc librpc/idl librpc/ndr nbt_server

metze at samba.org metze at samba.org
Mon Jan 31 17:16:45 GMT 2005


Author: metze
Date: 2005-01-31 17:16:45 +0000 (Mon, 31 Jan 2005)
New Revision: 5145

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5145

Log:
define struct ipv4_addr in misc.idl,
so we can use it in nbt.idl and 
get a nicer debug output

metze

Modified:
   branches/SAMBA_4_0/source/include/includes.h
   branches/SAMBA_4_0/source/libcli/nbt/namequery.c
   branches/SAMBA_4_0/source/libcli/nbt/namerefresh.c
   branches/SAMBA_4_0/source/libcli/nbt/nameregister.c
   branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c
   branches/SAMBA_4_0/source/librpc/config.mk
   branches/SAMBA_4_0/source/librpc/idl/misc.idl
   branches/SAMBA_4_0/source/librpc/idl/nbt.idl
   branches/SAMBA_4_0/source/librpc/ndr/ndr_misc.c
   branches/SAMBA_4_0/source/nbt_server/query.c
   branches/SAMBA_4_0/source/nbt_server/winsserver.c


Changeset:
Modified: branches/SAMBA_4_0/source/include/includes.h
===================================================================
--- branches/SAMBA_4_0/source/include/includes.h	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/include/includes.h	2005-01-31 17:16:45 UTC (rev 5145)
@@ -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 @@
 #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 @@
 #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)

Modified: branches/SAMBA_4_0/source/libcli/nbt/namequery.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/nbt/namequery.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/libcli/nbt/namequery.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -102,7 +102,7 @@
 	}
 	
 	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);

Modified: branches/SAMBA_4_0/source/libcli/nbt/namerefresh.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/nbt/namerefresh.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/libcli/nbt/namerefresh.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -64,7 +64,7 @@
 								     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 @@
 		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);

Modified: branches/SAMBA_4_0/source/libcli/nbt/nameregister.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/nbt/nameregister.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/libcli/nbt/nameregister.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -67,7 +67,7 @@
 								     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 @@
 		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);

Modified: branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/libcli/nbt/nbtsocket.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -390,6 +390,10 @@
 
 	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)) {

Modified: branches/SAMBA_4_0/source/librpc/config.mk
===================================================================
--- branches/SAMBA_4_0/source/librpc/config.mk	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/librpc/config.mk	2005-01-31 17:16:45 UTC (rev 5145)
@@ -291,7 +291,7 @@
 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]

Modified: branches/SAMBA_4_0/source/librpc/idl/misc.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/misc.idl	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/librpc/idl/misc.idl	2005-01-31 17:16:45 UTC (rev 5145)
@@ -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;

Modified: branches/SAMBA_4_0/source/librpc/idl/nbt.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/nbt.idl	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/librpc/idl/nbt.idl	2005-01-31 17:16:45 UTC (rev 5145)
@@ -102,7 +102,7 @@
 
 	typedef struct {
 		nb_flags nb_flags;
-		uint32   ipaddr;
+		ipv4_addr  ipaddr;
 	} nbt_rdata_address;
 
 	typedef struct {

Modified: branches/SAMBA_4_0/source/librpc/ndr/ndr_misc.c
===================================================================
--- branches/SAMBA_4_0/source/librpc/ndr/ndr_misc.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/librpc/ndr/ndr_misc.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -24,7 +24,17 @@
 */
 
 #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
 */

Modified: branches/SAMBA_4_0/source/nbt_server/query.c
===================================================================
--- branches/SAMBA_4_0/source/nbt_server/query.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/nbt_server/query.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -60,7 +60,7 @@
 							    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));

Modified: branches/SAMBA_4_0/source/nbt_server/winsserver.c
===================================================================
--- branches/SAMBA_4_0/source/nbt_server/winsserver.c	2005-01-31 16:47:47 UTC (rev 5144)
+++ branches/SAMBA_4_0/source/nbt_server/winsserver.c	2005-01-31 17:16:45 UTC (rev 5145)
@@ -32,4 +32,7 @@
 		    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);		
+	}
 }



More information about the samba-cvs mailing list