PATCH: Wins support in smbclient

Baldur Norddahl bbn at dark.x.dtu.dk
Tue Sep 23 20:27:31 GMT 1997


I added WINS support to smbclient. The patch is against 1.9.17p1. To apply
it, go to the source dir, and type "patch < client.diff".

Btw, if there is anything wrong with the patch format, please tell me
since this is my first patch.

Baldur
-------------- next part --------------
--- /root/client.c	Tue Sep 23 21:52:21 1997
+++ client.c	Tue Sep 23 22:17:21 1997
@@ -4136,8 +4136,20 @@
 #ifdef USENMB
 	/* Try and resolve the name with the netbios server */
 	int           	bcast;
+	struct in_addr wins_addr;
 
-	if ((bcast = open_socket_in(SOCK_DGRAM, 0, 3,
+	wins_addr.s_addr = interpret_addr (lp_wins_server ());
+
+	if (wins_addr.s_addr && (bcast = open_socket_out (SOCK_DGRAM,
+			      &wins_addr,
+			      137, 3000)) != -1) {
+	  if (name_query (bcast, host, 0x20, False, True, wins_addr, &dest_ip, 0)) {
+	    failed = False;
+	  }
+	  close (bcast);
+	}
+
+	if (failed && (bcast = open_socket_in(SOCK_DGRAM, 0, 3,
 				    interpret_addr(lp_socket_address()))) != -1) {
 	  set_socket_options(bcast, "SO_BROADCAST");
 


More information about the samba mailing list