lib/param: fix usage of 'write list = +Group'

Andrew Bartlett abartlet at samba.org
Fri Aug 24 17:38:23 MDT 2012


On Fri, 2012-08-24 at 11:29 +0200, Björn Jacke wrote:
> The branch, master has been updated
>        via  f83521a lib/param: fix usage of 'write list = +Group'
>       from  cbecd15 s3: fix compile warning on openindiana
> 
> http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit f83521a4ca26c8b14af1c407c49426d8dd8179f7
> Author: Stefan Metzmacher <metze at samba.org>
> Date:   Thu Aug 23 15:32:05 2012 +0200
> 
>     lib/param: fix usage of 'write list = +Group'
>     
>     metze
>     
>     Autobuild-User(master): Björn Jacke <bj at sernet.de>
>     Autobuild-Date(master): Fri Aug 24 11:28:17 CEST 2012 on sn-devel-104
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  lib/param/loadparm.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
> index 4751a06..3814087 100644
> --- a/lib/param/loadparm.c
> +++ b/lib/param/loadparm.c
> @@ -1355,13 +1355,19 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
>  			char **new_list = str_list_make(mem_ctx,
>  							pszParmValue, NULL);
>  			for (i=0; new_list[i]; i++) {
> -				if (new_list[i][0] == '+' && new_list[i][1]) {
> +				if (*(const char ***)parm_ptr != NULL &&
> +				    new_list[i][0] == '+' &&
> +				    new_list[i][1])
> +				{
>  					if (!str_list_check(*(const char ***)parm_ptr,
>  							    &new_list[i][1])) {
>  						*(const char ***)parm_ptr = str_list_add(*(const char ***)parm_ptr,
>  											 &new_list[i][1]);
>  					}
> -				} else if (new_list[i][0] == '-' && new_list[i][1]) {
> +				} else if (*(const char ***)parm_ptr != NULL &&
> +					   new_list[i][0] == '-' &&
> +					   new_list[i][1])
> +				{
>  					str_list_remove(*(const char ***)parm_ptr,
>  							&new_list[i][1]);
>  				} else {

This doesn't look quite right, because in other lists (such as server
services) adding "+smb" to the empty list should give us "smb".

What I think we need to do is separate lists further into:
 - USER_LIST
 - CMD_LIST
 - LIST

CMD_LIST and USER_LIST would be very similar, but would separate tokens
with a comma ',' and both would not have the magic +/- behaviour. 

What do you think?

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org



More information about the samba-technical mailing list