From 6c9f6b22cb87bad5c589e58e316db0df7c19583e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 29 May 2000 01:08:18 +0000 Subject: don't return a passwd struct for usernames that don't belong to us (This used to be commit 2740a80e30cbf512d51ba76684905a904c2fddf7) --- source3/lib/username.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source3/lib/username.c') 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; } -- cgit