summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-04-04 21:58:04 +0200
committerAndrew Bartlett <abartlet@samba.org>2012-04-11 12:50:16 +1000
commit83062125e60dd097a1a151fb35467fe55a356780 (patch)
treea8c551ffec3da00a6fcf0ebc88c23aa79b1a06da /source4/dsdb/samdb/ldb_modules
parent3fa5f84d2f7bdd3747ea14453fc49eb6931eeedf (diff)
downloadsamba-83062125e60dd097a1a151fb35467fe55a356780.tar.gz
samba-83062125e60dd097a1a151fb35467fe55a356780.tar.bz2
samba-83062125e60dd097a1a151fb35467fe55a356780.zip
s4:dsdb/samdb/ldb_modules/schema.c - inline "get_oc_guid_from_message()" to its only user
Reduce the number of not to be shared functions in "schema.c". Change it to make use of "get_last_structural_class()".
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/acl.c26
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema.c15
2 files changed, 23 insertions, 18 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c
index 6971fbf4ee..bce878501a 100644
--- a/source4/dsdb/samdb/ldb_modules/acl.c
+++ b/source4/dsdb/samdb/ldb_modules/acl.c
@@ -908,6 +908,26 @@ static int acl_check_password_rights(TALLOC_CTX *mem_ctx,
return ret;
}
+static const struct GUID *get_oc_guid_from_message(const struct dsdb_schema *schema,
+ struct ldb_message *msg)
+{
+ struct ldb_message_element *oc_el;
+ const struct dsdb_class *object_class;
+
+ oc_el = ldb_msg_find_element(msg, "objectClass");
+ if (!oc_el) {
+ return NULL;
+ }
+
+ object_class = get_last_structural_class(schema, oc_el);
+ if (object_class == NULL) {
+ return NULL;
+ }
+
+ return &object_class->schemaIDGUID;
+}
+
+
static int acl_modify(struct ldb_module *module, struct ldb_request *req)
{
int ret;
@@ -973,7 +993,7 @@ static int acl_modify(struct ldb_module *module, struct ldb_request *req)
goto success;
}
- guid = get_oc_guid_from_message(module, schema, acl_res->msgs[0]);
+ guid = get_oc_guid_from_message(schema, acl_res->msgs[0]);
if (!guid) {
talloc_free(tmp_ctx);
return ldb_error(ldb, LDB_ERR_OPERATIONS_ERROR,
@@ -1247,7 +1267,7 @@ static int acl_rename(struct ldb_module *module, struct ldb_request *req)
return ldb_operr(ldb);
}
- guid = get_oc_guid_from_message(module, schema, acl_res->msgs[0]);
+ guid = get_oc_guid_from_message(schema, acl_res->msgs[0]);
if (!insert_in_object_tree(tmp_ctx, guid, SEC_ADS_WRITE_PROP,
&root, &new_node)) {
talloc_free(tmp_ctx);
@@ -1315,7 +1335,7 @@ static int acl_rename(struct ldb_module *module, struct ldb_request *req)
/* new parent should have create child */
root = NULL;
new_node = NULL;
- guid = get_oc_guid_from_message(module, schema, acl_res->msgs[0]);
+ guid = get_oc_guid_from_message(schema, acl_res->msgs[0]);
if (!guid) {
ldb_asprintf_errstring(ldb_module_get_ctx(module),
"acl:renamed object has no object class\n");
diff --git a/source4/dsdb/samdb/ldb_modules/schema.c b/source4/dsdb/samdb/ldb_modules/schema.c
index 333fb1b0a6..233816f99a 100644
--- a/source4/dsdb/samdb/ldb_modules/schema.c
+++ b/source4/dsdb/samdb/ldb_modules/schema.c
@@ -59,19 +59,4 @@ const struct dsdb_class *get_last_structural_class(const struct dsdb_schema *sch
return last_class;
}
-const struct GUID *get_oc_guid_from_message(struct ldb_module *module,
- const struct dsdb_schema *schema,
- struct ldb_message *msg)
-{
- struct ldb_message_element *oc_el;
-
- oc_el = ldb_msg_find_element(msg, "objectClass");
- if (!oc_el) {
- return NULL;
- }
-
- return class_schemaid_guid_by_lDAPDisplayName(schema,
- (char *)oc_el->values[oc_el->num_values-1].data);
-}
-