]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-ldb: added LDB_FLAG_INTERNAL_FORCE_SINGLE_VALUE_CHECK
authorAndrew Tridgell <tridge@samba.org>
Sun, 13 Feb 2011 23:08:24 +0000 (10:08 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 14 Feb 2011 06:55:08 +0000 (17:55 +1100)
this allows a ldb module to force an element as single valued

source4/lib/ldb/include/ldb_module.h
source4/lib/ldb/ldb_tdb/ldb_tdb.c

index a793525b7c18dd9660971b429a5c31cf88115b29..0f2a080763e392493ab2fcc8ef47bd0b3416bd3e 100644 (file)
@@ -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
index 5c1dd1bdceba8dc9b46d5b73d01f039eac43acfb..831361c547377c368d56560f232036ba97df013c 100644 (file)
@@ -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 */