summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-27 12:12:22 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-27 12:12:22 +0000
commit7b671e34f599b9d27c615c1be35db4ae10ce6481 (patch)
tree6695be8dfea1451944f0b5af2a8b0170aecbdf30 /source3/lib
parent184cc84adab4ead8fde1b79c449ef47f23567165 (diff)
downloadsamba-7b671e34f599b9d27c615c1be35db4ae10ce6481.tar.gz
samba-7b671e34f599b9d27c615c1be35db4ae10ce6481.tar.bz2
samba-7b671e34f599b9d27c615c1be35db4ae10ce6481.zip
Some more 'winbind default domain' support patches from Alexander Bokovoy
<a.bokovoy@sam-solutions.net>. This patch is designed to remove the 'special cases' required for this support. In particular this now kills off winbind_initgroups, as it appears no longer to be required. Andrew Bartlett (This used to be commit f1d8d509766e9169d39332559162cfec249bfc70)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/username.c27
-rw-r--r--source3/lib/util_getent.c8
2 files changed, 34 insertions, 1 deletions
diff --git a/source3/lib/username.c b/source3/lib/username.c
index f256b1d6f8..ca191ce94e 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -36,6 +36,33 @@ BOOL name_is_local(const char *name)
return !(strchr_m(name, *lp_winbind_separator()));
}
+/*****************************************************************
+ Splits passed user or group name to domain and user/group name parts
+ Returns True if name was splitted and False otherwise.
+*****************************************************************/
+
+BOOL split_domain_and_name(const char *name, char *domain, char* username)
+{
+ char *p = strchr(name,*lp_winbind_separator());
+
+
+ /* Parse a string of the form DOMAIN/user into a domain and a user */
+ DEBUG(10,("split_domain_and_name: checking whether name |%s| local or not\n", name));
+
+ if (p) {
+ fstrcpy(username, p+1);
+ fstrcpy(domain, name);
+ domain[PTR_DIFF(p, name)] = 0;
+ } else if (lp_winbind_use_default_domain()) {
+ fstrcpy(username, name);
+ fstrcpy(domain, lp_workgroup());
+ } else
+ return False;
+
+ DEBUG(10,("split_domain_and_name: all is fine, domain is |%s| and name is |%s|\n", domain, username));
+ return True;
+}
+
/****************************************************************************
Get a users home directory.
****************************************************************************/
diff --git a/source3/lib/util_getent.c b/source3/lib/util_getent.c
index 02be8e7c25..5fb24d9869 100644
--- a/source3/lib/util_getent.c
+++ b/source3/lib/util_getent.c
@@ -273,6 +273,12 @@ struct sys_userlist *get_users_in_group(const char *gname)
{
struct sys_userlist *list_head = NULL;
struct group *gptr;
+ fstring domain;
+ fstring groupname;
+ DOM_SID sid;
+ enum SID_NAME_USE name_type;
+
+ (void) split_domain_and_name(gname, domain, groupname);
/*
* If we're doing this via winbindd, don't do the
@@ -280,7 +286,7 @@ struct sys_userlist *get_users_in_group(const char *gname)
* pointless (and slow).
*/
- if (strchr(gname,*lp_winbind_separator()) || lp_winbind_use_default_domain()) {
+ if (winbind_lookup_name(domain, groupname, &sid, &name_type) && name_type == SID_NAME_DOM_GRP) {
if ((gptr = (struct group *)getgrnam(gname)) == NULL)
return NULL;
return add_members_to_userlist(list_head, gptr);