s4-dsdb: bypass validation when relax set
authorAndrew Tridgell <tridge@samba.org>
Wed, 22 Jun 2011 08:14:14 +0000 (18:14 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 22 Jun 2011 10:27:06 +0000 (12:27 +0200)
this allows dbcheck to fix bad attributes

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Wed Jun 22 12:27:06 CEST 2011 on sn-devel-104

source4/dsdb/samdb/ldb_modules/objectclass_attrs.c

index 9df121002f071c4d5f2dc903f526c3e89de2fe70..5639a7a3e3e3f4ba9ec6b37af9d20c44e1c9404e 100644 (file)
@@ -140,7 +140,8 @@ static int attr_handler(struct oc_context *ac)
                if (!(msg->elements[i].flags & LDB_FLAG_INTERNAL_DISABLE_VALIDATION)) {
                        werr = attr->syntax->validate_ldb(&syntax_ctx, attr,
                                                          &msg->elements[i]);
-                       if (!W_ERROR_IS_OK(werr)) {
+                       if (!W_ERROR_IS_OK(werr) &&
+                           !ldb_request_get_control(ac->req, LDB_CONTROL_RELAX_OID)) {
                                ldb_asprintf_errstring(ldb, "objectclass_attrs: attribute '%s' on entry '%s' contains at least one invalid value!",
                                                       msg->elements[i].name,
                                                       ldb_dn_get_linearized(msg->dn));