summaryrefslogtreecommitdiff
path: root/source4/wrepl_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/wrepl_server')
-rw-r--r--source4/wrepl_server/wrepl_server.c13
-rw-r--r--source4/wrepl_server/wrepl_server.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index 157a39ec85..3b800333ed 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -33,6 +33,12 @@
#include "ldb/include/ldb.h"
#include "ldb/include/ldb_errors.h"
+static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx)
+{
+ return ldb_wrap_connect(mem_ctx, private_path(mem_ctx, lp_wins_config_url()),
+ system_session(mem_ctx), NULL, 0, NULL);
+}
+
/*
open winsdb
*/
@@ -43,6 +49,11 @@ static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service)
return NT_STATUS_INTERNAL_DB_ERROR;
}
+ service->config.ldb = wins_config_db_connect(service);
+ if (!service->config.ldb) {
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+
/* the default renew interval is 6 days */
service->config.renew_interval = lp_parm_int(-1,"wreplsrv","renew_interval", 6*24*60*60);
@@ -85,7 +96,7 @@ static NTSTATUS wreplsrv_load_partners(struct wreplsrv_service *service)
int i;
/* find the record in the WINS database */
- ret = ldb_search(service->wins_db, ldb_dn_explode(tmp_ctx, "CN=PARTNERS"), LDB_SCOPE_ONELEVEL,
+ ret = ldb_search(service->config.ldb, ldb_dn_explode(tmp_ctx, "CN=PARTNERS"), LDB_SCOPE_SUBTREE,
"(objectClass=wreplPartner)", NULL, &res);
if (ret != LDB_SUCCESS) goto failed;
talloc_steal(tmp_ctx, res);
diff --git a/source4/wrepl_server/wrepl_server.h b/source4/wrepl_server/wrepl_server.h
index e781d85ab8..9631f0abc8 100644
--- a/source4/wrepl_server/wrepl_server.h
+++ b/source4/wrepl_server/wrepl_server.h
@@ -214,6 +214,9 @@ struct wreplsrv_service {
/* some configuration */
struct {
+ /* the wins config db handle */
+ struct ldb_context *ldb;
+
/*
* the interval (in secs) till an active record will be marked as RELEASED
*/