>From c7951826016b946c74ccfc24ef44908ef5d617b6 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sat, 23 May 2015 00:02:42 -0700 Subject: [PATCH] Fix segfault in the very rare case when we are not able to find the rootnamingcontext Change-Id: I96fd5c7f39280090d5ec1dcdcb445fd7a44bd1c6 --- source4/dsdb/common/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 7b948f2..2b7d492 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -3468,7 +3468,7 @@ int dsdb_find_nc_root(struct ldb_context *samdb, TALLOC_CTX *mem_ctx, struct ldb ret = ldb_search(samdb, tmp_ctx, &root_res, ldb_dn_new(tmp_ctx, samdb, ""), LDB_SCOPE_BASE, root_attrs, NULL); - if (ret != LDB_SUCCESS) { + if (ret != LDB_SUCCESS || root_res->count == 0) { DEBUG(1,("Searching for namingContexts in rootDSE failed: %s\n", ldb_errstring(samdb))); talloc_free(tmp_ctx); return ret; -- 2.1.4