summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-12-07 10:08:14 +0000
committerKarolin Seeger <kseeger@samba.org>2012-12-11 09:05:08 +0100
commit0da785a14b9966b42a9415b905881f5511ba9032 (patch)
tree995d1bfb0fa1d7628e27b7af8e044c60399dfa73
parent1762d1436217874df06d36284e1bfaef385ebdb4 (diff)
downloadsamba-0da785a14b9966b42a9415b905881f5511ba9032.tar.gz
s4:dsdb/schema_data.c: correctly move the CN=Aggregate attributes to msg->elements[i].values (bug #9470)
We should keep the talloc hierarchy sane. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> (cherry picked from commit 3535f8effefef6a68d2b686abe2769d797531dd9)
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_data.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_data.c b/source4/dsdb/samdb/ldb_modules/schema_data.c
index bc9488b4e97..3ce7ef9935c 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_data.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_data.c
@@ -405,7 +405,11 @@ static int generate_objectClasses(struct ldb_context *ldb, struct ldb_message *m
int ret;
for (sclass = schema->classes; sclass; sclass = sclass->next) {
- ret = ldb_msg_add_string(msg, "objectClasses", schema_class_to_description(msg, sclass));
+ char *v = schema_class_to_description(msg, sclass);
+ if (v == NULL) {
+ return ldb_oom(ldb);
+ }
+ ret = ldb_msg_add_steal_string(msg, "objectClasses", v);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -417,9 +421,13 @@ static int generate_attributeTypes(struct ldb_context *ldb, struct ldb_message *
{
const struct dsdb_attribute *attribute;
int ret;
-
+
for (attribute = schema->attributes; attribute; attribute = attribute->next) {
- ret = ldb_msg_add_string(msg, "attributeTypes", schema_attribute_to_description(msg, attribute));
+ char *v = schema_attribute_to_description(msg, attribute);
+ if (v == NULL) {
+ return ldb_oom(ldb);
+ }
+ ret = ldb_msg_add_steal_string(msg, "attributeTypes", v);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -461,7 +469,7 @@ static int generate_extendedAttributeInfo(struct ldb_context *ldb,
return ldb_oom(ldb);
}
- ret = ldb_msg_add_string(msg, "extendedAttributeInfo", val);
+ ret = ldb_msg_add_steal_string(msg, "extendedAttributeInfo", val);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -483,7 +491,7 @@ static int generate_extendedClassInfo(struct ldb_context *ldb,
return ldb_oom(ldb);
}
- ret = ldb_msg_add_string(msg, "extendedClassInfo", val);
+ ret = ldb_msg_add_steal_string(msg, "extendedClassInfo", val);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -521,7 +529,11 @@ static int generate_possibleInferiors(struct ldb_context *ldb, struct ldb_messag
}
for (i=0;possibleInferiors[i];i++) {
- ret = ldb_msg_add_string(msg, "possibleInferiors", possibleInferiors[i]);
+ char *v = talloc_strdup(msg, possibleInferiors[i]);
+ if (v == NULL) {
+ return ldb_oom(ldb);
+ }
+ ret = ldb_msg_add_steal_string(msg, "possibleInferiors", v);
if (ret != LDB_SUCCESS) {
return ret;
}