s4:objectguid LDB module - make use of "dsdb_next_callback"
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 8 Nov 2010 09:31:49 +0000 (10:31 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 8 Nov 2010 09:36:12 +0000 (10:36 +0100)
source4/dsdb/samdb/ldb_modules/objectguid.c
source4/dsdb/samdb/ldb_modules/wscript_build

index 623185fadb808ebe351fdd66844e8016066261ff..f21660c4ae00ebcc19f57669ec4890a3584d8619 100644 (file)
@@ -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)
index 360f4a45b6933fbbc8797c3ffd9af0ec5da823cb..50ec9f25bba077fe52f1aa63b41219876dd0f68b 100644 (file)
@@ -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'
        )