mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
don't return a passwd struct for usernames that don't
belong to us
(This used to be commit 2740a80e30
)
This commit is contained in:
parent
a6e52f2b2e
commit
6c9f6b22cb
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user