From 75ef18fa7510d894ccc4540d82616110c3166db3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 11 Feb 2006 21:27:08 +0000 Subject: r13460: by popular demand.... * remove pdb_context data structure * set default group for DOMAIN_RID_GUEST user as RID 513 (just like Windows) * Allow RID 513 to resolve to always resolve to a name * Remove auto mapping of guest account primary group given the previous 2 changes (This used to be commit 7a2da5f0cc05c1920c664c9a690a23bdf854e285) --- source3/lib/system_smbd.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'source3/lib/system_smbd.c') diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c index 1d4f88fbb9..3fc2d69a03 100644 --- a/source3/lib/system_smbd.c +++ b/source3/lib/system_smbd.c @@ -209,9 +209,30 @@ NTSTATUS pdb_default_enum_group_memberships(struct pdb_methods *methods, size_t i; gid_t gid; - if (!sid_to_gid(pdb_get_group_sid(user), &gid)) { - DEBUG(10, ("sid_to_gid failed\n")); - return NT_STATUS_NO_SUCH_USER; + if ( !sid_to_gid(pdb_get_group_sid(user), &gid) ) + { + uint32 rid; + struct passwd *pwd; + + /* second try, allow the DOMAIN_USERS group to pass */ + + if ( !sid_peek_check_rid( get_global_sam_sid(), pdb_get_group_sid(user), &rid ) ) + return NT_STATUS_NO_SUCH_USER; + + if ( rid != DOMAIN_GROUP_RID_USERS ) { + DEBUG(10, ("sid_to_gid failed\n")); + return NT_STATUS_NO_SUCH_USER; + } + + DEBUG(5,("pdb_default_enum_group_memberships: sid_to_gid() failed but giving " + "free pass to 'Domain Users' as primary group\n")); + + if ( !(pwd = getpwnam_alloc( NULL, pdb_get_username(user) ) ) ) + return NT_STATUS_NO_SUCH_USER; + + gid = pwd->pw_gid; + + TALLOC_FREE( pwd ); } if (!getgroups_unix_user(mem_ctx, pdb_get_username(user), gid, -- cgit