1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-10 04:23:50 +03:00

a minimal change to get appliance mode to work with winbindd

we needed to accept usernames of the form DOMAIN/user, which means we
needed to pass the domain to a getpwnam() like routine in certain
critical spots.

What I'd rather do is get rid of "char *user" everywhere and use the
new userdom_struct, but that will have to wait a few days.
This commit is contained in:
Andrew Tridgell
-
parent 98ad4095cc
commit 8b7a10febe
5 changed files with 70 additions and 16 deletions

View File

@@ -423,3 +423,38 @@ static struct passwd * uname_string_combinations(char *s,struct passwd * (*fn)(c
}
return(NULL);
}
/****************************************************************************
these wrappers allow appliance mode to work. In appliance mode the username
takes the form DOMAIN/user
****************************************************************************/
struct passwd *smb_getpwnam(char *user, char *domain, BOOL allow_change)
{
struct passwd *pw;
fstring userdom;
pw = Get_Pwnam(user, allow_change);
if (pw || !domain || !*domain) return pw;
slprintf(userdom, sizeof(userdom), "%s/%s", domain, user);
DEBUG(4,("smb_getpwnam trying userdom %s\n", userdom));
return Get_Pwnam(userdom, allow_change);
}
int smb_initgroups(char *user, char *domain, gid_t group)
{
fstring userdom;
int ret;
ret = initgroups(user, group);
if (ret==0 || !domain || !*domain) return ret;
slprintf(userdom, sizeof(userdom), "%s/%s", domain, user);
DEBUG(4,("smb_initgroups trying userdom %s\n", userdom));
return initgroups(userdom, group);
}