diff options
author | Volker Lendecke <vl@samba.org> | 2008-07-03 02:26:43 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-07-03 11:08:51 +0200 |
commit | abb42b267b7e1240dcb479d8a2463b907529c5a2 (patch) | |
tree | 6dd4e2c7583eed0e6863c981186a9d923546fd06 | |
parent | 12f0163e26e6c39ba13335468b7a1bef4cf29e73 (diff) | |
download | samba-abb42b267b7e1240dcb479d8a2463b907529c5a2.tar.gz samba-abb42b267b7e1240dcb479d8a2463b907529c5a2.tar.bz2 samba-abb42b267b7e1240dcb479d8a2463b907529c5a2.zip |
Make use of sid_check_is_in_unix_users/groups
Don't replicate code unnecessarily
(This used to be commit cd8e63b2b45402091d6d328b3c6ca593fc19ac92)
-rw-r--r-- | source3/passdb/lookup_sid.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index a7175b9647..35af1ff0dc 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -1344,7 +1344,6 @@ void gid_to_sid(DOM_SID *psid, gid_t gid) bool sid_to_uid(const DOM_SID *psid, uid_t *puid) { - uint32 rid; gid_t gid; if (fetch_uid_from_cache(puid, psid)) @@ -1356,13 +1355,16 @@ bool sid_to_uid(const DOM_SID *psid, uid_t *puid) /* Optimize for the Unix Users Domain * as the conversion is straightforward */ - if (sid_peek_check_rid(&global_sid_Unix_Users, psid, &rid)) { - uid_t uid = rid; - *puid = uid; + + if (sid_check_is_in_unix_users(psid)) { + uint32_t rid; + + sid_peek_rid(psid, &rid); + *puid = (uid_t)rid; /* return here, don't cache */ - DEBUG(10,("sid %s -> uid %u\n", sid_string_dbg(psid), - (unsigned int)*puid )); + DEBUG(10, ("sid %s -> uid %u\n", sid_string_dbg(psid), + (unsigned int)rid)); return true; } @@ -1404,13 +1406,16 @@ bool sid_to_gid(const DOM_SID *psid, gid_t *pgid) /* Optimize for the Unix Groups Domain * as the conversion is straightforward */ - if (sid_peek_check_rid(&global_sid_Unix_Groups, psid, &rid)) { - gid_t gid = rid; - *pgid = gid; + + if (sid_check_is_in_unix_groups(psid)) { + uint32_t rid; + + sid_peek_rid(psid, &rid); + *pgid = (gid_t)rid; /* return here, don't cache */ - DEBUG(10,("sid %s -> gid %u\n", sid_string_dbg(psid), - (unsigned int)*pgid )); + DEBUG(10, ("sid %s -> gid %u\n", sid_string_dbg(psid), + (unsigned int)rid)); return true; } |