]> git.samba.org - gd/samba-autobuild/.git/commitdiff
s4-dns: dlz_bind9: Fix ipv6 updates
authorArvid Requate <requate@univention.de>
Sat, 17 May 2014 16:25:01 +0000 (18:25 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 26 May 2014 01:31:28 +0000 (03:31 +0200)
b9_record_match needs to consider all allowed representations of IPv6
addresses (RFC 2373), otherwise DNS subtractrdataset operations fail
due to differences in zero padding between bind9 frontend and ndr_pull
of a dnsp_DnssrvRpcRecord structure.

Change-Id: Ic0a1b16008458993dc644646d7f4ae3d3a3c5fed
Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
Reviewed-by: Guenter Kukkukk <kukks@samba.org>
source4/dns_server/dlz_bind9.c

index 677578a97e901fb24607271ded2b8c0c04975299..fbb07f3bdf36b3479dfdbd8583070b6918300d6e 100644 (file)
@@ -1440,6 +1440,8 @@ static bool b9_record_match(struct dlz_bind9_data *state,
 {
        bool status;
        int i;
+       struct in6_addr rec1_in_addr6;
+       struct in6_addr rec2_in_addr6;
 
        if (rec1->wType != rec2->wType) {
                return false;
@@ -1454,7 +1456,9 @@ static bool b9_record_match(struct dlz_bind9_data *state,
        case DNS_TYPE_A:
                return strcmp(rec1->data.ipv4, rec2->data.ipv4) == 0;
        case DNS_TYPE_AAAA:
-               return strcmp(rec1->data.ipv6, rec2->data.ipv6) == 0;
+               inet_pton(AF_INET6, rec1->data.ipv6, &rec1_in_addr6);
+               inet_pton(AF_INET6, rec2->data.ipv6, &rec2_in_addr6);
+               return memcmp(&rec1_in_addr6, &rec2_in_addr6, sizeof(rec1_in_addr6)) == 0;
        case DNS_TYPE_CNAME:
                return dns_name_equal(rec1->data.cname, rec2->data.cname);
        case DNS_TYPE_TXT: