summaryrefslogtreecommitdiff
path: root/source4/wrepl_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-12-30 21:12:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:05 -0500
commit905c3ff8e1e63f2151f63552e556086968424118 (patch)
treee779dacb6c33f939ccb67effc8cabbfca2ebbbc8 /source4/wrepl_server
parent0391b1cb3a1527aed5beefbdda67a6ce5062bbab (diff)
downloadsamba-905c3ff8e1e63f2151f63552e556086968424118.tar.gz
samba-905c3ff8e1e63f2151f63552e556086968424118.tar.bz2
samba-905c3ff8e1e63f2151f63552e556086968424118.zip
r12618: use our primary interface address or the "winsdb:local_owner" -address
as winsOwner: attrbute for owned records metze (This used to be commit 37dece8304c0b9887740f4d4e8096732045a1785)
Diffstat (limited to 'source4/wrepl_server')
-rw-r--r--source4/wrepl_server/wrepl_apply_records.c4
-rw-r--r--source4/wrepl_server/wrepl_in_call.c15
-rw-r--r--source4/wrepl_server/wrepl_scavenging.c12
-rw-r--r--source4/wrepl_server/wrepl_server.c3
4 files changed, 15 insertions, 19 deletions
diff --git a/source4/wrepl_server/wrepl_apply_records.c b/source4/wrepl_server/wrepl_apply_records.c
index 7fb73728e5..6035041f11 100644
--- a/source4/wrepl_server/wrepl_apply_records.c
+++ b/source4/wrepl_server/wrepl_apply_records.c
@@ -1187,7 +1187,7 @@ static NTSTATUS r_do_sgroup_merge(struct wreplsrv_partner *partner,
}
/* if we're the owner of the old record, we'll be the owner of the new one too */
- if (strcmp(rec->wins_owner, WINSDB_OWNER_LOCAL)==0) {
+ if (strcmp(rec->wins_owner, partner->service->wins_db->local_owner)==0) {
become_owner = True;
}
@@ -1239,7 +1239,7 @@ static NTSTATUS wreplsrv_apply_one_record(struct wreplsrv_partner *partner,
}
NT_STATUS_NOT_OK_RETURN(status);
- if (strcmp(rec->wins_owner, WINSDB_OWNER_LOCAL)==0) {
+ if (strcmp(rec->wins_owner, partner->service->wins_db->local_owner)==0) {
local_vs_replica = True;
} else if (strcmp(rec->wins_owner, owner->address)==0) {
same_owner = True;
diff --git a/source4/wrepl_server/wrepl_in_call.c b/source4/wrepl_server/wrepl_in_call.c
index a2637d1b39..9bd01c14bb 100644
--- a/source4/wrepl_server/wrepl_in_call.c
+++ b/source4/wrepl_server/wrepl_in_call.c
@@ -138,7 +138,7 @@ static NTSTATUS wreplsrv_record2wins_name(TALLOC_CTX *mem_ctx,
talloc_steal(mem_ctx, rec->name);
name->id = rec->version;
- name->unknown = WINSDB_GROUP_ADDRESS;
+ name->unknown = "255.255.255.255";
name->flags = WREPL_NAME_FLAGS(rec->type, rec->state, rec->node, rec->is_static);
@@ -153,13 +153,8 @@ static NTSTATUS wreplsrv_record2wins_name(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(ips);
for (i = 0; i < num_ips; i++) {
- if (strcasecmp(WINSDB_OWNER_LOCAL, rec->addresses[i]->wins_owner) == 0) {
- ips[i].owner = talloc_strdup(ips, our_address);
- NT_STATUS_HAVE_NO_MEMORY(ips[i].owner);
- } else {
- ips[i].owner = rec->addresses[i]->wins_owner;
- talloc_steal(ips, rec->addresses[i]->wins_owner);
- }
+ ips[i].owner = rec->addresses[i]->wins_owner;
+ talloc_steal(ips, rec->addresses[i]->wins_owner);
ips[i].ip = rec->addresses[i]->address;
talloc_steal(ips, rec->addresses[i]->address);
}
@@ -190,7 +185,7 @@ static NTSTATUS wreplsrv_in_send_request(struct wreplsrv_in_call *call)
if (strcmp(call->wreplconn->our_ip, owner_in->address) == 0) {
ZERO_STRUCT(local_owner);
- local_owner.owner.address = WINSDB_OWNER_LOCAL;
+ local_owner.owner.address = service->wins_db->local_owner;
local_owner.owner.min_version = 0;
local_owner.owner.max_version = wreplsrv_local_max_version(service);
local_owner.owner.type = 1;
@@ -260,7 +255,7 @@ static NTSTATUS wreplsrv_in_send_request(struct wreplsrv_in_call *call)
NT_STATUS_HAVE_NO_MEMORY(names);
for (i = 0; i < res->count; i++) {
- status = winsdb_record(res->msgs[i], call, &rec);
+ status = winsdb_record(service->wins_db, res->msgs[i], call, &rec);
NT_STATUS_NOT_OK_RETURN(status);
status = wreplsrv_record2wins_name(names, call->wreplconn->our_ip, &names[i], rec);
diff --git a/source4/wrepl_server/wrepl_scavenging.c b/source4/wrepl_server/wrepl_scavenging.c
index bc25354e3c..24ef974f2d 100644
--- a/source4/wrepl_server/wrepl_scavenging.c
+++ b/source4/wrepl_server/wrepl_scavenging.c
@@ -51,7 +51,7 @@ static NTSTATUS wreplsrv_scavenging_owned_records(struct wreplsrv_service *servi
filter = talloc_asprintf(tmp_mem,
"(&(winsOwner=%s)(objectClass=winsRecord)"
"(expireTime<=%s)(!(isStatic=1)))",
- WINSDB_OWNER_LOCAL, now_timestr);
+ service->wins_db->local_owner, now_timestr);
NT_STATUS_HAVE_NO_MEMORY(filter);
ret = ldb_search(service->wins_db->ldb, NULL, LDB_SCOPE_SUBTREE, filter, NULL, &res);
if (ret != LDB_SUCCESS) return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -63,7 +63,7 @@ static NTSTATUS wreplsrv_scavenging_owned_records(struct wreplsrv_service *servi
delete_tombstones = timeval_expired(&tombstone_extra_time);
for (i=0; i < res->count; i++) {
- status = winsdb_record(res->msgs[i], tmp_mem, &rec);
+ status = winsdb_record(service->wins_db, res->msgs[i], tmp_mem, &rec);
NT_STATUS_NOT_OK_RETURN(status);
if (rec->is_static) {
@@ -159,7 +159,7 @@ static NTSTATUS wreplsrv_scavenging_replica_non_active_records(struct wreplsrv_s
filter = talloc_asprintf(tmp_mem,
"(&(!(winsOwner=%s))(objectClass=winsRecord)"
"(!(recordState=%u))(expireTime<=%s)(!(isStatic=1)))",
- WINSDB_OWNER_LOCAL, WREPL_STATE_ACTIVE, now_timestr);
+ service->wins_db->local_owner, WREPL_STATE_ACTIVE, now_timestr);
NT_STATUS_HAVE_NO_MEMORY(filter);
ret = ldb_search(service->wins_db->ldb, NULL, LDB_SCOPE_SUBTREE, filter, NULL, &res);
if (ret != LDB_SUCCESS) return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -171,7 +171,7 @@ static NTSTATUS wreplsrv_scavenging_replica_non_active_records(struct wreplsrv_s
delete_tombstones = timeval_expired(&tombstone_extra_time);
for (i=0; i < res->count; i++) {
- status = winsdb_record(res->msgs[i], tmp_mem, &rec);
+ status = winsdb_record(service->wins_db, res->msgs[i], tmp_mem, &rec);
NT_STATUS_NOT_OK_RETURN(status);
if (rec->is_static) {
@@ -262,14 +262,14 @@ static NTSTATUS wreplsrv_scavenging_replica_active_records(struct wreplsrv_servi
filter = talloc_asprintf(tmp_mem,
"(&(!(winsOwner=%s))(objectClass=winsRecord)"
"(recordState=%u)(expireTime<=%s)(!(isStatic=1)))",
- WINSDB_OWNER_LOCAL, WREPL_STATE_ACTIVE, now_timestr);
+ service->wins_db->local_owner, WREPL_STATE_ACTIVE, now_timestr);
NT_STATUS_HAVE_NO_MEMORY(filter);
ret = ldb_search(service->wins_db->ldb, NULL, LDB_SCOPE_SUBTREE, filter, NULL, &res);
if (ret != LDB_SUCCESS) return NT_STATUS_INTERNAL_DB_CORRUPTION;
talloc_steal(tmp_mem, res);
for (i=0; i < res->count; i++) {
- status = winsdb_record(res->msgs[i], tmp_mem, &rec);
+ status = winsdb_record(service->wins_db, res->msgs[i], tmp_mem, &rec);
NT_STATUS_NOT_OK_RETURN(status);
if (rec->is_static) {
diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c
index 2682ca6721..9f1664bc22 100644
--- a/source4/wrepl_server/wrepl_server.c
+++ b/source4/wrepl_server/wrepl_server.c
@@ -264,7 +264,8 @@ NTSTATUS wreplsrv_add_table(struct wreplsrv_service *service,
struct wreplsrv_owner *table = *_table;
struct wreplsrv_owner *cur;
- if (strcmp(WINSDB_OWNER_LOCAL, wins_owner) == 0) {
+ if (strcmp(service->wins_db->local_owner, wins_owner) == 0 ||
+ strcmp("0.0.0.0", wins_owner) == 0) {
return NT_STATUS_OK;
}