summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-07-01 23:24:08 +0000
committerSimo Sorce <idra@samba.org>2001-07-01 23:24:08 +0000
commitef6c9d7425be907230eb533fbbe2e6ac150a0bbd (patch)
tree15988f8d44011650956bd7565f54217218564c97 /source3/nmbd
parent2e181c76c468761b16be1deea50f62d39ba520ec (diff)
downloadsamba-ef6c9d7425be907230eb533fbbe2e6ac150a0bbd.tar.gz
samba-ef6c9d7425be907230eb533fbbe2e6ac150a0bbd.tar.bz2
samba-ef6c9d7425be907230eb533fbbe2e6ac150a0bbd.zip
"netbios aliases" and "interfaces" options change from P_STRING to P_LIST
(This used to be commit db36ed1d80fcbee16d0a0b5f226e56961f3bf1ec)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c28
1 files changed, 15 insertions, 13 deletions
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;