dsdb-acl: Add helper function dsdb_get_structural_oc_from_msg()
authorAndrew Bartlett <abartlet@samba.org>
Wed, 2 Jan 2013 03:52:21 +0000 (14:52 +1100)
committerStefan Metzmacher <metze@samba.org>
Mon, 21 Jan 2013 15:12:45 +0000 (16:12 +0100)
This will eventually replace get_oc_guid_from_message(), returning the full dsdb_class.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/util.c

index 253d5c1d2ccbac123e71ebc55e38dc53c02af3ce..f7803e56cb153fbf5055615404c1a81471394154 100644 (file)
@@ -1393,3 +1393,16 @@ const struct dsdb_class *dsdb_get_last_structural_class(const struct dsdb_schema
 
        return last_class;
 }
+
+const struct dsdb_class *dsdb_get_structural_oc_from_msg(const struct dsdb_schema *schema,
+                                                        const struct ldb_message *msg)
+{
+       struct ldb_message_element *oc_el;
+
+       oc_el = ldb_msg_find_element(msg, "objectClass");
+       if (!oc_el) {
+               return NULL;
+       }
+
+       return dsdb_get_last_structural_class(schema, oc_el);
+}