summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/util.c
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-04-04 22:24:16 +0200
committerAndrew Bartlett <abartlet@samba.org>2012-04-11 06:31:51 +0200
commit0c44d46f24ef69598eaef281bcb82f943655d0bc (patch)
tree6219094ce16ab0e5332ddcf50a3bec11a731e891 /source4/dsdb/samdb/ldb_modules/util.c
parent83062125e60dd097a1a151fb35467fe55a356780 (diff)
downloadsamba-0c44d46f24ef69598eaef281bcb82f943655d0bc.tar.gz
samba-0c44d46f24ef69598eaef281bcb82f943655d0bc.tar.bz2
samba-0c44d46f24ef69598eaef281bcb82f943655d0bc.zip
s4:dsdb/samdb/ldb_modules/schema.c - move "get_last_structural_class()" into "util.c"
And remove this helper module - it does not have much sense keeping it. Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Apr 11 06:31:51 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/util.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 4e0001d17b..0f1a61236f 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -1362,3 +1362,33 @@ struct ldb_message_element *dsdb_get_single_valued_attr(const struct ldb_message
return el;
}
+
+/*
+ * This function determines the (last) structural or 88 object class of a passed
+ * "objectClass" attribute - per MS-ADTS 3.1.1.1.4 this is the last value.
+ * Without schema this does not work and hence NULL is returned.
+ */
+const struct dsdb_class *dsdb_get_last_structural_class(const struct dsdb_schema *schema,
+ const struct ldb_message_element *element)
+{
+ const struct dsdb_class *last_class;
+
+ if (schema == NULL) {
+ return NULL;
+ }
+
+ if (element->num_values == 0) {
+ return NULL;
+ }
+
+ last_class = dsdb_class_by_lDAPDisplayName_ldb_val(schema,
+ &element->values[element->num_values-1]);
+ if (last_class == NULL) {
+ return NULL;
+ }
+ if (last_class->objectClassCategory > 1) {
+ return NULL;
+ }
+
+ return last_class;
+}