diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-07-07 21:16:24 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-07-08 11:23:23 +0200 |
commit | 3ab3159f757cd9849ea77c2938c340564fd1b018 (patch) | |
tree | 48135eaaad70a35aa55d3fc108df1a8da7399772 | |
parent | 6e6aaacedb96ea45a5b8a9237915525a87189001 (diff) | |
download | samba-3ab3159f757cd9849ea77c2938c340564fd1b018.tar.gz samba-3ab3159f757cd9849ea77c2938c340564fd1b018.tar.bz2 samba-3ab3159f757cd9849ea77c2938c340564fd1b018.zip |
s3-param check for aliases with both p_class and offset
This bug was found when comparing with the source4 loadparm code.
Andrew Bartlett
-rw-r--r-- | source3/param/loadparm.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index e162ab960f..361597d915 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -6359,6 +6359,7 @@ done: static bool is_synonym_of(int parm1, int parm2, bool *inverse) { if ((parm_table[parm1].offset == parm_table[parm2].offset) && + (parm_table[parm1].p_class == parm_table[parm2].p_class) && (parm_table[parm1].flags & FLAG_HIDE) && !(parm_table[parm2].flags & FLAG_HIDE)) { @@ -7483,9 +7484,12 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue /* this handles the aliases - set the copymap for other entries with the same data pointer */ - for (i = 0; parm_table[i].label; i++) - if (parm_table[i].offset == parm_table[parmnum].offset) + for (i = 0; parm_table[i].label; i++) { + if ((parm_table[i].offset == parm_table[parmnum].offset) + && (parm_table[i].p_class == parm_table[parmnum].p_class)) { bitmap_clear(ServicePtrs[snum]->copymap, i); + } + } } /* if it is a special case then go ahead */ @@ -7567,10 +7571,14 @@ static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmVa /* we have to also set FLAG_CMDLINE on aliases. Aliases must * be grouped in the table, so we don't have to search the * whole table */ - for (i=parmnum-1;i>=0 && parm_table[i].offset == parm_table[parmnum].offset;i--) { + for (i=parmnum-1; + i>=0 && parm_table[i].offset == parm_table[parmnum].offset + && parm_table[i].p_class == parm_table[parmnum].p_class; + i--) { parm_table[i].flags |= FLAG_CMDLINE; } - for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].offset == parm_table[parmnum].offset;i++) { + for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].offset == parm_table[parmnum].offset + && parm_table[i].p_class == parm_table[parmnum].p_class;i++) { parm_table[i].flags |= FLAG_CMDLINE; } @@ -8044,7 +8052,9 @@ struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters) if ((*i) > 0 && (parm_table[*i].offset == - parm_table[(*i) - 1].offset)) + parm_table[(*i) - 1].offset) + && (parm_table[*i].p_class == + parm_table[(*i) - 1].p_class)) continue; if (is_default(*i) && !allparameters) @@ -8231,7 +8241,8 @@ static void lp_save_defaults(void) { int i; for (i = 0; parm_table[i].label; i++) { - if (i > 0 && parm_table[i].offset == parm_table[i - 1].offset) + if (i > 0 && parm_table[i].offset == parm_table[i - 1].offset + && parm_table[i].p_class == parm_table[i - 1].p_class) continue; switch (parm_table[i].type) { case P_LIST: |