diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-08-16 08:46:03 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-08-16 08:46:03 +0000 |
commit | fbaf4d07ae32c1052683ca0cae9ecdb6b9ed2521 (patch) | |
tree | f30c34bda8d724181a48673755ead3dc886cab5b /source3 | |
parent | 51f62926b3bae5b20dc7610b8261431f2d4d4a84 (diff) | |
download | samba-fbaf4d07ae32c1052683ca0cae9ecdb6b9ed2521.tar.gz samba-fbaf4d07ae32c1052683ca0cae9ecdb6b9ed2521.tar.bz2 samba-fbaf4d07ae32c1052683ca0cae9ecdb6b9ed2521.zip |
Make the 'guest account' always have a RID of DOMAIN_USER_RID_GUEST.
Andrew Bartlett
(This used to be commit 4725d7d04936335cbd85bd6ac5096c50fed93671)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/passdb/passdb.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index c800cf5ed9..fdcda0268d 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -774,6 +774,8 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid) if (pdb_getsampwnam(sam_user, pass->pw_name)) { sid_copy(psid, pdb_get_user_sid(sam_user)); + } else if (strcmp(pass->pw_name, lp_guestaccount()) == 0) { + sid_append_rid(psid, DOMAIN_USER_RID_GUEST); } else { sid_append_rid(psid, fallback_pdb_uid_to_user_rid(uid)); } @@ -839,15 +841,27 @@ BOOL local_sid_to_uid(uid_t *puid, const DOM_SID *psid, enum SID_NAME_USE *name_ } if (!pdb_rid_is_user(rid)) { - DEBUG(3, ("local_sid_to_uid: sid '%s' cannot be mapped to a uid algorithmicly becous it is a group\n", sid_to_string(str, psid))); + DEBUG(3, ("local_sid_to_uid: sid '%s' cannot be mapped to a uid algorithmicly becouse it is a group\n", sid_to_string(str, psid))); return False; } - *puid = fallback_pdb_user_rid_to_uid(rid); - - DEBUG(5,("local_sid_to_uid: SID %s algorithmicly mapped to %ld mapped becouse SID was not found in passdb.\n", - sid_to_string(str, psid), (signed long int)(*puid))); - return False; + if (rid == DOMAIN_USER_RID_GUEST) { + struct passwd *pw = getpwnam_alloc(lp_guestaccount()); + if (!pw) { + DEBUG(1, ("getpwnam on guest account '%s' failed!\n", lp_guestaccount())); + return False; + } + *puid = pw->pw_uid; + passwd_free(&pw); + DEBUG(5,("local_sid_to_uid: Guest account (SID %s) mapped to guest account id %ld.\n", + sid_to_string(str, psid), (signed long int)(*puid))); + } else { + + *puid = fallback_pdb_user_rid_to_uid(rid); + + DEBUG(5,("local_sid_to_uid: SID %s algorithmicly mapped to %ld mapped becouse SID was not found in passdb.\n", + sid_to_string(str, psid), (signed long int)(*puid))); + } } *name_type = SID_NAME_USER; |