From: Andrew Tridgell Date: Sun, 13 Feb 2011 23:08:24 +0000 (+1100) Subject: s4-ldb: added LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK X-Git-Tag: tevent-0.9.11~685 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c2ccd24ebf91125394e4aa369945cc689152ff5f;p=thirdparty%2Fsamba.git s4-ldb: added LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK this allows a ldb module to force an element as single valued --- diff --git a/source4/lib/ldb/include/ldb_module.h b/source4/lib/ldb/include/ldb_module.h index a793525b7c1..0f2a080763e 100644 --- a/source4/lib/ldb/include/ldb_module.h +++ b/source4/lib/ldb/include/ldb_module.h @@ -49,6 +49,9 @@ struct ldb_module; /* attribute has failed access check and must not be exposed */ #define LDB_FLAG_INTERNAL_INACCESSIBLE_ATTRIBUTE 0x40 +/* force single value checking on this attribute */ +#define LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK 0x80 + /* these function pointers define the operations that a ldb module can intercept diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 5c1dd1bdceb..831361c5473 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -284,6 +284,14 @@ static bool ldb_tdb_single_valued(const struct ldb_schema_attribute *a, { if (!a) return false; if (el != NULL) { + if (el->flags & LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK) { + /* override from a ldb module, for example + used for the description field, which is + marked multi-valued in the schema but which + should not actually accept multiple + values */ + return true; + } if (el->flags & LDB_FLAG_INTERNAL_DISABLE_SINGLE_VALUE_CHECK) { /* override from a ldb module, for example used for deleted linked attribute entries */