From c16e96e46f5301a7fe897ed0451fd4bb788fee14 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 25 Nov 2009 18:49:42 +1100 Subject: [PATCH] s4:dsdb Make samba_dsdb easier to use in upgrades - assume default values --- source4/dsdb/samdb/ldb_modules/samba_dsdb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c index d5617805690..ee7e42ef9bc 100644 --- a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c +++ b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c @@ -237,14 +237,17 @@ static int samba_dsdb_init(struct ldb_module *module) } while (0) ret = dsdb_module_search_dn(module, tmp_ctx, &res, samba_dsdb_dn, samba_dsdb_attrs, 0); - if (ret != LDB_SUCCESS) { + if (ret == LDB_ERR_NO_SUCH_OBJECT) { + backendType = "ldb"; + serverRole = "domain controller"; + } else if (ret == LDB_SUCCESS) { + backendType = ldb_msg_find_attr_as_string(res->msgs[0], "backendType", "ldb"); + serverRole = ldb_msg_find_attr_as_string(res->msgs[0], "serverRole", "domain controller"); + } else { talloc_free(tmp_ctx); return ret; } - backendType = ldb_msg_find_attr_as_string(res->msgs[0], "backendType", "ldb"); - serverRole = ldb_msg_find_attr_as_string(res->msgs[0], "serverRole", NULL); - backend_modules = NULL; if (strcasecmp(backendType, "ldb") == 0) { if (strcasecmp(serverRole, "dc") == 0 || strcasecmp(serverRole, "domain controller") == 0) { -- 2.11.4.GIT