dns: Simplify logic a bit
authorVolker Lendecke <vl@samba.org>
Thu, 31 May 2018 18:57:36 +0000 (20:57 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 1 Jun 2018 09:28:22 +0000 (11:28 +0200)
We don't need a separate boolean variable

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/dns_server/dns_crypto.c

index c8b5c46ad30165e5fc696c2bc197187e915e10a0..740e1e4dd533747366ff494e15b179c9065790d5 100644 (file)
@@ -100,7 +100,6 @@ WERROR dns_verify_tsig(struct dns_server *dns,
        WERROR werror;
        NTSTATUS status;
        enum ndr_err_code ndr_err;
-       bool found_tsig = false;
        uint16_t i, arcount = 0;
        DATA_BLOB tsig_blob, fake_tsig_blob, sig;
        uint8_t *buffer = NULL;
@@ -113,12 +112,12 @@ WERROR dns_verify_tsig(struct dns_server *dns,
        /* Find the first TSIG record in the additional records */
        for (i=0; i < packet->arcount; i++) {
                if (packet->additional[i].rr_type == DNS_QTYPE_TSIG) {
-                       found_tsig = true;
                        break;
                }
        }
 
-       if (!found_tsig) {
+       if (i == packet->arcount) {
+               /* no TSIG around */
                return WERR_OK;
        }