[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Fri Nov 13 17:39:31 MST 2009


The branch, master has been updated
       via  0ac3c16... s3:fix a comment typo
       via  2e3d9ab... s3:is_trusted_domain: shortcut if domain name == global_sam_name
       via  144c238... s3:is_trusted_domain: shortcut if domain name is NULL or empty
       via  7e418bf... s3:passdb: bump interface VERSION 18->19 (removed uid_to_rid)
       via  30ab3a7... s3:passdb: remove the uid_to_rid method - we only need uid_to_sid
       via  3b7448d... s3:pdb_default_uid_to_sid: fix some debug statements.
      from  ec49f28... s3/pam: move variable declaration into belonging ifdef section

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0ac3c1693c0a0576fbde27547cda472fa166a3a2
Author: Michael Adam <obnox at samba.org>
Date:   Sat Nov 14 01:23:05 2009 +0100

    s3:fix a comment typo
    
    Michael

commit 2e3d9abeafebffa6ff1c7b3de80525cd5f6deb49
Author: Michael Adam <obnox at samba.org>
Date:   Sat Nov 14 01:21:42 2009 +0100

    s3:is_trusted_domain: shortcut if domain name == global_sam_name
    
    A domain can't have a trust with itself.
    This saves some roundtrips to the ldap server for ldapsam.
    
    Michael

commit 144c23893ec580eed1a38b2fd577b4bd4ebf491d
Author: Michael Adam <obnox at samba.org>
Date:   Sat Nov 14 01:12:22 2009 +0100

    s3:is_trusted_domain: shortcut if domain name is NULL or empty
    
    This saves some roundtrips to LDAP in an ldapsm setup.
    
    Michael

commit 7e418bf736a8ba9f33cd3b2125d8fcae51d641bd
Author: Michael Adam <obnox at samba.org>
Date:   Sat Nov 14 01:07:34 2009 +0100

    s3:passdb: bump interface VERSION 18->19 (removed uid_to_rid)
    
    Michael

commit 30ab3a762e644f5825adf4aef82e00d20e7228fb
Author: Michael Adam <obnox at samba.org>
Date:   Sat Nov 14 01:06:35 2009 +0100

    s3:passdb: remove the uid_to_rid method - we only need uid_to_sid
    
    Michael

commit 3b7448de1468dd86d101972bce40e4931fa2d1c3
Author: Michael Adam <obnox at samba.org>
Date:   Sat Nov 14 00:34:14 2009 +0100

    s3:pdb_default_uid_to_sid: fix some debug statements.
    
    Michael

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

Summary of changes:
 source3/auth/auth_util.c       |   10 +++++++++-
 source3/include/passdb.h       |    5 ++---
 source3/include/proto.h        |    1 -
 source3/passdb/lookup_sid.c    |    5 +----
 source3/passdb/pdb_ads.c       |    7 -------
 source3/passdb/pdb_interface.c |   34 +++-------------------------------
 6 files changed, 15 insertions(+), 47 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 1d25e22..8167a80 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -2167,7 +2167,7 @@ bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_me
  * Verify whether or not given domain is trusted.
  *
  * @param domain_name name of the domain to be verified
- * @return true if domain is one of the trusted once or
+ * @return true if domain is one of the trusted ones or
  *         false if otherwise
  **/
 
@@ -2181,6 +2181,14 @@ bool is_trusted_domain(const char* dom_name)
 	if ( lp_server_role() == ROLE_STANDALONE )
 		return False;
 
+	if (dom_name == NULL || dom_name[0] == '\0') {
+		return false;
+	}
+
+	if (strequal(dom_name, get_global_sam_name())) {
+		return false;
+	}
+
 	/* if we are a DC, then check for a direct trust relationships */
 
 	if ( IS_DC ) {
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 2b4f9c2..c8e4bc2 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -240,9 +240,10 @@ enum pdb_policy_type {
  * Changed to 16 for access to the trusted domain passwords (obnox).
  * Changed to 17, the sampwent interface is gone.
  * Changed to 18, pdb_rid_algorithm -> pdb_capabilities
+ * Changed to 19, removed uid_to_rid
  */
 
-#define PASSDB_INTERFACE_VERSION 18
+#define PASSDB_INTERFACE_VERSION 19
 
 struct pdb_methods 
 {
@@ -385,8 +386,6 @@ struct pdb_methods
 			       struct pdb_search *search,
 			       const DOM_SID *sid);
 
-	bool (*uid_to_rid)(struct pdb_methods *methods, uid_t uid,
-			   uint32 *rid);
 	bool (*uid_to_sid)(struct pdb_methods *methods, uid_t uid,
 			   DOM_SID *sid);
 	bool (*gid_to_sid)(struct pdb_methods *methods, gid_t gid,
diff --git a/source3/include/proto.h b/source3/include/proto.h
index f9a2a50..aeb19d3 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4624,7 +4624,6 @@ NTSTATUS pdb_lookup_names(const DOM_SID *domain_sid,
 bool pdb_get_account_policy(enum pdb_policy_type type, uint32_t *value);
 bool pdb_set_account_policy(enum pdb_policy_type type, uint32_t value);
 bool pdb_get_seq_num(time_t *seq_num);
-bool pdb_uid_to_rid(uid_t uid, uint32 *rid);
 bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid);
 bool pdb_gid_to_sid(gid_t gid, DOM_SID *sid);
 bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c
index 1fcd94c..a197c51 100644
--- a/source3/passdb/lookup_sid.c
+++ b/source3/passdb/lookup_sid.c
@@ -1129,19 +1129,16 @@ void store_gid_sid_cache(const DOM_SID *psid, gid_t gid)
 
 static void legacy_uid_to_sid(DOM_SID *psid, uid_t uid)
 {
-	uint32 rid;
 	bool ret;
 
 	ZERO_STRUCTP(psid);
 
 	become_root();
-	ret = pdb_uid_to_rid(uid, &rid);
+	ret = pdb_uid_to_sid(uid, psid);
 	unbecome_root();
 
 	if (ret) {
 		/* This is a mapped user */
-		sid_copy(psid, get_global_sam_sid());
-		sid_append_rid(psid, rid);
 		goto done;
 	}
 
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index 35aadbd..3ddf4f2 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -1917,12 +1917,6 @@ static bool pdb_ads_search_aliases(struct pdb_methods *m,
 	return true;
 }
 
-static bool pdb_ads_uid_to_rid(struct pdb_methods *m, uid_t uid,
-			       uint32 *rid)
-{
-	return false;
-}
-
 static bool pdb_ads_uid_to_sid(struct pdb_methods *m, uid_t uid,
 			       DOM_SID *sid)
 {
@@ -2072,7 +2066,6 @@ static void pdb_ads_init_methods(struct pdb_methods *m)
 	m->search_users = pdb_ads_search_users;
 	m->search_groups = pdb_ads_search_groups;
 	m->search_aliases = pdb_ads_search_aliases;
-	m->uid_to_rid = pdb_ads_uid_to_rid;
 	m->uid_to_sid = pdb_ads_uid_to_sid;
 	m->gid_to_sid = pdb_ads_gid_to_sid;
 	m->sid_to_id = pdb_ads_sid_to_id;
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 5d0b625..de46254 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1024,12 +1024,6 @@ bool pdb_get_seq_num(time_t *seq_num)
 	return NT_STATUS_IS_OK(pdb->get_seq_num(pdb, seq_num));
 }
 
-bool pdb_uid_to_rid(uid_t uid, uint32 *rid)
-{
-	struct pdb_methods *pdb = pdb_get_methods();
-	return pdb->uid_to_rid(pdb, uid, rid);
-}
-
 bool pdb_uid_to_sid(uid_t uid, DOM_SID *sid)
 {
 	struct pdb_methods *pdb = pdb_get_methods();
@@ -1200,13 +1194,13 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 	unix_pw = sys_getpwuid( uid );
 
 	if ( !unix_pw ) {
-		DEBUG(4,("pdb_default_uid_to_rid: host has no idea of uid "
+		DEBUG(4,("pdb_default_uid_to_sid: host has no idea of uid "
 			 "%lu\n", (unsigned long)uid));
 		return False;
 	}
 
 	if ( !(sampw = samu_new( NULL )) ) {
-		DEBUG(0,("pdb_default_uid_to_rid: samu_new() failed!\n"));
+		DEBUG(0,("pdb_default_uid_to_sid: samu_new() failed!\n"));
 		return False;
 	}
 
@@ -1216,7 +1210,7 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 	unbecome_root();
 
 	if (!ret) {
-		DEBUG(5, ("pdb_default_uid_to_rid: Did not find user "
+		DEBUG(5, ("pdb_default_uid_to_sid: Did not find user "
 			  "%s (%u)\n", unix_pw->pw_name, (unsigned int)uid));
 		TALLOC_FREE(sampw);
 		return False;
@@ -1229,27 +1223,6 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 	return True;
 }
 
-static bool pdb_default_uid_to_rid(struct pdb_methods *methods, uid_t uid,
-				   uint32 *rid)
-{
-	DOM_SID sid;
-	bool ret;
-
-	ret = pdb_default_uid_to_sid(methods, uid, &sid);
-	if (!ret) {
-		return ret;
-	}
-
-	ret = sid_peek_check_rid(get_global_sam_sid(), &sid, rid);
-
-	if (!ret) {
-		DEBUG(1, ("Could not peek rid out of sid %s\n",
-			  sid_string_dbg(&sid)));
-	}
-
-	return ret;
-}
-
 static bool pdb_default_gid_to_sid(struct pdb_methods *methods, gid_t gid,
 				   DOM_SID *sid)
 {
@@ -2057,7 +2030,6 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
 	(*methods)->get_account_policy = pdb_default_get_account_policy;
 	(*methods)->set_account_policy = pdb_default_set_account_policy;
 	(*methods)->get_seq_num = pdb_default_get_seq_num;
-	(*methods)->uid_to_rid = pdb_default_uid_to_rid;
 	(*methods)->uid_to_sid = pdb_default_uid_to_sid;
 	(*methods)->gid_to_sid = pdb_default_gid_to_sid;
 	(*methods)->sid_to_id = pdb_default_sid_to_id;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list