summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-29 01:08:18 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-29 01:08:18 +0000
commit6c9f6b22cb87bad5c589e58e316db0df7c19583e (patch)
tree35795d7a505dca001115b246a41a54a2380adae1 /source3
parenta6e52f2b2e0de393507ac09a9dcfa211a898529c (diff)
downloadsamba-6c9f6b22cb87bad5c589e58e316db0df7c19583e.tar.gz
samba-6c9f6b22cb87bad5c589e58e316db0df7c19583e.tar.bz2
samba-6c9f6b22cb87bad5c589e58e316db0df7c19583e.zip
don't return a passwd struct for usernames that don't
belong to us (This used to be commit 2740a80e30cbf512d51ba76684905a904c2fddf7)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/username.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source3/lib/username.c b/source3/lib/username.c
index d253f9ba64..99bee8a217 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -433,12 +433,22 @@ struct passwd *smb_getpwnam(char *user, BOOL allow_change)
{
struct passwd *pw;
char *p;
+ char *sep;
+ extern pstring global_myname;
pw = Get_Pwnam(user, allow_change);
if (pw) return pw;
- p = strchr(user,'/');
- if (p) return Get_Pwnam(p+1, allow_change);
+ /* if it is a domain qualified name and it isn't in our password
+ database but the domain portion matches our local machine name then
+ lookup just the username portion locally */
+ sep = lp_winbind_separator();
+ if (!sep || !*sep) sep = "\\";
+ p = strchr(user,*sep);
+ if (p &&
+ strncasecmp(global_myname, user, strlen(global_myname))==0) {
+ return Get_Pwnam(p+1, allow_change);
+ }
return NULL;
}