diff options
author | Richard Sharpe <sharpe@samba.org> | 2004-05-06 05:31:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:51:26 -0500 |
commit | 7cb9ca16f6678ce9687512fd3f7892122b4878fe (patch) | |
tree | 981122629de651aebeda8402c7f158b160b06085 | |
parent | fc62b9fcc14acc0712e246db2ad698aeeea22fc4 (diff) | |
download | samba-7cb9ca16f6678ce9687512fd3f7892122b4878fe.tar.gz samba-7cb9ca16f6678ce9687512fd3f7892122b4878fe.tar.xz samba-7cb9ca16f6678ce9687512fd3f7892122b4878fe.zip |
r505: Break out algorithmic_gid_to_sid so that those of us who need it can use it.
(This used to be commit 5d7ee320cca80558a4b71295ef8b7de02f21554a)
-rw-r--r-- | source3/passdb/passdb.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 9c8185670ff..8313a259bd2 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -1177,6 +1177,24 @@ BOOL local_sid_to_uid(uid_t *puid, const DOM_SID *psid, enum SID_NAME_USE *name_ } /**************************************************************************** + Convert a gid to SID - algorithmic. +****************************************************************************/ + +DOM_SID *algorithmic_gid_to_sid(DOM_SID *psid, uid_t gid) +{ + if ( !lp_enable_rid_algorithm() ) + return NULL; + + DEBUG(8,("algorithmic_gid_to_sid: falling back to RID algorithm\n")); + sid_copy( psid, get_global_sam_sid() ); + sid_append_rid( psid, pdb_gid_to_group_rid(gid) ); + DEBUG(10,("algorithmic_gid_to_sid: gid (%d) -> SID %s.\n", + (unsigned int)gid, sid_string_static(psid) )); + + return psid; +} + +/**************************************************************************** Convert a gid to SID - locally. ****************************************************************************/ @@ -1199,13 +1217,11 @@ DOM_SID *local_gid_to_sid(DOM_SID *psid, gid_t gid) /* fallback to rid mapping if enabled */ if ( lp_enable_rid_algorithm() ) { - sid_copy(psid, get_global_sam_sid()); - sid_append_rid(psid, pdb_gid_to_group_rid(gid)); DEBUG(10,("local_gid_to_sid: Fall back to algorithmic mapping: %u -> %s\n", (unsigned int)gid, sid_string_static(psid))); - return psid; + return algorithmic_gid_to_sid(psid, gid); } else return NULL; |