From 422f1b5495cba21c697d9d7b6026e980ed611546 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 14 Jun 2006 16:09:34 +0000 Subject: r16227: Don't segfault if the ldb_search() fails. Andrew Bartlett (This used to be commit af11f464a717cc7db0393070da780091a6053ee0) --- source4/dsdb/samdb/ldb_modules/samldb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 7c28c935ce..b883809417 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -292,7 +292,7 @@ static int samldb_get_new_sid(struct ldb_module *module, struct ldb_result *res = NULL; const struct ldb_dn *dom_dn; int ret; - struct dom_sid *dom_sid, *obj_sid; + struct dom_sid *dom_sid; /* get the domain component part of the provided dn */ @@ -494,7 +494,10 @@ static int samldb_copy_template(struct ldb_module *module, struct ldb_message *m /* pull the template record */ ret = ldb_search(module->ldb, basedn, LDB_SCOPE_SUBTREE, filter, NULL, &res); - if (ret != LDB_SUCCESS || res->count != 1) { + if (ret != LDB_SUCCESS) { + return ret; + } + if (res->count != 1) { ldb_set_errstring(module->ldb, talloc_asprintf(module, "samldb_copy_template: ERROR: template '%s' matched %d records, expected 1\n", filter, res->count)); return LDB_ERR_OPERATIONS_ERROR; -- cgit