2.0.7pre2 - problem with include =

Jeremy Allison jeremy at valinux.com
Mon Mar 27 21:23:10 GMT 2000


Pierre-Jules Tremblay wrote:
> 
> Managed to get a backtrace in gdb by adding a 10-second sleep call just before reset_globals_after_fork() is called (see below).
> 
> There is a SIGSEGV due to a bad pointer, apparently coming out of the parm_table (pointer not initialised?), see frame #4 in stack trace below.

Ok - nailed this one thanks.

Here's the patch :

Index: param/loadparm.c
===================================================================
RCS file: /data/cvs/samba/source/param/loadparm.c,v
retrieving revision 1.170.2.23.2.10
diff -u -r1.170.2.23.2.10 loadparm.c
--- loadparm.c	2000/03/16 22:59:27	1.170.2.23.2.10
+++ loadparm.c	2000/03/27 20:24:04
@@ -557,7 +557,7 @@
   {"path",             P_STRING,  P_LOCAL,  &sDefault.szPath,           NULL,   NULL,  FLAG_BASIC|FLAG_SHARE|FLAG_PRINT|FLAG_DOS_STRING},
   {"directory",        P_STRING,  P_LOCAL,  &sDefault.szPath,           NULL,   NULL,  FLAG_DOS_STRING},
   {"workgroup",        P_USTRING, P_GLOBAL, &Globals.szWorkGroup,       NULL,   NULL,  FLAG_BASIC|FLAG_DOS_STRING},
-  {"netbios name",     P_UGSTRING,P_GLOBAL, global_myname,              handle_netbios_name,   NULL,  FLAG_BASIC|FLAG_DOS_STRING},
+  {"netbios name",     P_UGSTRING,P_GLOBAL, NULL,                       handle_netbios_name,   NULL,  FLAG_BASIC|FLAG_DOS_STRING},
   {"netbios aliases",  P_STRING,  P_GLOBAL, &Globals.szNetbiosAliases,  NULL,   NULL,  FLAG_DOS_STRING},
   {"netbios scope",    P_UGSTRING,P_GLOBAL, global_scope,               NULL,   NULL,  FLAG_DOS_STRING},
   {"server string",    P_STRING,  P_GLOBAL, &Globals.szServerString,    NULL,   NULL,  FLAG_BASIC|FLAG_DOS_STRING},
@@ -1895,6 +1895,7 @@
 /***************************************************************************
  Run standard_sub_basic on netbios name... needed because global_myname
  is not accessed through any lp_ macro.
+ Note: We must *NOT* use string_set() here as ptr points to global_myname.
 ***************************************************************************/
 
 static BOOL handle_netbios_name(char *pszParmValue,char **ptr)
@@ -1905,7 +1906,6 @@
 
 	standard_sub_basic(netbios_name);
 	strupper(netbios_name);
-	string_set(ptr,netbios_name);
 
 	/*
 	 * Convert from UNIX to DOS string - the UNIX to DOS converter


-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba-technical mailing list