This is it ! The mega-merge of the JRA_NMBD_REWRITE branch
[metze/samba/wip.git] / source3 / client / clientutil.c
index 4064dbecd789af94eebd5712259a8c99500a57aa..bf49c6b342be87272c4a6a95053135a6bfdd0393 100644 (file)
@@ -891,15 +891,18 @@ BOOL cli_open_sockets(int port )
       {
 #ifdef USENMB
        /* Try and resolve the name with the netbios server */
-       int             bcast;
+       int             bcast, count;
+       struct in_addr *ip_list;
 
        if ((bcast = open_socket_in(SOCK_DGRAM, 0, 3,
                                    interpret_addr(lp_socket_address()))) != -1) {
          set_socket_options(bcast, "SO_BROADCAST");
 
-         if (name_query(bcast, host, name_type, True, True, *iface_bcast(dest_ip),
-                        &dest_ip,0)) {
-           failed = False;
+         if ((ip_list = name_query(bcast, host, name_type, True, True, *iface_bcast(dest_ip),
+                                   &count,0)) {
+                 dest_ip = ip_list[0];
+                 free(ip_list);
+                 failed = False;
          }
          close (bcast);
        }