summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-05-04 16:01:47 +0000
committerAndrew Tridgell <tridge@samba.org>2000-05-04 16:01:47 +0000
commitf6844e0b7eb4412bc44c5533b09f856dc9272e75 (patch)
tree442d0d97d908695260ac0521259e2d5968260749 /source3/lib
parentf74ea2b78b2aaa4621936c87487f2e9c2072144f (diff)
downloadsamba-f6844e0b7eb4412bc44c5533b09f856dc9272e75.tar.gz
samba-f6844e0b7eb4412bc44c5533b09f856dc9272e75.tar.xz
samba-f6844e0b7eb4412bc44c5533b09f856dc9272e75.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. (This used to be commit 8b7a10febead8be182e7d5b1d68259e31530b69c)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/username.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 9a189980d5d..2839ddab3d2 100644
--- a/source3/lib/username.c
+++ b/source3/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);
+}