[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-95-g8414048

Volker Lendecke vlendec at samba.org
Sun Jun 28 20:14:48 GMT 2009


The branch, master has been updated
       via  8414048557305c62682c7d6c7a42a1f466e48a0a (commit)
       via  711544d4943a40649b6c590f8ee003093081889a (commit)
      from  325a58a6532e2a9bc7b8e21d55c9b1ccfb879bf9 (commit)

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


- Log -----------------------------------------------------------------
commit 8414048557305c62682c7d6c7a42a1f466e48a0a
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jun 28 17:48:07 2009 +0200

    _lsa_QueryInfoPolicy: Use symbolic info level names

commit 711544d4943a40649b6c590f8ee003093081889a
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jun 28 17:36:12 2009 +0200

    Turn the pdb_rid_algorithm into a capabilities call that returns flags

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

Summary of changes:
 source3/include/passdb.h        |    5 ++++-
 source3/include/proto.h         |    2 +-
 source3/passdb/passdb.c         |    2 +-
 source3/passdb/pdb_ads.c        |    6 +++---
 source3/passdb/pdb_interface.c  |   12 ++++++------
 source3/passdb/pdb_ldap.c       |    6 +++---
 source3/passdb/pdb_smbpasswd.c  |    6 +++---
 source3/passdb/pdb_tdb.c        |    6 +++---
 source3/rpc_server/srv_lsa_nt.c |    8 ++++----
 source3/utils/net_groupmap.c    |   12 ++++++------
 source3/utils/net_sam.c         |    6 +++---
 11 files changed, 37 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index d67c284..dadb227 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -197,6 +197,8 @@ struct pdb_search {
 	void (*search_end)(struct pdb_search *search);
 };
 
+#define PDB_CAP_STORE_RIDS	0x0001
+
 /*****************************************************************
  Functions to be implemented by the new (v2) passdb API 
 ****************************************************************/
@@ -212,6 +214,7 @@ struct pdb_search {
  * enum lsa_SidType rather than uint32.
  * 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
  */
 
 #define PASSDB_INTERFACE_VERSION 17
@@ -361,7 +364,7 @@ struct pdb_methods
 	bool (*sid_to_id)(struct pdb_methods *methods, const DOM_SID *sid,
 			  union unid_t *id, enum lsa_SidType *type);
 
-	bool (*rid_algorithm)(struct pdb_methods *methods);
+	uint32_t (*capabilities)(struct pdb_methods *methods);
 	bool (*new_rid)(struct pdb_methods *methods, uint32 *rid);
 
 
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 07a749d..1a8a9a9 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4595,7 +4595,7 @@ 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,
 		   enum lsa_SidType *type);
-bool pdb_rid_algorithm(void);
+uint32_t pdb_capabilities(void);
 bool pdb_new_rid(uint32 *rid);
 bool initialize_password_db(bool reload, struct event_context *event_ctx);
 struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 8efd659..502c372 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -207,7 +207,7 @@ static NTSTATUS samu_set_unix_internal(struct samu *user, const struct passwd *p
 	   initialized and will fill in these fields later (such as from a 
 	   netr_SamInfo3 structure) */
 
-	if ( create && !pdb_rid_algorithm() ) {
+	if ( create && (pdb_capabilities() & PDB_CAP_STORE_RIDS)) {
 		uint32 user_rid;
 		DOM_SID user_sid;
 
diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c
index cdde30d..b7c42c5 100644
--- a/source3/passdb/pdb_ads.c
+++ b/source3/passdb/pdb_ads.c
@@ -1920,9 +1920,9 @@ static bool pdb_ads_sid_to_id(struct pdb_methods *m, const DOM_SID *sid,
 	return false;
 }
 
-static bool pdb_ads_rid_algorithm(struct pdb_methods *m)
+static uint32_t pdb_ads_capabilities(struct pdb_methods *m)
 {
-	return false;
+	return PDB_CAP_STORE_RIDS;
 }
 
 static bool pdb_ads_new_rid(struct pdb_methods *m, uint32 *rid)
@@ -2005,7 +2005,7 @@ static void pdb_ads_init_methods(struct pdb_methods *m)
 	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;
-	m->rid_algorithm = pdb_ads_rid_algorithm;
+	m->capabilities = pdb_ads_capabilities;
 	m->new_rid = pdb_ads_new_rid;
 	m->get_trusteddom_pw = pdb_ads_get_trusteddom_pw;
 	m->set_trusteddom_pw = pdb_ads_set_trusteddom_pw;
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 6fe0979..a72409e 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -574,12 +574,12 @@ static NTSTATUS pdb_default_create_dom_group(struct pdb_methods *methods,
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
-	if (pdb_rid_algorithm()) {
-		*rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
-	} else {
+	if (pdb_capabilities() & PDB_CAP_STORE_RIDS) {
 		if (!pdb_new_rid(rid)) {
 			return NT_STATUS_ACCESS_DENIED;
 		}
+	} else {
+		*rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
 	}
 
 	sid_compose(&group_sid, get_global_sam_sid(), *rid);
@@ -1043,10 +1043,10 @@ bool pdb_sid_to_id(const DOM_SID *sid, union unid_t *id,
 	return pdb->sid_to_id(pdb, sid, id, type);
 }
 
-bool pdb_rid_algorithm(void)
+uint32_t pdb_capabilities(void)
 {
 	struct pdb_methods *pdb = pdb_get_methods();
-	return pdb->rid_algorithm(pdb);
+	return pdb->capabilities(pdb);
 }
 
 /********************************************************************
@@ -1065,7 +1065,7 @@ bool pdb_new_rid(uint32 *rid)
 	int i;
 	TALLOC_CTX *ctx;
 
-	if (pdb_rid_algorithm()) {
+	if ((pdb_capabilities() & PDB_CAP_STORE_RIDS) == 0) {
 		DEBUG(0, ("Trying to allocate a RID when algorithmic RIDs "
 			  "are active\n"));
 		return False;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index dddde75..c2230eb 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -4728,9 +4728,9 @@ static bool ldapsam_search_aliases(struct pdb_methods *methods,
 	return ldapsam_search_grouptype(methods, search, sid, SID_NAME_ALIAS);
 }
 
-static bool ldapsam_rid_algorithm(struct pdb_methods *methods)
+static uint32_t ldapsam_capabilities(struct pdb_methods *methods)
 {
-	return False;
+	return PDB_CAP_STORE_RIDS;
 }
 
 static NTSTATUS ldapsam_get_new_rid(struct ldapsam_privates *priv,
@@ -6154,7 +6154,7 @@ static NTSTATUS pdb_init_ldapsam_common(struct pdb_methods **pdb_method, const c
 
 	(*pdb_method)->get_seq_num = ldapsam_get_seq_num;
 
-	(*pdb_method)->rid_algorithm = ldapsam_rid_algorithm;
+	(*pdb_method)->capabilities = ldapsam_capabilities;
 	(*pdb_method)->new_rid = ldapsam_new_rid;
 
 	(*pdb_method)->get_trusteddom_pw = ldapsam_get_trusteddom_pw;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 8074b2e..cac95c4 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1520,9 +1520,9 @@ done:
 	return (ret);	
 }
 
-static bool smbpasswd_rid_algorithm(struct pdb_methods *methods)
+static uint32_t smbpasswd_capabilities(struct pdb_methods *methods)
 {
-	return True;
+	return 0;
 }
 
 static void free_private_data(void **vp) 
@@ -1682,7 +1682,7 @@ static NTSTATUS pdb_init_smbpasswd( struct pdb_methods **pdb_method, const char
 	(*pdb_method)->rename_sam_account = smbpasswd_rename_sam_account;
 	(*pdb_method)->search_users = smbpasswd_search_users;
 
-	(*pdb_method)->rid_algorithm = smbpasswd_rid_algorithm;
+	(*pdb_method)->capabilities = smbpasswd_capabilities;
 
 	/* Setup private data and free function */
 
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index dd6e678..4d2a1d8 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -1066,9 +1066,9 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
 	return NT_STATUS_ACCESS_DENIED;	
 }
 
-static bool tdbsam_rid_algorithm(struct pdb_methods *methods)
+static uint32_t tdbsam_capabilities(struct pdb_methods *methods)
 {
-	return False;
+	return PDB_CAP_STORE_RIDS;
 }
 
 static bool tdbsam_new_rid(struct pdb_methods *methods, uint32 *prid)
@@ -1246,7 +1246,7 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
 	(*pdb_method)->rename_sam_account = tdbsam_rename_sam_account;
 	(*pdb_method)->search_users = tdbsam_search_users;
 
-	(*pdb_method)->rid_algorithm = tdbsam_rid_algorithm;
+	(*pdb_method)->capabilities = tdbsam_capabilities;
 	(*pdb_method)->new_rid = tdbsam_new_rid;
 
 	/* save the path for later */
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 3e44c8e..02ddbf7 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -517,7 +517,7 @@ NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
 	}
 
 	switch (r->in.level) {
-	case 0x02:
+	case LSA_POLICY_INFO_AUDIT_EVENTS:
 		{
 
 		uint32 policy_def = LSA_AUDIT_POLICY_ALL;
@@ -549,7 +549,7 @@ NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
 
 		break;
 		}
-	case 0x03:
+	case LSA_POLICY_INFO_DOMAIN:
 		/* check if the user has enough rights */
 		if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
 			return NT_STATUS_ACCESS_DENIED;
@@ -585,7 +585,7 @@ NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
 		}
 		init_dom_query_3(&info->domain, name, sid);
 		break;
-	case 0x05:
+	case LSA_POLICY_INFO_ACCOUNT_DOMAIN:
 		/* check if the user has enough rights */
 		if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
 			return NT_STATUS_ACCESS_DENIED;
@@ -596,7 +596,7 @@ NTSTATUS _lsa_QueryInfoPolicy(pipes_struct *p,
 
 		init_dom_query_5(&info->account_domain, name, sid);
 		break;
-	case 0x06:
+	case LSA_POLICY_INFO_ROLE:
 		/* check if the user has enough rights */
 		if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
 			return NT_STATUS_ACCESS_DENIED;
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c
index a00784e..16c6187 100644
--- a/source3/utils/net_groupmap.c
+++ b/source3/utils/net_groupmap.c
@@ -276,12 +276,12 @@ static int net_groupmap_add(struct net_context *c, int argc, const char **argv)
 
 	if ( (rid == 0) && (string_sid[0] == '\0') ) {
 		d_printf("No rid or sid specified, choosing a RID\n");
-		if (pdb_rid_algorithm()) {
-			rid = algorithmic_pdb_gid_to_group_rid(gid);
-		} else {
+		if (pdb_capabilities() & PDB_CAP_STORE_RIDS) {
 			if (!pdb_new_rid(&rid)) {
 				d_printf("Could not get new RID\n");
 			}
+		} else {
+			rid = algorithmic_pdb_gid_to_group_rid(gid);
 		}
 		d_printf("Got RID %d\n", rid);
 	}
@@ -577,13 +577,13 @@ static int net_groupmap_set(struct net_context *c, int argc, const char **argv)
 		map.gid = grp->gr_gid;
 
 		if (c->opt_rid == 0) {
-			if ( pdb_rid_algorithm() )
-				c->opt_rid = algorithmic_pdb_gid_to_group_rid(map.gid);
-			else {
+			if ( pdb_capabilities() & PDB_CAP_STORE_RIDS ) {
 				if ( !pdb_new_rid((uint32*)&c->opt_rid) ) {
 					d_fprintf( stderr, "Could not allocate new RID\n");
 					return -1;
 				}
+			} else {
+				c->opt_rid = algorithmic_pdb_gid_to_group_rid(map.gid);
 			}
 		}
 
diff --git a/source3/utils/net_sam.c b/source3/utils/net_sam.c
index 787bbdd..62abef0 100644
--- a/source3/utils/net_sam.c
+++ b/source3/utils/net_sam.c
@@ -817,14 +817,14 @@ static NTSTATUS map_unix_group(const struct group *grp, GROUP_MAP *pmap)
 
 	fstrcpy(map.nt_name, grpname);
 
-	if (pdb_rid_algorithm()) {
-		rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
-	} else {
+	if (pdb_capabilities() & PDB_CAP_STORE_RIDS) {
 		if (!pdb_new_rid(&rid)) {
 			DEBUG(3, ("Could not get a new RID for %s\n",
 				  grp->gr_name));
 			return NT_STATUS_ACCESS_DENIED;
 		}
+	} else {
+		rid = algorithmic_pdb_gid_to_group_rid( grp->gr_gid );
 	}
 
 	sid_compose(&map.sid, get_global_sam_sid(), rid);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list