summaryrefslogtreecommitdiff
path: root/source4/dsdb/dns
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-04-28 08:29:40 +0200
committerStefan Metzmacher <metze@samba.org>2014-08-26 09:13:06 +0200
commit25ec8e8656f66fe51a0d48718cdcfd8b209f6ca0 (patch)
treeb1e88a2cdcc7031f48e0b2e251c2cf1b629eab5c /source4/dsdb/dns
parent6e853708def98545eeb6913b8a2dd59d439323e6 (diff)
downloadsamba-25ec8e8656f66fe51a0d48718cdcfd8b209f6ca0.tar.gz
s4:samba_dnsupdate: cache the already registered records
This way we can delete records which are not used anymore. E.g. if the ip address changed. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9831 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/dns')
-rw-r--r--source4/dsdb/dns/dns_update.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c
index 3e10447f0fc..aa617c6aeca 100644
--- a/source4/dsdb/dns/dns_update.c
+++ b/source4/dsdb/dns/dns_update.c
@@ -397,6 +397,7 @@ struct dnsupdate_RODC_state {
struct irpc_message *msg;
struct dnsupdate_RODC *r;
char *tmp_path;
+ char *tmp_path2;
int fd;
};
@@ -406,6 +407,9 @@ static int dnsupdate_RODC_destructor(struct dnsupdate_RODC_state *st)
close(st->fd);
}
unlink(st->tmp_path);
+ if (st->tmp_path2 != NULL) {
+ unlink(st->tmp_path2);
+ }
return 0;
}
@@ -483,6 +487,13 @@ static NTSTATUS dnsupdate_dnsupdate_RODC(struct irpc_message *msg,
talloc_set_destructor(st, dnsupdate_RODC_destructor);
+ st->tmp_path2 = talloc_asprintf(st, "%s.cache", st->tmp_path);
+ if (!st->tmp_path2) {
+ talloc_free(st);
+ r->out.result = NT_STATUS_NO_MEMORY;
+ return NT_STATUS_OK;
+ }
+
sid_dn = ldb_dn_new_fmt(st, s->samdb, "<SID=%s>", dom_sid_string(st, r->in.dom_sid));
if (!sid_dn) {
talloc_free(st);
@@ -575,6 +586,8 @@ static NTSTATUS dnsupdate_dnsupdate_RODC(struct irpc_message *msg,
dns_update_command,
"--update-list",
st->tmp_path,
+ "--update-cache",
+ st->tmp_path2,
NULL);
NT_STATUS_HAVE_NO_MEMORY(req);