s4:objectclass LDB module - drop referral generation for existing base DN
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 26 Oct 2011 14:48:06 +0000 (16:48 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Wed, 16 Nov 2011 16:55:40 +0000 (17:55 +0100)
This is now handled in the partition LDB module.

source4/dsdb/samdb/ldb_modules/objectclass.c

index ed6fef462ae8ec2819d2004ef82fe90cb177b7c0..651a26b0caa5098c2e26b2a2b569310f33c828cb 100644 (file)
@@ -421,7 +421,6 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req)
        struct ldb_request *search_req;
        struct oc_context *ac;
        struct ldb_dn *parent_dn;
-       const struct ldb_val *val;
        int ret;
        static const char * const parent_attrs[] = { "objectClass", NULL };
 
@@ -434,34 +433,6 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req)
                return ldb_next_request(module, req);
        }
 
-       /* An add operation on the basedn without "NC-add" operation isn't
-        * allowed. */
-       if (ldb_dn_compare(ldb_get_default_basedn(ldb), req->op.add.message->dn) == 0) {
-               unsigned int instanceType;
-
-               instanceType = ldb_msg_find_attr_as_uint(req->op.add.message,
-                                                        "instanceType", 0);
-               if (!(instanceType & INSTANCE_TYPE_IS_NC_HEAD)) {
-                       char *referral_uri;
-                       /* When we are trying to readd the root basedn then
-                        * this is denied, but with an interesting mechanism:
-                        * there is generated a referral with the last
-                        * component value as hostname. */
-                       val = ldb_dn_get_component_val(req->op.add.message->dn,
-                                                      ldb_dn_get_comp_num(req->op.add.message->dn) - 1);
-                       if (val == NULL) {
-                               return ldb_operr(ldb);
-                       }
-                       referral_uri = talloc_asprintf(req, "ldap://%s/%s", val->data,
-                                                      ldb_dn_get_linearized(req->op.add.message->dn));
-                       if (referral_uri == NULL) {
-                               return ldb_module_oom(module);
-                       }
-
-                       return ldb_module_send_referral(req, referral_uri);
-               }
-       }
-
        ac = oc_init_context(module, req);
        if (ac == NULL) {
                return ldb_operr(ldb);