1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

s4-ldb: added LDB_FLAG_INTERNAL_DISABLE_VALIDATION

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>
This commit is contained in:
Andrew Tridgell 2010-08-17 12:04:45 +10:00
parent 9e27201b24
commit 0caf347098
2 changed files with 15 additions and 7 deletions

View 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) {

View File

@ -38,6 +38,12 @@
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
*/