summaryrefslogtreecommitdiff
path: root/source4/rpc_server/dnsserver
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-12-06 16:06:35 +1100
committerAndrew Bartlett <abartlet@samba.org>2013-05-30 10:44:03 +1000
commitde2788acd1ee2136b673c5d1ddf5bab335b4675f (patch)
tree1f7b102676e58136c21f5ddcfdbef17813c1aede /source4/rpc_server/dnsserver
parentcc103a8187317047347a679e42b076de7d69d181 (diff)
downloadsamba-de2788acd1ee2136b673c5d1ddf5bab335b4675f.tar.gz
samba-de2788acd1ee2136b673c5d1ddf5bab335b4675f.tar.bz2
samba-de2788acd1ee2136b673c5d1ddf5bab335b4675f.zip
s4-rpc: dnsserver: When updating SOA record, use the specified serial
This makes sure that when updating SOA record, the serial is set to the value sent by client. For all other records, serial is incremented. Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'source4/rpc_server/dnsserver')
-rw-r--r--source4/rpc_server/dnsserver/dnsdb.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/rpc_server/dnsserver/dnsdb.c b/source4/rpc_server/dnsserver/dnsdb.c
index b5ad4702e7..91e9aa8326 100644
--- a/source4/rpc_server/dnsserver/dnsdb.c
+++ b/source4/rpc_server/dnsserver/dnsdb.c
@@ -505,11 +505,6 @@ WERROR dnsserver_db_update_record(TALLOC_CTX *mem_ctx,
int ret, i;
int serial;
- serial = dnsserver_update_soa(mem_ctx, samdb, z);
- if (serial < 0) {
- return WERR_INTERNAL_DB_ERROR;
- }
-
arec = dns_to_dnsp_copy(mem_ctx, add_record);
W_ERROR_HAVE_NO_MEMORY(arec);
@@ -519,7 +514,6 @@ WERROR dnsserver_db_update_record(TALLOC_CTX *mem_ctx,
unix_to_nt_time(&t, time(NULL));
t /= 10*1000*1000;
- arec->dwSerial = serial;
arec->dwTimeStamp = t;
ret = ldb_search(samdb, mem_ctx, &res, z->zone_dn, LDB_SCOPE_ONELEVEL, attrs,
@@ -572,6 +566,15 @@ WERROR dnsserver_db_update_record(TALLOC_CTX *mem_ctx,
return WERR_DNS_ERROR_RECORD_DOES_NOT_EXIST;
}
+ /* If updating SOA record, use specified serial, otherwise increment */
+ if (arec->wType != DNS_TYPE_SOA) {
+ serial = dnsserver_update_soa(mem_ctx, samdb, z);
+ if (serial < 0) {
+ return WERR_INTERNAL_DB_ERROR;
+ }
+ arec->dwSerial = serial;
+ }
+
ndr_err = ndr_push_struct_blob(&el->values[i], mem_ctx, arec,
(ndr_push_flags_fn_t)ndr_push_dnsp_DnssrvRpcRecord);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {