summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-06-14 16:09:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:06 -0500
commit422f1b5495cba21c697d9d7b6026e980ed611546 (patch)
tree4c8ffe7d77ddc3a054f2c552ae372effab1fb35e
parent345c9f043fa76aecfd9edf017fa77ea393e95d4f (diff)
downloadsamba-422f1b5495cba21c697d9d7b6026e980ed611546.tar.gz
samba-422f1b5495cba21c697d9d7b6026e980ed611546.tar.bz2
samba-422f1b5495cba21c697d9d7b6026e980ed611546.zip
r16227: Don't segfault if the ldb_search() fails.
Andrew Bartlett (This used to be commit af11f464a717cc7db0393070da780091a6053ee0)
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c7
1 files changed, 5 insertions, 2 deletions
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;