summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-06-01 16:36:56 +1000
committerAndrew Tridgell <tridge@samba.org>2009-06-01 16:36:56 +1000
commitce1045983fd294b95dfe91524b5d8b80a35df448 (patch)
treee289fc13a8fd940cef24a1c5502a438d9fa4f31c /source4/dsdb/schema
parent5a39817212aa34ef181e9ed72851b077ba088260 (diff)
downloadsamba-ce1045983fd294b95dfe91524b5d8b80a35df448.tar.gz
samba-ce1045983fd294b95dfe91524b5d8b80a35df448.tar.bz2
samba-ce1045983fd294b95dfe91524b5d8b80a35df448.zip
mark samAccountName, objectGUID and objectSID as unique indexed
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r--source4/dsdb/schema/schema_init.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 3a65c474fb..76e7891fbd 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -583,6 +583,22 @@ WERROR dsdb_read_prefixes_from_ldb(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
return WERR_OK;
}
+/*
+ this will be replaced with something that looks at the right part of
+ the schema once we know where unique indexing information is hidden
+ */
+static bool dsdb_schema_unique_attribute(const char *attr)
+{
+ const char *attrs[] = { "samAccountName", "objectGUID", "objectSID" , NULL };
+ int i;
+ for (i=0;attrs[i];i++) {
+ if (strcasecmp(attr, attrs[i]) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
/*
setup the ldb_schema_attribute field for a dsdb_attribute
@@ -619,6 +635,10 @@ static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb,
a->name = attr->lDAPDisplayName;
a->flags = 0;
a->syntax = s;
+
+ if (dsdb_schema_unique_attribute(a->name)) {
+ a->flags |= LDB_ATTR_FLAG_UNIQUE_INDEX;
+ }
return LDB_SUCCESS;
}