diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-08-01 13:54:58 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-08-04 16:17:24 +1000 |
commit | a74f4673eda682bbca4adfed8a924b16114a0dcd (patch) | |
tree | f42e6dc4551f1336e7fa6a20995cb4d280c26268 /source4/dsdb | |
parent | fc40769b64188adedf273913fa94d30b307970d3 (diff) | |
download | samba-a74f4673eda682bbca4adfed8a924b16114a0dcd.tar.gz samba-a74f4673eda682bbca4adfed8a924b16114a0dcd.tar.bz2 samba-a74f4673eda682bbca4adfed8a924b16114a0dcd.zip |
s4-dsdb: setup a one_way_link attribute on schema attributes
this allows us to quickly determine if a DN is a one way link
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Pair-Programmed-With: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/schema/schema.h | 2 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_inferiors.c | 28 |
2 files changed, 30 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h index 75351798c2..289fd4276c 100644 --- a/source4/dsdb/schema/schema.h +++ b/source4/dsdb/schema/schema.h @@ -107,6 +107,8 @@ struct dsdb_attribute { bool isDefunct; bool systemOnly; + bool one_way_link; + /* internal stuff */ const struct dsdb_syntax *syntax; const struct ldb_schema_attribute *ldb_schema_attribute; diff --git a/source4/dsdb/schema/schema_inferiors.c b/source4/dsdb/schema/schema_inferiors.c index d2c134ea9e..7b80c20a60 100644 --- a/source4/dsdb/schema/schema_inferiors.c +++ b/source4/dsdb/schema/schema_inferiors.c @@ -328,6 +328,7 @@ int schema_fill_constructed(const struct dsdb_schema *schema) { int ret; struct dsdb_class *schema_class; + struct dsdb_attribute *attribute; schema_fill_from_ids(schema); @@ -353,5 +354,32 @@ int schema_fill_constructed(const struct dsdb_schema *schema) schema_class->posssuperiors = NULL; } + /* setup fast access to one_way_link */ + for (attribute=schema->attributes; attribute; attribute=attribute->next) { + if (dsdb_dn_oid_to_format(attribute->syntax->ldap_oid) == DSDB_INVALID_DN) { + attribute->one_way_link = false; + continue; + } + + /* these are not considered to be one way links for + the purpose of DN link fixups */ + if (ldb_attr_cmp("distinguishedName", attribute->lDAPDisplayName) == 0 || + ldb_attr_cmp("objectCategory", attribute->lDAPDisplayName) == 0) { + attribute->one_way_link = false; + continue; + } + + if (attribute->linkID == 0) { + attribute->one_way_link = true; + continue; + } + /* handle attributes with a linkID but no backlink */ + if (dsdb_attribute_by_linkID(schema, attribute->linkID) == NULL) { + attribute->one_way_link = true; + continue; + } + attribute->one_way_link = false; + } + return LDB_SUCCESS; } |