diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-06-20 15:09:55 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-06-20 18:52:30 +0200 |
commit | 9803c89ee28b4b4d6e4514b362aa60adb7f93366 (patch) | |
tree | 262e8f71171a8207b2181a72f6a92bc944847056 /source4 | |
parent | fbd09029581d2f9b6c6f0c2410d768d501f4b75c (diff) | |
download | samba-9803c89ee28b4b4d6e4514b362aa60adb7f93366.tar.gz samba-9803c89ee28b4b4d6e4514b362aa60adb7f93366.tar.bz2 samba-9803c89ee28b4b4d6e4514b362aa60adb7f93366.zip |
s4:ldap_backend.c - move function "ldb_mod_req_with_controls" to a better place in the code
Under the "add" and over the "delete" function.
Diffstat (limited to 'source4')
-rw-r--r-- | source4/ldap_server/ldap_backend.c | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 32780d4957..e009641cdd 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -175,51 +175,6 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err, /* result is 1:1 for now */ return ldb_err; } -/* create and execute a modify request */ -static int ldb_mod_req_with_controls(struct ldb_context *ldb, - const struct ldb_message *message, - struct ldb_control **controls, - void *context) -{ - struct ldb_request *req; - int ret; - - ret = ldb_msg_sanity_check(ldb, message); - if (ret != LDB_SUCCESS) { - return ret; - } - - ret = ldb_build_mod_req(&req, ldb, ldb, - message, - controls, - context, - ldb_modify_default_callback, - NULL); - - if (ret != LDB_SUCCESS) { - return ret; - } - - ret = ldb_transaction_start(ldb); - if (ret != LDB_SUCCESS) { - return ret; - } - - ret = ldb_request(ldb, req); - if (ret == LDB_SUCCESS) { - ret = ldb_wait(req->handle, LDB_WAIT_ALL); - } - - if (ret == LDB_SUCCESS) { - ret = ldb_transaction_commit(ldb); - } - else { - ldb_transaction_cancel(ldb); - } - - talloc_free(req); - return ret; -} /* connect to the sam database @@ -320,9 +275,9 @@ static NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error) return NT_STATUS_OK; } -int ldb_add_with_context(struct ldb_context *ldb, - const struct ldb_message *message, - void *context) +static int ldb_add_with_context(struct ldb_context *ldb, + const struct ldb_message *message, + void *context) { struct ldb_request *req; int ret; @@ -362,9 +317,55 @@ int ldb_add_with_context(struct ldb_context *ldb, return ret; } -int ldb_delete_with_context(struct ldb_context *ldb, - struct ldb_dn *dn, - void *context) +/* create and execute a modify request */ +static int ldb_mod_req_with_controls(struct ldb_context *ldb, + const struct ldb_message *message, + struct ldb_control **controls, + void *context) +{ + struct ldb_request *req; + int ret; + + ret = ldb_msg_sanity_check(ldb, message); + if (ret != LDB_SUCCESS) { + return ret; + } + + ret = ldb_build_mod_req(&req, ldb, ldb, + message, + controls, + context, + ldb_modify_default_callback, + NULL); + + if (ret != LDB_SUCCESS) { + return ret; + } + + ret = ldb_transaction_start(ldb); + if (ret != LDB_SUCCESS) { + return ret; + } + + ret = ldb_request(ldb, req); + if (ret == LDB_SUCCESS) { + ret = ldb_wait(req->handle, LDB_WAIT_ALL); + } + + if (ret == LDB_SUCCESS) { + ret = ldb_transaction_commit(ldb); + } + else { + ldb_transaction_cancel(ldb); + } + + talloc_free(req); + return ret; +} + +static int ldb_delete_with_context(struct ldb_context *ldb, + struct ldb_dn *dn, + void *context) { struct ldb_request *req; int ret; |