mirror of
https://github.com/samba-team/samba.git
synced 2025-12-10 04:23:50 +03:00
change the "username map" option to allow the user to stop the
processing part way through the file if a match is found. If a line starts with ! and a match is made by that line then processing stops. This allows better wildcard handling. (patch from Anselm.Kruis@Physik.Uni-Muenchen.DE)
This commit is contained in:
@@ -82,11 +82,19 @@ void map_username(char *user)
|
||||
for (; (s=fgets_slash(NULL,80,f)); free(s)) {
|
||||
char *unixname = s;
|
||||
char *dosname = strchr(unixname,'=');
|
||||
BOOL break_if_mapped = False;
|
||||
|
||||
if (!dosname) continue;
|
||||
*dosname++ = 0;
|
||||
|
||||
while (isspace(*unixname)) unixname++;
|
||||
if ('!' == *unixname)
|
||||
{
|
||||
break_if_mapped = True;
|
||||
unixname++;
|
||||
while (*unixname && isspace(*unixname)) unixname++;
|
||||
}
|
||||
|
||||
if (!*unixname || strchr("#;",*unixname)) continue;
|
||||
|
||||
{
|
||||
@@ -102,6 +110,10 @@ void map_username(char *user)
|
||||
StrnCpy(last_from,user,sizeof(last_from)-1);
|
||||
sscanf(unixname,"%s",user);
|
||||
StrnCpy(last_to,user,sizeof(last_to)-1);
|
||||
if(break_if_mapped) {
|
||||
free(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user