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 };
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);