diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-05-04 16:01:47 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-05-04 16:01:47 +0000 |
commit | 8b7a10febead8be182e7d5b1d68259e31530b69c (patch) | |
tree | 3bae1bb9ab449f479a42abac2c93330badddc95d /source/lib | |
parent | 98ad4095ccc8d0349d05e6e9223eaad057029626 (diff) | |
download | samba-8b7a10febead8be182e7d5b1d68259e31530b69c.tar.gz samba-8b7a10febead8be182e7d5b1d68259e31530b69c.tar.xz samba-8b7a10febead8be182e7d5b1d68259e31530b69c.zip |
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.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/username.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/source/lib/username.c b/source/lib/username.c index 9a189980d5d..2839ddab3d2 100644 --- a/source/lib/username.c +++ b/source/lib/username.c @@ -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); +} |