diff options
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samba_dsdb.c | 11 |
1 files 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 d561780569..ee7e42ef9b 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) { |