s4:samldb LDB module - remove "samldb_set_defaultObjectCategory"
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 20 Jun 2010 09:46:55 +0000 (11:46 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 20 Jun 2010 16:52:27 +0000 (18:52 +0200)
As far as I can tell and the test show the DN gets now normalised automatically
when stored into the database.

Anyway, if we find a case where this doesn't happen then I propose to do it
centrally for all DN attributes in common since we should get away from special
attribute hacks as far as possible.

source4/dsdb/samdb/ldb_modules/samldb.c

index 5d64b6d398655b1761bbf50eddc5963e4e0bd0f7..5b7e4bea07bbec1a03dfca56e4d7f8098e513d61 100644 (file)
@@ -476,81 +476,6 @@ static int samldb_check_primaryGroupID_2(struct samldb_ctx *ac)
 }
 
 
-/*
- * samldb_set_defaultObjectCategory_callback (async)
- */
-
-static int samldb_set_defaultObjectCategory_callback(struct ldb_request *req,
-                                                    struct ldb_reply *ares)
-{
-       struct ldb_context *ldb;
-       struct samldb_ctx *ac;
-       int ret;
-
-       ac = talloc_get_type(req->context, struct samldb_ctx);
-       ldb = ldb_module_get_ctx(ac->module);
-
-       if (!ares) {
-               ret = LDB_ERR_OPERATIONS_ERROR;
-               goto done;
-       }
-
-       if (ares->type == LDB_REPLY_REFERRAL) {
-               return ldb_module_send_referral(ac->req, ares->referral);
-       }
-
-       if (ares->error != LDB_SUCCESS) {
-               return ldb_module_done(ac->req, ares->controls,
-                                       ares->response, ares->error);
-       }
-       if (ares->type != LDB_REPLY_DONE) {
-               ldb_set_errstring(ldb,
-                       "Invalid reply type!");
-               ret = LDB_ERR_OPERATIONS_ERROR;
-               goto done;
-       }
-
-       ret = samldb_next_step(ac);
-
-done:
-       if (ret != LDB_SUCCESS) {
-               return ldb_module_done(ac->req, NULL, NULL, ret);
-       }
-
-       return LDB_SUCCESS;
-}
-
-static int samldb_set_defaultObjectCategory(struct samldb_ctx *ac)
-{
-       struct ldb_context *ldb;
-       struct ldb_message *msg;
-       struct ldb_request *req;
-       int ret;
-
-       ldb = ldb_module_get_ctx(ac->module);
-
-       /* (Re)set the default object category to have it set to the DN in the
-        * storage format */
-       msg = ldb_msg_new(ac);
-       msg->dn = ac->msg->dn;
-       ldb_msg_add_empty(msg, "defaultObjectCategory",
-                         LDB_FLAG_MOD_REPLACE, NULL);
-       ldb_msg_add_steal_string(msg, "defaultObjectCategory",
-                                ldb_dn_alloc_linearized(msg, ac->res_dn));
-
-       ret = ldb_build_mod_req(&req, ldb, ac,
-                               msg, NULL,
-                               ac,
-                               samldb_set_defaultObjectCategory_callback,
-                               ac->req);
-       if (ret != LDB_SUCCESS) {
-               talloc_free(msg);
-               return ret;
-       }
-
-       return ldb_next_request(ac->module, req);
-}
-
 /*
  * samldb_find_for_defaultObjectCategory (async)
  */
@@ -942,9 +867,6 @@ static int samldb_fill_object(struct samldb_ctx *ac, const char *type)
                ret = samldb_add_step(ac, samldb_find_for_defaultObjectCategory);
                if (ret != LDB_SUCCESS) return ret;
 
-               ret = samldb_add_step(ac, samldb_set_defaultObjectCategory);
-               if (ret != LDB_SUCCESS) return ret;
-
                return samldb_first_step(ac);
        } else if (strcmp(ac->type, "attributeSchema") == 0) {
                const struct ldb_val *rdn_value;