summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-15 17:59:12 -0800
committerJeremy Allison <jra@samba.org>2007-11-15 17:59:12 -0800
commitc261545449f71d9b347a37518dab0d5ae4116f8b (patch)
tree3fc247d117bae592fb7bac8abaff196ba1b1306a /source3/nmbd
parent6028176a392e095d8600e3c27704ee454c152b3f (diff)
downloadsamba-c261545449f71d9b347a37518dab0d5ae4116f8b.tar.gz
samba-c261545449f71d9b347a37518dab0d5ae4116f8b.tar.bz2
samba-c261545449f71d9b347a37518dab0d5ae4116f8b.zip
Fix bug noticed by kukks <linux@kukkukk.com> where
ip list didn't match namelist added to subnetdb. Could cause bogus IP addresses to be reported for the __SAMBA__ name. Jeremy. (This used to be commit ad9f14b6dcb05e8fa68b51ff26ff40fc445a4631)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_namelistdb.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/nmbd/nmbd_namelistdb.c b/source3/nmbd/nmbd_namelistdb.c
index ae5f766e66..f9cbcf4f59 100644
--- a/source3/nmbd/nmbd_namelistdb.c
+++ b/source3/nmbd/nmbd_namelistdb.c
@@ -192,6 +192,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" ) );
@@ -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,