dsdb-schema: when dealing with backlink fetch the forward attribute and then use...
authorMatthieu Patou <mat@matws.net>
Wed, 11 May 2011 12:07:14 +0000 (16:07 +0400)
committerMatthieu Patou <mat@matws.net>
Sat, 11 Jun 2011 19:18:55 +0000 (23:18 +0400)
source4/dsdb/schema/schema_query.c

index c92d273edf1960a83198ed82c9de32be9f29c813..a4c20079d696525c447166cfa3c6082b187eadc8 100644 (file)
@@ -91,11 +91,22 @@ const struct dsdb_attribute *dsdb_attribute_by_lDAPDisplayName(const struct dsdb
                                                               const char *name)
 {
        struct dsdb_attribute *c;
+       bool isbacklink = false;
 
        if (!name) return NULL;
 
+       if (strncmp(name, "@BL_", 4) == 0) {
+               name += 4;
+               isbacklink = true;
+       }
+
        BINARY_ARRAY_SEARCH_P(schema->attributes_by_lDAPDisplayName,
                              schema->num_attributes, lDAPDisplayName, name, strcasecmp, c);
+
+       if (c && isbacklink) {
+               return c->backwardlink;
+       }
+
        return c;
 }