summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/samdb.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-08-14 02:50:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:33 -0500
commita993f53d525799df410bab1061fdb28f52379b3c (patch)
tree3e5f6d8419301e7880975ac604676216a3f048ad /source4/dsdb/samdb/samdb.c
parent0cc8a1780df94cdec90942b1cbf5d4059627bf8e (diff)
downloadsamba-a993f53d525799df410bab1061fdb28f52379b3c.tar.gz
samba-a993f53d525799df410bab1061fdb28f52379b3c.tar.bz2
samba-a993f53d525799df410bab1061fdb28f52379b3c.zip
r17529: Simo doesn't like the use of the internal ldb_errstring in functions
not used purely as ldb module helper functions. This now passes these strings back as explicit parameters. Andrew Bartlett (This used to be commit 9c1cd9c2c6bcd9d056a7c9caafacdd573562ebbc)
Diffstat (limited to 'source4/dsdb/samdb/samdb.c')
-rw-r--r--source4/dsdb/samdb/samdb.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index a659c66725..81b5afb2ee 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -674,11 +674,14 @@ int samdb_find_or_add_attribute(struct ldb_context *ldb, struct ldb_message *msg
copy from a template record to a message
*/
int samdb_copy_template(struct ldb_context *ldb,
- struct ldb_message *msg, const char *filter)
+ struct ldb_message *msg, const char *filter,
+ char **errstring)
{
struct ldb_result *res;
struct ldb_message *t;
int ret, i, j;
+
+ *errstring = NULL;
struct ldb_dn *basedn = ldb_dn_explode(ldb, "cn=Templates");
@@ -686,11 +689,12 @@ int samdb_copy_template(struct ldb_context *ldb,
ret = ldb_search(ldb, basedn, LDB_SCOPE_SUBTREE, filter, NULL, &res);
talloc_free(basedn);
if (ret != LDB_SUCCESS) {
+ *errstring = talloc_steal(msg, ldb_errstring(ldb));
return ret;
}
if (res->count != 1) {
- DEBUG(1, ("samdb_copy_template: ERROR: template '%s' matched %d records, expected 1\n", filter,
- res->count));
+ *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: template '%s' matched %d records, expected 1\n", filter,
+ res->count);
talloc_free(res);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -719,7 +723,7 @@ int samdb_copy_template(struct ldb_context *ldb,
ret = samdb_find_or_add_value(ldb, msg, el->name,
(char *)el->values[j].data);
if (ret) {
- DEBUG(1, ( "Adding objectClass %s failed.\n", el->values[j].data));
+ *errstring = talloc_asprintf(msg, "Adding objectClass %s failed.\n", el->values[j].data);
talloc_free(res);
return ret;
}
@@ -727,7 +731,7 @@ int samdb_copy_template(struct ldb_context *ldb,
ret = samdb_find_or_add_attribute(ldb, msg, el->name,
(char *)el->values[j].data);
if (ret) {
- DEBUG(1, ("Adding attribute %s failed.\n", el->name));
+ *errstring = talloc_asprintf(msg, "Adding attribute %s failed.\n", el->name);
talloc_free(res);
return ret;
}