[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Nov 7 04:11:01 MST 2010


The branch, master has been updated
       via  786a767 s4:ldb_modules/util.c - "dsdb_get_single_valued_attr" - support the attribute fetch also on LDB add operations
      from  d6d5f80 ldb:ldb_pack.c - the "dn" attribute isn't allowed in the message part, only the "distinguishedName" one

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


- Log -----------------------------------------------------------------
commit 786a76720c10c01a9636c6cf892cce42d05d647d
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Nov 7 11:27:26 2010 +0100

    s4:ldb_modules/util.c - "dsdb_get_single_valued_attr" - support the attribute fetch also on LDB add operations
    
    We've to completely ignore the flags in that case.
    
    Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
    Autobuild-Date: Sun Nov  7 11:10:23 UTC 2010 on sn-devel-104

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

Summary of changes:
 source4/dsdb/samdb/ldb_modules/samldb.c |   18 ++++++++++++------
 source4/dsdb/samdb/ldb_modules/util.c   |   12 ++++++++----
 2 files changed, 20 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index ee43d84..04b8dff 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1009,7 +1009,8 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
 	struct ldb_dn *prev_prim_group_dn, *new_prim_group_dn;
 	int ret;
 
-	el = dsdb_get_single_valued_attr(ac->msg, "primaryGroupID");
+	el = dsdb_get_single_valued_attr(ac->msg, "primaryGroupID",
+					 ac->req->operation);
 	if (el == NULL) {
 		/* we are not affected */
 		return LDB_SUCCESS;
@@ -1154,7 +1155,8 @@ static int samldb_user_account_control_change(struct samldb_ctx *ac)
 	struct ldb_message *tmp_msg;
 	int ret;
 
-	el = dsdb_get_single_valued_attr(ac->msg, "userAccountControl");
+	el = dsdb_get_single_valued_attr(ac->msg, "userAccountControl",
+					 ac->req->operation);
 	if (el == NULL) {
 		/* we are not affected */
 		return LDB_SUCCESS;
@@ -1227,7 +1229,8 @@ static int samldb_group_type_change(struct samldb_ctx *ac)
 	struct ldb_message *tmp_msg;
 	int ret;
 
-	el = dsdb_get_single_valued_attr(ac->msg, "groupType");
+	el = dsdb_get_single_valued_attr(ac->msg, "groupType",
+					 ac->req->operation);
 	if (el == NULL) {
 		/* we are not affected */
 		return LDB_SUCCESS;
@@ -1313,7 +1316,8 @@ static int samldb_sam_accountname_check(struct samldb_ctx *ac)
 	struct ldb_message *tmp_msg;
 	int ret;
 
-	el = dsdb_get_single_valued_attr(ac->msg, "sAMAccountName");
+	el = dsdb_get_single_valued_attr(ac->msg, "sAMAccountName",
+					 ac->req->operation);
 	if (el == NULL) {
 		/* we are not affected */
 		return LDB_SUCCESS;
@@ -1487,8 +1491,10 @@ static int samldb_service_principal_names_change(struct samldb_ctx *ac)
 	unsigned int i;
 	int ret;
 
-	el = dsdb_get_single_valued_attr(ac->msg, "dNSHostName");
-	el2 = dsdb_get_single_valued_attr(ac->msg, "sAMAccountName");
+	el = dsdb_get_single_valued_attr(ac->msg, "dNSHostName",
+					 ac->req->operation);
+	el2 = dsdb_get_single_valued_attr(ac->msg, "sAMAccountName",
+					  ac->req->operation);
 	if ((el == NULL) && (el2 == NULL)) {
 		/* we are not affected */
 		return LDB_SUCCESS;
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 7d6fcc4..07a3d0a 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -1118,7 +1118,8 @@ void dsdb_req_chain_debug(struct ldb_request *req, int level)
  * enhanced (no other modifications as deletions, variations).
  */
 struct ldb_message_element *dsdb_get_single_valued_attr(struct ldb_message *msg,
-							const char *attr_name)
+							const char *attr_name,
+							enum ldb_request_type operation)
 {
 	struct ldb_message_element *el = NULL;
 	unsigned int i;
@@ -1129,9 +1130,12 @@ struct ldb_message_element *dsdb_get_single_valued_attr(struct ldb_message *msg,
 	 * If "el" is NULL afterwards then that means there was no interesting
 	 * change entry. */
 	for (i = 0; i < msg->num_elements; i++) {
-		if ((ldb_attr_cmp(msg->elements[i].name, attr_name) == 0) &&
-		    (LDB_FLAG_MOD_TYPE(msg->elements[i].flags)
-						!= LDB_FLAG_MOD_DELETE)) {
+		if (ldb_attr_cmp(msg->elements[i].name, attr_name) == 0) {
+			if ((operation == LDB_MODIFY) &&
+			    (LDB_FLAG_MOD_TYPE(msg->elements[i].flags)
+						== LDB_FLAG_MOD_DELETE)) {
+				continue;
+			}
 			el = &msg->elements[i];
 		}
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list