From ef6c9d7425be907230eb533fbbe2e6ac150a0bbd Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 1 Jul 2001 23:24:08 +0000 Subject: "netbios aliases" and "interfaces" options change from P_STRING to P_LIST (This used to be commit db36ed1d80fcbee16d0a0b5f226e56961f3bf1ec) --- source3/nmbd/nmbd.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'source3/nmbd') diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 2fab8f6bc7..2969c332d5 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -549,11 +549,11 @@ static BOOL open_sockets(BOOL isdaemon, int port) static BOOL init_structs(void) { extern fstring local_machine; - char *p, *ptr; + char *p, **ptr; int namecount; int n; int nodup; - pstring nbname; + char *nbname; if (! *global_myname) { @@ -569,7 +569,7 @@ static BOOL init_structs(void) */ /* Work out the max number of netbios aliases that we have */ ptr = lp_netbios_aliases(); - for( namecount=0; next_token(&ptr,nbname,NULL, sizeof(nbname)); namecount++ ) + for( namecount=0; *ptr; namecount++,ptr++ ) ; if ( *global_myname ) namecount++; @@ -588,8 +588,14 @@ static BOOL init_structs(void) my_netbios_names[namecount++] = global_myname; ptr = lp_netbios_aliases(); - while ( next_token( &ptr, nbname, NULL, sizeof(nbname) ) ) + while ( *ptr ) { + nbname = strdup(*ptr); + if (nbname == NULL) + { + DEBUG(0,("init_structs: malloc fail when allocating names.\n")); + return False; + } strupper( nbname ); /* Look for duplicates */ nodup=1; @@ -599,17 +605,13 @@ static BOOL init_structs(void) nodup=0; } if (nodup) - my_netbios_names[namecount++] = strdup( nbname ); + my_netbios_names[namecount++] = nbname; + else + free(nbname); + + ptr++; } - /* Check the strdups succeeded. */ - for( n = 0; n < namecount; n++ ) - if( NULL == my_netbios_names[n] ) - { - DEBUG(0,("init_structs: malloc fail when allocating names.\n")); - return False; - } - /* Terminate name list */ my_netbios_names[namecount++] = NULL; -- cgit