diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-12-07 10:08:14 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-12-07 14:28:25 +0100 |
commit | 3535f8effefef6a68d2b686abe2769d797531dd9 (patch) | |
tree | e7dfe9ff760785535e169c665dffee7121e69d41 /source4/dsdb/samdb/ldb_modules | |
parent | 944b6863a71efc48ccc8cd9ae8ad1a3081bc1805 (diff) | |
download | samba-3535f8effefef6a68d2b686abe2769d797531dd9.tar.gz samba-3535f8effefef6a68d2b686abe2769d797531dd9.tar.bz2 samba-3535f8effefef6a68d2b686abe2769d797531dd9.zip |
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>
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/schema_data.c | 24 |
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 bc9488b4e9..3ce7ef9935 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; } |