Patch for parm/loadparm.c

Alexander Bokovoy a.bokovoy at sam-solutions.net
Thu Jun 6 08:42:02 GMT 2002


On Thu, Jun 06, 2002 at 09:11:00AM -0400, Billy O'Connor wrote:
> This patch corrects a problem with testparm segfaulting and swat
> aborting on startup.  I'm still looking into when in the revision
> history it started happening, it was recently.

The bug is due debug classes support. 'log level' and 'debuglevel'
parameters were recently changed to use list values and were left without
default values (NULL) which was unexpected since all other parameters have
non-NULL default values.

This patch is OK, other places in loadparm.c are calling functions which
safely return when arguments are NULL.

> 
> --- samba/source/param/loadparm.c	Thu May 30 20:47:19 2002
> +++ samba_test/source/param/loadparm.c	Thu Jun  6 09:37:51 2002
> @@ -3422,13 +3422,24 @@
>  				break;
>  			case P_STRING:
>  			case P_USTRING:
> -				parm_table[i].def.svalue =
> -					strdup(*(char **)parm_table[i].ptr);
> +                                if( parm_table[i].ptr ) {
> +				    parm_table[i].def.svalue =
> +					    strdup(*(char **)parm_table[i].ptr);
> +                                }
> +                                else {
> +                                    parm_table[i].def.svalue = NULL;
> +                                }
>  				break;
>  			case P_GSTRING:
>  			case P_UGSTRING:
> -				parm_table[i].def.svalue =
> -					strdup((char *)parm_table[i].ptr);
> +                                if( parm_table[i].ptr ) {
> +				    parm_table[i].def.svalue =
> +					    strdup((char *)parm_table[i].ptr);
> +                                }
> +                                else {
> +                                    parm_table[i].def.svalue = NULL;
> +                                }
> +
>  				break;
>  			case P_BOOL:
>  			case P_BOOLREV:

-- 
/ Alexander Bokovoy
Software architect and analyst             // SaM-Solutions Ltd.
---
Charity, n.:
	A thing that begins at home and usually stays there.




More information about the samba-technical mailing list