summaryrefslogtreecommitdiff
path: root/source4/dns_server/dns_update.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-07-31 08:19:50 +0200
committerStefan Metzmacher <metze@samba.org>2014-08-26 09:13:06 +0200
commitd0f424a23dc915d9fce625438d2bd63519757cba (patch)
tree7cddf3ffffabc6f6829a86b46ffdfeba6d1fb531 /source4/dns_server/dns_update.c
parentdeb21a9afe77591743fda522355a5a9eb08fb27b (diff)
downloadsamba-d0f424a23dc915d9fce625438d2bd63519757cba.tar.gz
s4:dns_server: map LDB_ERR_NO_SUCH_OBJECT to WERR_DNS_ERROR_NAME_DOES_NOT_EXIST
This is the correct fix for commit 8b24c43b382740106474e26dec59e1419ba77306 and Bug: https://bugzilla.samba.org/show_bug.cgi?id=9559 With this change we have a consistent behavior between internal server and the bind dlz module. We keep a dangling LDAP object without dnsRecord attribute arround forever. This will be fixed in the following commits. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10749 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dns_server/dns_update.c')
-rw-r--r--source4/dns_server/dns_update.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source4/dns_server/dns_update.c b/source4/dns_server/dns_update.c
index 9edc40bc341..c439d8d27ba 100644
--- a/source4/dns_server/dns_update.c
+++ b/source4/dns_server/dns_update.c
@@ -82,6 +82,9 @@ static WERROR check_one_prerequisite(struct dns_server *dns,
/*
*/
werror = dns_lookup_records(dns, mem_ctx, dn, &ans, &acount);
+ if (W_ERROR_EQUAL(werror, WERR_DNS_ERROR_NAME_DOES_NOT_EXIST)) {
+ return DNS_ERR(NAME_ERROR);
+ }
W_ERROR_NOT_OK_RETURN(werror);
if (acount == 0) {
@@ -91,6 +94,9 @@ static WERROR check_one_prerequisite(struct dns_server *dns,
/*
*/
werror = dns_lookup_records(dns, mem_ctx, dn, &ans, &acount);
+ if (W_ERROR_EQUAL(werror, WERR_DNS_ERROR_NAME_DOES_NOT_EXIST)) {
+ return DNS_ERR(NXRRSET);
+ }
if (W_ERROR_EQUAL(werror, DNS_ERR(NAME_ERROR))) {
return DNS_ERR(NXRRSET);
}
@@ -131,10 +137,11 @@ static WERROR check_one_prerequisite(struct dns_server *dns,
/*
*/
werror = dns_lookup_records(dns, mem_ctx, dn, &ans, &acount);
+ if (W_ERROR_EQUAL(werror, WERR_DNS_ERROR_NAME_DOES_NOT_EXIST)) {
+ werror = WERR_OK;
+ }
if (W_ERROR_EQUAL(werror, DNS_ERR(NAME_ERROR))) {
werror = WERR_OK;
- ans = NULL;
- acount = 0;
}
for (i = 0; i < acount; i++) {
@@ -163,6 +170,9 @@ static WERROR check_one_prerequisite(struct dns_server *dns,
*final_result = false;
werror = dns_lookup_records(dns, mem_ctx, dn, &ans, &acount);
+ if (W_ERROR_EQUAL(werror, WERR_DNS_ERROR_NAME_DOES_NOT_EXIST)) {
+ return DNS_ERR(NXRRSET);
+ }
if (W_ERROR_EQUAL(werror, DNS_ERR(NAME_ERROR))) {
return DNS_ERR(NXRRSET);
}
@@ -421,12 +431,13 @@ static WERROR handle_one_update(struct dns_server *dns,
W_ERROR_NOT_OK_RETURN(werror);
werror = dns_lookup_records(dns, mem_ctx, dn, &recs, &rcount);
- if (W_ERROR_EQUAL(werror, DNS_ERR(NAME_ERROR))) {
- recs = NULL;
- rcount = 0;
+ if (W_ERROR_EQUAL(werror, WERR_DNS_ERROR_NAME_DOES_NOT_EXIST)) {
needs_add = true;
werror = WERR_OK;
}
+ if (W_ERROR_EQUAL(werror, DNS_ERR(NAME_ERROR))) {
+ werror = WERR_OK;
+ }
W_ERROR_NOT_OK_RETURN(werror);
if (update->rr_class == zone->question_class) {