s4-dsdb: added dn_format attribute of a dsdb_attribute
authorAndrew Tridgell <tridge@samba.org>
Mon, 1 Aug 2011 07:47:34 +0000 (17:47 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 4 Aug 2011 06:17:25 +0000 (16:17 +1000)
this is faster than string comparisons during searches at runtime

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>

source4/dsdb/common/dsdb_dn.h
source4/dsdb/schema/schema.h
source4/dsdb/schema/schema_inferiors.c

index b713bdd27b9a76cd7196a159d4fe1ea58af38335..b455c7f64e332ffade52eed14b7684434c0cf06e 100644 (file)
@@ -1,10 +1,3 @@
-enum dsdb_dn_format {
-       DSDB_NORMAL_DN,
-       DSDB_BINARY_DN,
-       DSDB_STRING_DN,
-       DSDB_INVALID_DN
-};
-
 struct dsdb_dn {
        struct ldb_dn *dn;
        DATA_BLOB extra_part;
index 289fd4276c85b8b739010b789862c051a89c2436..13cc31ca879b40712e14c6f45a71db23ac354b3f 100644 (file)
 
 #include "prefixmap.h"
 
+enum dsdb_dn_format {
+       DSDB_NORMAL_DN,
+       DSDB_BINARY_DN,
+       DSDB_STRING_DN,
+       DSDB_INVALID_DN
+};
+
+
 struct dsdb_attribute;
 struct dsdb_class;
 struct dsdb_schema;
@@ -108,6 +116,7 @@ struct dsdb_attribute {
        bool systemOnly;
 
        bool one_way_link;
+       enum dsdb_dn_format dn_format;
 
        /* internal stuff */
        const struct dsdb_syntax *syntax;
index 7b80c20a60605e7945e482594b6be09bc56b10e5..fe456412d1fc1a9a08666e0dbd37fa4e2d93c2a1 100644 (file)
@@ -354,9 +354,11 @@ int schema_fill_constructed(const struct dsdb_schema *schema)
                schema_class->posssuperiors = NULL;
        }
 
-       /* setup fast access to one_way_link */
+       /* setup fast access to one_way_link and DN format */
        for (attribute=schema->attributes; attribute; attribute=attribute->next) {
-               if (dsdb_dn_oid_to_format(attribute->syntax->ldap_oid) == DSDB_INVALID_DN) {
+               attribute->dn_format = dsdb_dn_oid_to_format(attribute->syntax->ldap_oid);
+
+               if (attribute->dn_format == DSDB_INVALID_DN) {
                        attribute->one_way_link = false;
                        continue;
                }
@@ -381,5 +383,6 @@ int schema_fill_constructed(const struct dsdb_schema *schema)
                attribute->one_way_link = false;
        }
 
+
        return LDB_SUCCESS;
 }