summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-17 15:45:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:28 -0500
commit736543016e35882d2ad784c3598a3e8c2c7fcc7b (patch)
tree165908bc76070ffd14c39bc79ea6e09199bba5ba
parent356eed3fe816c4058de5eda79d1087b8a54e62cc (diff)
downloadsamba-736543016e35882d2ad784c3598a3e8c2c7fcc7b.tar.gz
samba-736543016e35882d2ad784c3598a3e8c2c7fcc7b.tar.bz2
samba-736543016e35882d2ad784c3598a3e8c2c7fcc7b.zip
r12304: split out the wins partner configuration into a seperate ldb.
now $privatedir/wins_config.ldb contains the wins partners and $lockdir/wins.ldb contains the name records metze (This used to be commit baa4a7a9d4f16adf476846850a63dfbfd51b10b3)
-rw-r--r--source4/param/loadparm.c4
-rwxr-xr-xsource4/script/tests/selftest.sh5
-rw-r--r--source4/wrepl_server/wrepl_server.c13
-rw-r--r--source4/wrepl_server/wrepl_server.h3
4 files changed, 21 insertions, 4 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 6395bff182..7051c61d5c 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -119,6 +119,7 @@ typedef struct
char *szConfigFile;
char *szSAM_URL;
char *szSPOOLSS_URL;
+ char *szWINS_CONFIG_URL;
char *szWINS_URL;
char *szPrivateDir;
char **jsInclude;
@@ -417,6 +418,7 @@ static struct parm_struct parm_table[] = {
{"password server", P_LIST, P_GLOBAL, &Globals.szPasswordServers, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"sam database", P_STRING, P_GLOBAL, &Globals.szSAM_URL, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"spoolss database", P_STRING, P_GLOBAL, &Globals.szSPOOLSS_URL, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"wins config database", P_STRING, P_GLOBAL, &Globals.szWINS_CONFIG_URL, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"wins database", P_STRING, P_GLOBAL, &Globals.szWINS_URL, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -613,6 +615,7 @@ static void init_globals(void)
do_parameter("private dir", dyn_PRIVATE_DIR, NULL);
do_parameter("sam database", "sam.ldb", NULL);
do_parameter("spoolss database", "spoolss.ldb", NULL);
+ do_parameter("wins config database", "wins_config.ldb", NULL);
do_parameter("wins database", "wins.ldb", NULL);
do_parameter("registry:HKEY_LOCAL_MACHINE", "hklm.ldb", NULL);
@@ -817,6 +820,7 @@ FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
FN_GLOBAL_STRING(lp_sam_url, &Globals.szSAM_URL)
FN_GLOBAL_STRING(lp_spoolss_url, &Globals.szSPOOLSS_URL)
+FN_GLOBAL_STRING(lp_wins_config_url, &Globals.szWINS_CONFIG_URL)
FN_GLOBAL_STRING(lp_wins_url, &Globals.szWINS_URL)
FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
FN_GLOBAL_BOOL(lp_winbind_sealed_pipes, &Globals.bWinbindSealedPipes)
diff --git a/source4/script/tests/selftest.sh b/source4/script/tests/selftest.sh
index adf5d082f8..8a8bb89b50 100755
--- a/source4/script/tests/selftest.sh
+++ b/source4/script/tests/selftest.sh
@@ -55,7 +55,6 @@ PRIVATEDIR=$PREFIX_ABS/private
NCALRPCDIR=$PREFIX_ABS/ncalrpc
LOCKDIR=$PREFIX_ABS/lockdir
TLSDIR=$PRIVATEDIR/tls
-WINS_LDB=$PRIVATEDIR/wins.ldb
CONFIGURATION="--configfile=$CONFFILE"
export CONFIGURATION
export CONFFILE
@@ -85,7 +84,7 @@ export PATH
rm -rf $PREFIX/*
mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $TLSDIR
-cat >$LOCKDIR/wins.ldif<<EOF
+cat >$PRIVATEDIR/wins_config.ldif<<EOF
dn: name=TORTURE_26,CN=PARTNERS
objectClass: wreplPartner
name: TORTURE_26
@@ -156,7 +155,7 @@ echo -n "PROVISIONING..."
--quiet --domain $DOMAIN --realm $REALM \
--adminpass $PASSWORD --root=$ROOT || exit 1
-./bin/ldbadd -H $LOCKDIR/wins.ldb < $LOCKDIR/wins.ldif >/dev/null || exit 1
+./bin/ldbadd -H $PRIVATEDIR/wins_config.ldb < $PRIVATEDIR/wins_config.ldif >/dev/null || exit 1
echo "DONE"
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
*/