From bb2eef52950166bd50b7ea403097504faa5f720a Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 8 Nov 2010 10:31:49 +0100 Subject: s4:objectguid LDB module - make use of "dsdb_next_callback" --- source4/dsdb/samdb/ldb_modules/objectguid.c | 34 ++++------------------------ source4/dsdb/samdb/ldb_modules/wscript_build | 2 +- 2 files changed, 6 insertions(+), 30 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 623185fadb..f21660c4ae 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -32,6 +32,7 @@ #include "includes.h" #include "ldb_module.h" #include "dsdb/samdb/samdb.h" +#include "dsdb/samdb/ldb_modules/util.h" #include "librpc/gen_ndr/ndr_misc.h" #include "param/param.h" @@ -97,32 +98,7 @@ struct og_context { struct ldb_request *req; }; -static int og_op_callback(struct ldb_request *req, struct ldb_reply *ares) -{ - struct og_context *ac; - - ac = talloc_get_type(req->context, struct og_context); - - if (!ares) { - return ldb_module_done(ac->req, NULL, NULL, - LDB_ERR_OPERATIONS_ERROR); - } - if (ares->error != LDB_SUCCESS) { - return ldb_module_done(ac->req, ares->controls, - ares->response, ares->error); - } - - if (ares->type != LDB_REPLY_DONE) { - talloc_free(ares); - return ldb_module_done(ac->req, NULL, NULL, - LDB_ERR_OPERATIONS_ERROR); - } - - return ldb_module_done(ac->req, ares->controls, - ares->response, ares->error); -} - -/* add_record: add objectGUID attribute */ +/* add_record: add objectGUID and timestamp attributes */ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) { struct ldb_context *ldb; @@ -192,7 +168,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) ret = ldb_build_add_req(&down_req, ldb, ac, msg, req->controls, - ac, og_op_callback, + req, dsdb_next_callback, req); LDB_REQ_SET_LOCATION(down_req); if (ret != LDB_SUCCESS) { @@ -252,7 +228,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) ret = ldb_build_mod_req(&down_req, ldb, ac, msg, req->controls, - ac, og_op_callback, + req, dsdb_next_callback, req); LDB_REQ_SET_LOCATION(down_req); if (ret != LDB_SUCCESS) { @@ -266,7 +242,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) static const struct ldb_module_ops ldb_objectguid_module_ops = { .name = "objectguid", .add = objectguid_add, - .modify = objectguid_modify, + .modify = objectguid_modify }; int ldb_objectguid_module_init(const char *version) diff --git a/source4/dsdb/samdb/ldb_modules/wscript_build b/source4/dsdb/samdb/ldb_modules/wscript_build index 360f4a45b6..50ec9f25bb 100644 --- a/source4/dsdb/samdb/ldb_modules/wscript_build +++ b/source4/dsdb/samdb/ldb_modules/wscript_build @@ -50,7 +50,7 @@ bld.SAMBA_MODULE('ldb_objectguid', init_function='ldb_objectguid_module_init', module_init_name='ldb_init_module', internal_module=False, - deps='samdb talloc events ndr' + deps='samdb talloc events ndr DSDB_MODULE_HELPERS' ) -- cgit