s4-tests: Modified acl tests to use pyldb api to retrieve configuration dn.
[kai/samba.git] / source3 / nmbd / nmbd_namelistdb.c
index ae5f766e66954eaa91daf0ee5810495d6c0ef005..9c5d0efde2a983ebb8f02ba2b261950333fdf5d7 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "nmbd/nmbd.h"
 
 uint16 samba_nb_type = 0; /* samba's NetBIOS name type */
 
@@ -192,6 +193,10 @@ bool add_name_to_subnet( struct subnet_record *subrec,
        struct name_record *namerec;
        time_t time_now = time(NULL);
 
+       if (num_ips == 0) {
+               return false;
+       }
+
        namerec = SMB_MALLOC_P(struct name_record);
        if( NULL == namerec ) {
                DEBUG( 0, ( "add_name_to_subnet: malloc fail.\n" ) );
@@ -293,7 +298,6 @@ void standard_success_register(struct subnet_record *subrec,
  ******************************************************************/
 
 void standard_fail_register( struct subnet_record   *subrec,
-                             struct response_record *rrec,
                              struct nmb_name        *nmbname )
 {
        struct name_record *namerec;
@@ -504,8 +508,12 @@ void add_samba_names_to_subnet( struct subnet_record *subrec )
                        return;
                }
 
-               for( bcast_subrecs = FIRST_SUBNET, i = 0; bcast_subrecs; bcast_subrecs = NEXT_SUBNET_EXCLUDING_UNICAST(bcast_subrecs), i++ )
+               for( bcast_subrecs = FIRST_SUBNET, i = 0; bcast_subrecs &&
+                               i < num_ips;
+                               bcast_subrecs = NEXT_SUBNET_EXCLUDING_UNICAST(bcast_subrecs), i++ ) {
                        iplist[i] = bcast_subrecs->myip;
+               }
+               num_ips = i;
        }
 
        add_name_to_subnet(subrec,"*",0x0,samba_nb_type, PERMANENT_TTL,