summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-12-03 04:20:39 +0000
committerAndrew Tridgell <tridge@samba.org>1997-12-03 04:20:39 +0000
commitaf57bc05fe0f248aaef329358c583abcffe1657c (patch)
tree4b964e99249344dba9db9b9849804c2c388136cb
parent93f0619e049d1598db0c3022aeccf33910b0550f (diff)
downloadsamba-af57bc05fe0f248aaef329358c583abcffe1657c.tar.gz
samba-af57bc05fe0f248aaef329358c583abcffe1657c.tar.xz
samba-af57bc05fe0f248aaef329358c583abcffe1657c.zip
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)
-rw-r--r--docs/manpages/smb.conf.513
-rw-r--r--source/lib/username.c12
2 files changed, 25 insertions, 0 deletions
diff --git a/docs/manpages/smb.conf.5 b/docs/manpages/smb.conf.5
index 1145de12637..147b3dce9f4 100644
--- a/docs/manpages/smb.conf.5
+++ b/docs/manpages/smb.conf.5
@@ -3524,6 +3524,11 @@ then continues with the next line.
If any line begins with a '#' or a ';' then it is ignored
+If any line begins with an ! then the processing will stop after that
+line if a mapping was done by the line. Otherwise mapping continues
+with every line being processed. Using ! is most useful when you have
+a wildcard mapping line later in the file.
+
For example to map from the name "admin" or "administrator" to the UNIX
name "root" you would use
@@ -3544,6 +3549,14 @@ quotes around the name. For example:
would map the windows username "Andrew Tridgell" to the unix username
tridge.
+The following example would map mary and fred to the unix user sys,
+and map the rest to guest. Note the use of the ! to tell Samba to stop
+processing if it gets a match on that line.
+
+ !sys = mary fred
+ guest = *
+
+
Note that the remapping is applied to all occurrences of
usernames. Thus if you connect to "\e\eserver\efred" and "fred" is
remapped to "mary" then you will actually be connecting to
diff --git a/source/lib/username.c b/source/lib/username.c
index a9f64259916..a7241d309f4 100644
--- a/source/lib/username.c
+++ b/source/lib/username.c
@@ -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;
+ }
}
}