s4-ldb: added LDB_FLAG_INTERNAL_DISABLE_VALIDATION
authorAndrew Tridgell <tridge@samba.org>
Tue, 17 Aug 2010 02:04:45 +0000 (12:04 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 17 Aug 2010 11:21:50 +0000 (21:21 +1000)
When this flag is set on an element in an add/modify request then the
normal validate_ldb() call that checks the element against schema
constraints is disabled

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
source4/lib/ldb/include/ldb_module.h

index b9436e3a04955cc0bbf68d6add6abccadc3762a9..070d8585aecb68ff3d44107e910eb2c2055ba989 100644 (file)
@@ -113,13 +113,15 @@ static int attr_handler(struct oc_context *ac)
                        return LDB_ERR_UNWILLING_TO_PERFORM;
                }
                
-               werr = attr->syntax->validate_ldb(ldb, ac->schema, attr,
-                                                 &msg->elements[i]);
-               if (!W_ERROR_IS_OK(werr)) {
-                       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));
-                       return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
+               if (!(msg->elements[i].flags & LDB_FLAG_INTERNAL_DISABLE_VALIDATION)) {
+                       werr = attr->syntax->validate_ldb(ldb, ac->schema, attr,
+                                                         &msg->elements[i]);
+                       if (!W_ERROR_IS_OK(werr)) {
+                               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));
+                               return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
+                       }
                }
 
                if ((attr->systemFlags & DS_FLAG_ATTR_IS_CONSTRUCTED) != 0) {
index 55121a81069f1dbcb59dd811e1cc46f25f8e5598..18982b975fa8707503f44509cf8d5d1489ff79b5 100644 (file)
 struct ldb_context;
 struct ldb_module;
 
+/**
+   internal flag bits on message elements. Must be within LDB_FLAG_INTERNAL_MASK
+ */
+#define LDB_FLAG_INTERNAL_DISABLE_VALIDATION 0x10
+
+
 /*
    these function pointers define the operations that a ldb module can intercept
 */