summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-02-09 10:17:02 +1100
committerAmitay Isaacs <amitay@gmail.com>2012-02-21 18:24:30 +1100
commit169db333033b72b6f9ac1e7b23f0f2c151218c1f (patch)
treede081df6132180d0b9e339b83d0fc8f1d36b57a9
parent89586ed1643101b3b94bba1fdcdc821026a00e65 (diff)
downloadsamba-169db333033b72b6f9ac1e7b23f0f2c151218c1f.tar.gz
samba-169db333033b72b6f9ac1e7b23f0f2c151218c1f.tar.bz2
samba-169db333033b72b6f9ac1e7b23f0f2c151218c1f.zip
dlz_bind9: Do not remove LDB record in subrdataset and delrdataset
This fixes the problem of large number of deleted records in DNS partitions due to frequent dynamic dns updates from windows clients. The typical pattern for dynamic update get converted into subrdataset() followed by addrdataset(). If there are no dnsRecord attributes left as a result of sub/delrdataset(), leave the LDB entry for dns name as is. The subsequent addrdataset() would add the dnsRecord attribute without re-creating the same entry.
-rw-r--r--source4/dns_server/dlz_bind9.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/source4/dns_server/dlz_bind9.c b/source4/dns_server/dlz_bind9.c
index 6f6b1da32e..7bb7a3467c 100644
--- a/source4/dns_server/dlz_bind9.c
+++ b/source4/dns_server/dlz_bind9.c
@@ -1614,14 +1614,11 @@ _PUBLIC_ isc_result_t dlz_subrdataset(const char *name, const char *rdatastr, vo
}
if (el->num_values == 0) {
- /* delete the record */
- ret = ldb_delete(state->samdb, dn);
- b9_reset_session_info(state);
- } else {
- /* modify the record */
- el->flags = LDB_FLAG_MOD_REPLACE;
- ret = ldb_modify(state->samdb, res->msgs[0]);
+ ldb_msg_remove_element(res->msgs[0], el);
}
+ el->flags = LDB_FLAG_MOD_REPLACE;
+ ret = ldb_modify(state->samdb, res->msgs[0]);
+
b9_reset_session_info(state);
if (ret != LDB_SUCCESS) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to modify %s - %s",
@@ -1722,13 +1719,11 @@ _PUBLIC_ isc_result_t dlz_delrdataset(const char *name, const char *type, void *
}
if (el->num_values == 0) {
- /* delete the record */
- ret = ldb_delete(state->samdb, dn);
- } else {
- /* modify the record */
- el->flags = LDB_FLAG_MOD_REPLACE;
- ret = ldb_modify(state->samdb, res->msgs[0]);
+ ldb_msg_remove_element(res->msgs[0], el);
}
+ el->flags = LDB_FLAG_MOD_REPLACE;
+ ret = ldb_modify(state->samdb, res->msgs[0]);
+
b9_reset_session_info(state);
if (ret != LDB_SUCCESS) {
state->log(ISC_LOG_ERROR, "samba_dlz: failed to delete type %s in %s - %s",