summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2012-03-28 12:19:51 +0200
committerKai Blin <kai@samba.org>2012-05-08 15:48:25 +0200
commitf01c6cf707087141fe244a1d90c5cdcb69322820 (patch)
tree3ac1a534f1d0552c62efc3c283c73fc668ea22cc /source4
parent74206984daa9c707a38675df88d6bbe660d876bc (diff)
downloadsamba-f01c6cf707087141fe244a1d90c5cdcb69322820.tar.gz
samba-f01c6cf707087141fe244a1d90c5cdcb69322820.tar.bz2
samba-f01c6cf707087141fe244a1d90c5cdcb69322820.zip
s4 dns: unify error handling when bailing out
Autobuild-User: Kai Blin <kai@samba.org> Autobuild-Date: Tue May 8 15:48:25 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/dns_server/dns_server.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index eed20d5707..f9db095e74 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -100,6 +100,7 @@ static NTSTATUS dns_process(struct dns_server *dns,
{
enum ndr_err_code ndr_err;
WERROR ret;
+ uint16_t dns_err = DNS_RCODE_OK;
struct dns_request_state *state;
struct dns_name_packet *in_packet;
struct dns_name_packet *out_packet;
@@ -126,12 +127,8 @@ static NTSTATUS dns_process(struct dns_server *dns,
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
TALLOC_FREE(in_packet);
DEBUG(0, ("Failed to parse packet %d!\n", ndr_err));
- *out = *in;
-
- out->data[2] |= 0x80; /* Toggle DNS_FLAG_REPLY */
- out->data[3] |= DNS_RCODE_FORMERR;
-
- return NT_STATUS_OK;
+ dns_err = DNS_RCODE_FORMERR;
+ goto drop;
}
if (DEBUGLVL(8)) {
NDR_PRINT_DEBUG(dns_name_packet, in_packet);
@@ -189,16 +186,18 @@ static NTSTATUS dns_process(struct dns_server *dns,
TALLOC_FREE(in_packet);
TALLOC_FREE(out_packet);
DEBUG(0, ("Failed to push packet %d!\n", ndr_err));
- *out = *in;
-
- out->data[2] |= 0x80; /* Toggle DNS_FLAG_REPLY */
- out->data[3] |= DNS_RCODE_SERVFAIL;
-
- return NT_STATUS_OK;
+ dns_err = DNS_RCODE_SERVFAIL;
+ goto drop;
}
dump_data(8, out->data, out->length);
return NT_STATUS_OK;
+
+drop:
+ *out = *in;
+ out->data[2] |= 0x80; /* Toggle DNS_FLAG_REPLY */
+ out->data[3] |= dns_err;
+ return NT_STATUS_OK;
}
struct dns_tcp_call {