The branch, master has been updated
       via  8378898... s4:samldb LDB module - start on a sequential trigger 
implementation
       via  a8788ce... ldb:ldb_msg_add_steal_string - prevent also there the 
addition of strings with length 0
       via  0fce829... s4:dsdb_load_udv_v1 - "uint32_t" counter type fits 
better than "unsigned int"
      from  0fddbe4... s3-waf: Check if compiler supports LL suffix

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


- Log -----------------------------------------------------------------
commit 83788988cbd879789108e8119fa3527ceeb47fe4
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Mon May 31 13:58:27 2010 +0200

    s4:samldb LDB module - start on a sequential trigger implementation
    
    This is a start to allow the triggers to be called sequentially.

commit a8788ce5236a4fbc1c8096a0eed48638b5a03dd8
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Mon May 31 22:22:37 2010 +0200

    ldb:ldb_msg_add_steal_string - prevent also there the addition of strings 
with length 0

commit 0fce829de46995d474053bd581555dd40e549ff1
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Mon May 31 22:04:29 2010 +0200

    s4:dsdb_load_udv_v1 - "uint32_t" counter type fits better than "unsigned 
int"

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

Summary of changes:
 source4/dsdb/common/util.c              |    2 +-
 source4/dsdb/samdb/ldb_modules/samldb.c |   36 ++++++++++++++++++++++--------
 source4/lib/ldb/common/ldb_msg.c        |    5 ++++
 3 files changed, 32 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 9329e61..408a959 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3310,7 +3310,7 @@ int dsdb_load_udv_v1(struct ldb_context *samdb, struct 
ldb_dn *dn, TALLOC_CTX *m
                     struct drsuapi_DsReplicaCursor **cursors, uint32_t *count)
 {
        struct drsuapi_DsReplicaCursor2 *v2;
-       unsigned int i;
+       uint32_t i;
        int ret;
 
        ret = dsdb_load_udv_v2(samdb, dn, mem_ctx, &v2, count);
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c 
b/source4/dsdb/samdb/ldb_modules/samldb.c
index d7ce48f..a068a29 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -1168,7 +1168,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
        rid = samdb_result_uint(ac->msg, "primaryGroupID", (uint32_t) -1);
        if (rid == (uint32_t) -1) {
                /* we aren't affected of any primary group change */
-               return ldb_next_request(ac->module, ac->req);
+               return LDB_SUCCESS;
        }
 
        sid = dom_sid_add_rid(ac, samdb_domain_sid(ldb), rid);
@@ -1225,7 +1225,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
                }
        }
 
-       return ldb_next_request(ac->module, ac->req);
+       return LDB_SUCCESS;
 }
 
 
@@ -1241,6 +1241,11 @@ static int samldb_member_check(struct samldb_ctx *ac)
        ldb = ldb_module_get_ctx(ac->module);
 
        el = ldb_msg_find_element(ac->msg, "member");
+       if (el == NULL) {
+               /* we aren't affected */
+               return LDB_SUCCESS;
+       }
+
        for (i = 0; i < el->num_values; i++) {
                /* Denies to add "member"s to groups which are primary ones
                 * for them */
@@ -1275,7 +1280,7 @@ static int samldb_member_check(struct samldb_ctx *ac)
                }
        }
 
-       return ldb_next_request(ac->module, ac->req);
+       return LDB_SUCCESS;
 }
 
 
@@ -1294,7 +1299,7 @@ static int samldb_prim_group_users_check(struct 
samldb_ctx *ac)
                                   NULL);
        if (sid == NULL) {
                /* No SID - it might not be a SAM object - therefore ok */
-               return ldb_next_request(ac->module, ac->req);
+               return LDB_SUCCESS;
        }
        status = dom_sid_split_rid(ac, sid, NULL, &rid);
        if (!NT_STATUS_IS_OK(status)) {
@@ -1302,7 +1307,7 @@ static int samldb_prim_group_users_check(struct 
samldb_ctx *ac)
        }
        if (rid == 0) {
                /* Special object (security principal?) */
-               return ldb_next_request(ac->module, ac->req);
+               return LDB_SUCCESS;
        }
 
        /* Deny delete requests from groups which are primary ones */
@@ -1316,7 +1321,7 @@ static int samldb_prim_group_users_check(struct 
samldb_ctx *ac)
                return LDB_ERR_ENTRY_ALREADY_EXISTS;
        }
 
-       return ldb_next_request(ac->module, ac->req);
+       return LDB_SUCCESS;
 }
 
 
@@ -1507,7 +1512,10 @@ static int samldb_modify(struct ldb_module *module, 
struct ldb_request *req)
                req->op.mod.message = ac->msg = ldb_msg_copy_shallow(req,
                        req->op.mod.message);
 
-               return samldb_prim_group_change(ac);
+               ret = samldb_prim_group_change(ac);
+               if (ret != LDB_SUCCESS) {
+                       return ret;
+               }
        }
        if (el && (el->flags == LDB_FLAG_MOD_DELETE)) {
                return LDB_ERR_UNWILLING_TO_PERFORM;
@@ -1568,10 +1576,12 @@ static int samldb_modify(struct ldb_module *module, 
struct ldb_request *req)
                req->op.mod.message = ac->msg = ldb_msg_copy_shallow(req,
                        req->op.mod.message);
 
-               return samldb_member_check(ac);
+               ret = samldb_member_check(ac);
+               if (ret != LDB_SUCCESS) {
+                       return ret;
+               }
        }
 
-       /* nothing matched, go on */
        return ldb_next_request(module, req);
 }
 
@@ -1579,6 +1589,7 @@ static int samldb_modify(struct ldb_module *module, 
struct ldb_request *req)
 static int samldb_delete(struct ldb_module *module, struct ldb_request *req)
 {
        struct samldb_ctx *ac;
+       int ret;
 
        if (ldb_dn_is_special(req->op.del.dn)) {
                /* do not manipulate our control entries */
@@ -1589,7 +1600,12 @@ static int samldb_delete(struct ldb_module *module, 
struct ldb_request *req)
        if (ac == NULL)
                return LDB_ERR_OPERATIONS_ERROR;
 
-       return samldb_prim_group_users_check(ac);
+       ret = samldb_prim_group_users_check(ac);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+
+       return ldb_next_request(module, req);
 }
 
 static int samldb_extended_allocate_rid_pool(struct ldb_module *module, struct 
ldb_request *req)
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 0322446..2cfc449 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -255,6 +255,11 @@ int ldb_msg_add_steal_string(struct ldb_message *msg,
        val.data = (uint8_t *)str;
        val.length = strlen(str);
 
+       if (val.length == 0) {
+               /* allow empty strings as non-existent attributes */
+               return LDB_SUCCESS;
+       }
+
        return ldb_msg_add_steal_value(msg, attr_name, &val);
 }
 


-- 
Samba Shared Repository

Reply via email to