Ensure global_scope() returns "", not the NULL string. Froma tpot fix.
authorJeremy Allison <jra@samba.org>
Fri, 6 Dec 2002 19:58:27 +0000 (19:58 +0000)
committerJeremy Allison <jra@samba.org>
Fri, 6 Dec 2002 19:58:27 +0000 (19:58 +0000)
Jeremy.
(This used to be commit 7185b846e41da2bf7edaa7f3edeff1cc1486d28b)

source3/lib/util.c
source3/libsmb/nmblib.c

index 2e43281a8895b267b67be44220c6f9e4070448f6..a83e17c661f1a52d66385264846c9a4c10a1bce2 100644 (file)
@@ -140,8 +140,14 @@ BOOL set_global_scope(const char *scope)
        return True;
 }
 
+/*********************************************************************
+ Ensure scope is never null string.
+*********************************************************************/
+
 const char *global_scope(void)
 {
+       if (!smb_scope)
+               set_global_scope("");
        return smb_scope;
 }
 
index 43e32aebbdb1df215b3b3c8df9a11daa45a849ed..d38e2ff0ecf8f3a82e099e91c9effe35b08f7558 100644 (file)
@@ -1203,7 +1203,7 @@ int name_mangle( char *In, char *Out, char name_type )
   p[0] = '\0';
 
   /* Add the scope string. */
-  for( i = 0, len = 0; NULL != global_scope(); i++, len++ )
+  for( i = 0, len = 0; *(global_scope()) != '\0'; i++, len++ )
     {
     switch( (global_scope())[i] )
       {