[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3072-gdcc39ed

Volker Lendecke vlendec at samba.org
Thu Jul 3 09:07:22 GMT 2008


The branch, v3-3-test has been updated
       via  dcc39ed00453a075b23daece2844ca4817bfbfaf (commit)
       via  cd8e63b2b45402091d6d328b3c6ca593fc19ac92 (commit)
      from  3a7542fd495223c3a504571a52e2d00551fea0e2 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit dcc39ed00453a075b23daece2844ca4817bfbfaf
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 3 02:32:18 2008 +0200

    Don't scream, better explain a bit in comments

commit cd8e63b2b45402091d6d328b3c6ca593fc19ac92
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 3 02:26:43 2008 +0200

    Make use of sid_check_is_in_unix_users/groups
    
    Don't replicate code unnecessarily

-----------------------------------------------------------------------

Summary of changes:
 source/passdb/lookup_sid.c |   45 +++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/passdb/lookup_sid.c b/source/passdb/lookup_sid.c
index a7175b9..4e11bb8 100644
--- a/source/passdb/lookup_sid.c
+++ b/source/passdb/lookup_sid.c
@@ -1109,7 +1109,7 @@ void store_gid_sid_cache(const DOM_SID *psid, gid_t gid)
 }
 
 /*****************************************************************
- *THE LEGACY* convert uid_t to SID function.
+ uid_t->SID conversion used if winbind is not around
 *****************************************************************/  
 
 static void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
@@ -1143,7 +1143,7 @@ static void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
 }
 
 /*****************************************************************
- *THE LEGACY* convert gid_t to SID function.
+ gid_t->SID conversion used if winbind is not around
 *****************************************************************/  
 
 static void legacy_gid_to_sid(DOM_SID *psid, gid_t gid)
@@ -1174,7 +1174,7 @@ static void legacy_gid_to_sid(DOM_SID *psid, gid_t gid)
 }
 
 /*****************************************************************
- *THE LEGACY* convert SID to uid function.
+ SID->uid_t conversion used if winbind is not around
 *****************************************************************/  
 
 static bool legacy_sid_to_uid(const DOM_SID *psid, uid_t *puid)
@@ -1217,8 +1217,7 @@ done:
 }
 
 /*****************************************************************
- *THE LEGACY* convert SID to gid function.
- Group mapping is used for gids that maps to Wellknown SIDs
+ SID->gid_t conversion used if winbind is not around
 *****************************************************************/  
 
 static bool legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
@@ -1281,7 +1280,7 @@ static bool legacy_sid_to_gid(const DOM_SID *psid, gid_t *pgid)
 }
 
 /*****************************************************************
- *THE CANONICAL* convert uid_t to SID function.
+ uid_t->SID conversion
 *****************************************************************/  
 
 void uid_to_sid(DOM_SID *psid, uid_t uid)
@@ -1310,7 +1309,7 @@ void uid_to_sid(DOM_SID *psid, uid_t uid)
 }
 
 /*****************************************************************
- *THE CANONICAL* convert gid_t to SID function.
+ gid_t->SID conversion
 *****************************************************************/  
 
 void gid_to_sid(DOM_SID *psid, gid_t gid)
@@ -1339,12 +1338,11 @@ void gid_to_sid(DOM_SID *psid, gid_t gid)
 }
 
 /*****************************************************************
- *THE CANONICAL* convert SID to uid function.
+ SID->uid_t conversion
 *****************************************************************/  
 
 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 +1354,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;
 	}
 
@@ -1387,8 +1388,7 @@ bool sid_to_uid(const DOM_SID *psid, uid_t *puid)
 }
 
 /*****************************************************************
- *THE CANONICAL* convert SID to gid function.
- Group mapping is used for gids that maps to Wellknown SIDs
+ SID->gid_t conversion
 *****************************************************************/  
 
 bool sid_to_gid(const DOM_SID *psid, gid_t *pgid)
@@ -1404,13 +1404,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;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list