From b1fdf4065e4569e58ffceb44e9f4105fa1f8740e Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 16 Dec 2011 14:25:57 +0100 Subject: s4 dns: Allow updates based on smb.conf setting Autobuild-User: Kai Blin Autobuild-Date: Sat Dec 17 04:19:40 CET 2011 on sn-devel-104 --- source4/dns_server/dns_update.c | 6 ++++-- source4/dns_server/dns_update.h | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 source4/dns_server/dns_update.h (limited to 'source4') diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c index ccbeed9ff8..3fd612cfab 100644 --- a/source4/dns_server/dns_update.c +++ b/source4/dns_server/dns_update.c @@ -25,9 +25,12 @@ #include "librpc/gen_ndr/ndr_dns.h" #include "librpc/gen_ndr/ndr_dnsp.h" #include +#include "param/param.h" #include "dsdb/samdb/samdb.h" #include "dsdb/common/util.h" +#include "smbd/service_task.h" #include "dns_server/dns_server.h" +#include "dns_server/dns_update.h" static WERROR dns_rr_to_dnsp(TALLOC_CTX *mem_ctx, const struct dns_res_rec *rrec, @@ -653,7 +656,6 @@ WERROR dns_server_process_update(struct dns_server *dns, const struct dns_server_zone *z; size_t host_part_len = 0; WERROR werror = DNS_ERR(NOT_IMPLEMENTED); - bool update_allowed = false; if (in->qdcount != 1) { return DNS_ERR(FORMAT_ERROR); @@ -701,7 +703,7 @@ WERROR dns_server_process_update(struct dns_server *dns, /* TODO: Check if update is allowed, we probably want "always", * key-based GSSAPI, key-based bind-style TSIG and "never" as * smb.conf options. */ - if (!update_allowed) { + if (lpcfg_allow_dns_updates(dns->task->lp_ctx) != DNS_UPDATE_ON) { DEBUG(0, ("Update not allowed.")); return DNS_ERR(REFUSED); } diff --git a/source4/dns_server/dns_update.h b/source4/dns_server/dns_update.h new file mode 100644 index 0000000000..71ff85eda1 --- /dev/null +++ b/source4/dns_server/dns_update.h @@ -0,0 +1,25 @@ +/* + Unix SMB/CIFS implementation. + + DNS update settings + + Copyright (C) 2011 Kai Blin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +enum dns_update_settings { + DNS_UPDATE_OFF=0, + DNS_UPDATE_ON=1, + DNS_UPDATE_SIGNED=2 +}; -- cgit