summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-07-05 12:36:16 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-05 07:10:03 +0200
commit28dbd8bbc174f5417b9dccea38f296e385f2c378 (patch)
tree0e85a8ddd22e1f842c611667121b16edfe0d4f57 /source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
parent4e63ac6191e55bc602c7cba6e12e01f35985c6b1 (diff)
downloadsamba-28dbd8bbc174f5417b9dccea38f296e385f2c378.tar.gz
samba-28dbd8bbc174f5417b9dccea38f296e385f2c378.tar.bz2
samba-28dbd8bbc174f5417b9dccea38f296e385f2c378.zip
s4-dsdb: allow removal of unknown attributes if RELAX set
this allows attributes not known in the schema to be removed if the caller has set the RELAX control. This will be used by dbcheck to allow cleaning of bad attributes from the database
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/objectclass_attrs.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass_attrs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
index 5639a7a3e3..302904ab97 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
@@ -121,6 +121,12 @@ static int attr_handler(struct oc_context *ac)
attr = dsdb_attribute_by_lDAPDisplayName(ac->schema,
msg->elements[i].name);
if (attr == NULL) {
+ if (ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID) &&
+ ac->req->operation != LDB_ADD) {
+ /* we allow this for dbcheck to fix
+ broken attributes */
+ goto no_attribute;
+ }
ldb_asprintf_errstring(ldb, "objectclass_attrs: attribute '%s' on entry '%s' was not found in the schema!",
msg->elements[i].name,
ldb_dn_get_linearized(msg->dn));
@@ -172,6 +178,7 @@ static int attr_handler(struct oc_context *ac)
msg->elements[i].name = attr->lDAPDisplayName;
}
+no_attribute:
if (ac->req->operation == LDB_ADD) {
ret = ldb_build_add_req(&child_req, ldb, ac,
msg, ac->req->controls,
@@ -297,6 +304,11 @@ static int attr_handler2(struct oc_context *ac)
attr = dsdb_attribute_by_lDAPDisplayName(ac->schema,
msg->elements[i].name);
if (attr == NULL) {
+ if (ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID)) {
+ /* allow this to make it possible for dbcheck
+ to remove bad attributes */
+ continue;
+ }
return ldb_operr(ldb);
}