summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-02-11 21:27:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:04 -0500
commit75ef18fa7510d894ccc4540d82616110c3166db3 (patch)
tree7a3e2e31489f614a48262525228187bdffabe1e4 /source3/auth
parent85160e654e5a1fc4fcb0d6cecc5187cc3b62f6d7 (diff)
downloadsamba-75ef18fa7510d894ccc4540d82616110c3166db3.tar.gz
samba-75ef18fa7510d894ccc4540d82616110c3166db3.tar.bz2
samba-75ef18fa7510d894ccc4540d82616110c3166db3.zip
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)
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_util.c54
1 files changed, 8 insertions, 46 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 27dab9b9aa..1567b6e40b 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -558,15 +558,13 @@ NTSTATUS make_server_info_sam(auth_serversupplied_info **server_info,
gid_t *gids;
auth_serversupplied_info *result;
- pwd = getpwnam_alloc(NULL, pdb_get_username(sampass));
- if ( pwd == NULL ) {
+ if ( !(pwd = getpwnam_alloc(NULL, pdb_get_username(sampass))) ) {
DEBUG(1, ("User %s in passdb, but getpwnam() fails!\n",
pdb_get_username(sampass)));
return NT_STATUS_NO_SUCH_USER;
}
- result = make_server_info(NULL);
- if (result == NULL) {
+ if ( !(result = make_server_info(NULL)) ) {
talloc_free(pwd);
return NT_STATUS_NO_MEMORY;
}
@@ -1136,7 +1134,8 @@ NTSTATUS make_server_info_pw(auth_serversupplied_info **server_info,
Make (and fill) a user_info struct for a guest login.
This *must* succeed for smbd to start. If there is no mapping entry for
the guest gid, then create one.
-***************************************************************************/
+**********************
+*****************************************************/
static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_info)
{
@@ -1165,48 +1164,9 @@ static NTSTATUS make_new_server_info_guest(auth_serversupplied_info **server_inf
}
status = make_server_info_sam(server_info, sampass);
-
if (!NT_STATUS_IS_OK(status)) {
-
- /* If there was no initial group mapping for the nobody user,
- create one*/
-
- if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
- GROUP_MAP map;
- struct passwd *pwd = getpwnam_alloc(NULL, pdb_get_username(sampass));
-
- if ( pwd == NULL ) {
- DEBUG(1, ("No guest user %s!\n",
- pdb_get_username(sampass)));
- pdb_free_sam(&sampass);
- return NT_STATUS_NO_SUCH_USER;
- }
-
- map.gid = pwd->pw_gid;
- sid_copy(&map.sid, get_global_sam_sid());
- sid_append_rid(&map.sid, DOMAIN_GROUP_RID_GUESTS);
- map.sid_name_use = SID_NAME_DOM_GRP;
- fstrcpy(map.nt_name, "Domain Guests");
- map.comment[0] = '\0';
-
- if ( !NT_STATUS_IS_OK(pdb_update_group_mapping_entry(&map)) ) {
- DEBUG(1, ("Could not update group database for guest user %s\n",
- pdb_get_username(sampass) ));
- talloc_free(pwd);
- pdb_free_sam(&sampass);
- return NT_STATUS_NO_SUCH_USER;
- }
-
- talloc_free(pwd);
-
- /* And try again. */
- status = make_server_info_sam(server_info, sampass);
- }
-
- if (!NT_STATUS_IS_OK(status)) {
- pdb_free_sam(&sampass);
- return status;
- }
+ pdb_free_sam(&sampass);
+ return status;
}
(*server_info)->guest = True;
@@ -1264,6 +1224,8 @@ BOOL init_guest_info(void)
{
if (guest_info != NULL)
return True;
+
+
return NT_STATUS_IS_OK(make_new_server_info_guest(&guest_info));
}