diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-06-10 16:08:23 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-06-10 16:22:08 +0200 |
commit | 13ca999b3b4660e530ac0b91342c40ff8a3c7a31 (patch) | |
tree | 9f27188abb5e37f45c170bc72c6e3a20034f92b2 /source4/dsdb/samdb/ldb_modules/samldb.c | |
parent | 9f9529886499acc80ad7316d5eab590545643b87 (diff) | |
download | samba-13ca999b3b4660e530ac0b91342c40ff8a3c7a31.tar.gz samba-13ca999b3b4660e530ac0b91342c40ff8a3c7a31.tar.bz2 samba-13ca999b3b4660e530ac0b91342c40ff8a3c7a31.zip |
s4:samldb LDB module - don't create multiple "ac" module contexts on modify operations
Since we do now run sequentially through all checks we don't need multiple "ac"
contexts anymore.
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/samldb.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 64a91c8fd2..a50739baa0 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -1395,6 +1395,7 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req) static int samldb_modify(struct ldb_module *module, struct ldb_request *req) { struct ldb_context *ldb; + struct samldb_ctx *ac; struct ldb_message *msg; struct ldb_message_element *el, *el2; int ret; @@ -1421,6 +1422,11 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req) } } + ac = samldb_ctx_init(module, req); + if (ac == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + /* TODO: do not modify original request, create a new one */ el = ldb_msg_find_element(req->op.mod.message, "groupType"); @@ -1447,12 +1453,6 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req) el = ldb_msg_find_element(req->op.mod.message, "primaryGroupID"); if (el && (el->flags == LDB_FLAG_MOD_REPLACE) && el->num_values == 1) { - struct samldb_ctx *ac; - - ac = samldb_ctx_init(module, req); - if (ac == NULL) - return LDB_ERR_OPERATIONS_ERROR; - req->op.mod.message = ac->msg = ldb_msg_copy_shallow(req, req->op.mod.message); @@ -1511,12 +1511,6 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req) el = ldb_msg_find_element(req->op.mod.message, "member"); if (el && el->flags & (LDB_FLAG_MOD_ADD|LDB_FLAG_MOD_REPLACE) && el->num_values == 1) { - struct samldb_ctx *ac; - - ac = samldb_ctx_init(module, req); - if (ac == NULL) - return LDB_ERR_OPERATIONS_ERROR; - req->op.mod.message = ac->msg = ldb_msg_copy_shallow(req, req->op.mod.message); |