1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

r12674: make use of the winsdb functions

metze
(This used to be commit 9a7da608e2)
This commit is contained in:
Stefan Metzmacher 2006-01-02 16:14:08 +00:00 committed by Gerald (Jerry) Carter
parent 6d16a217d3
commit 40b9d4f62d
2 changed files with 3 additions and 53 deletions
source4/wrepl_server

View File

@ -25,6 +25,7 @@
#include "wrepl_server/wrepl_server.h"
#include "libcli/composite/composite.h"
#include "wrepl_server/wrepl_out_helpers.h"
#include "nbt_server/wins/winsdb.h"
static void wreplsrv_out_partner_push(struct wreplsrv_partner *partner, BOOL propagate);
@ -123,7 +124,7 @@ NTSTATUS wreplsrv_out_push_run(struct wreplsrv_service *service)
uint64_t seqnumber;
uint32_t change_count;
seqnumber = wreplsrv_local_db_seqnumber(service);
seqnumber = winsdb_get_seqnumber(service->wins_db);
for (partner = service->partners; partner; partner = partner->next) {
/* if it's not a push partner, go to the next partner */

View File

@ -171,58 +171,7 @@ BOOL wreplsrv_is_our_address(struct wreplsrv_service *service, const char *addre
uint64_t wreplsrv_local_max_version(struct wreplsrv_service *service)
{
int ret;
struct ldb_context *ldb = service->wins_db->ldb;
struct ldb_dn *dn;
struct ldb_result *res = NULL;
TALLOC_CTX *tmp_ctx = talloc_new(service);
uint64_t maxVersion = 0;
dn = ldb_dn_explode(tmp_ctx, "CN=VERSION");
if (!dn) goto failed;
/* find the record in the WINS database */
ret = ldb_search(ldb, dn, LDB_SCOPE_BASE,
NULL, NULL, &res);
if (ret != LDB_SUCCESS) goto failed;
talloc_steal(tmp_ctx, res);
if (res->count > 1) goto failed;
if (res->count == 1) {
maxVersion = ldb_msg_find_uint64(res->msgs[0], "maxVersion", 0);
}
failed:
talloc_free(tmp_ctx);
return maxVersion;
}
uint64_t wreplsrv_local_db_seqnumber(struct wreplsrv_service *service)
{
int ret;
struct ldb_context *ldb = service->wins_db->ldb;
struct ldb_dn *dn;
struct ldb_result *res = NULL;
TALLOC_CTX *tmp_ctx = talloc_new(service);
uint64_t seqnumber = 0;
dn = ldb_dn_explode(tmp_ctx, "@BASEINFO");
if (!dn) goto failed;
/* find the record in the WINS database */
ret = ldb_search(ldb, dn, LDB_SCOPE_BASE,
NULL, NULL, &res);
if (ret != LDB_SUCCESS) goto failed;
talloc_steal(tmp_ctx, res);
if (res->count > 1) goto failed;
if (res->count == 1) {
seqnumber = ldb_msg_find_uint64(res->msgs[0], "sequenceNumber", 0);
}
failed:
talloc_free(tmp_ctx);
return seqnumber;
return winsdb_get_maxVersion(service->wins_db);
}
NTSTATUS wreplsrv_fill_wrepl_table(struct wreplsrv_service *service,