mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
s4/rpc/dns: check for IP address errors at startup
The silent failure might leave an indeterminate or zero address. CID: 1272838 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
parent
51e4a1e454
commit
01e2bdaf30
@ -71,17 +71,23 @@ static struct DNS_ADDR_ARRAY *fill_dns_addr_array(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
for (i = 0; i < num_interfaces; i++) {
|
||||
int ret;
|
||||
ipstr = iface_list_n_ip(ifaces, i);
|
||||
if (is_ipaddress_v4(ipstr)) {
|
||||
have_ipv4 = true;
|
||||
dns_addr_array->AddrArray[i].MaxSa[0] = 0x02;
|
||||
inet_pton(AF_INET, ipstr,
|
||||
&dns_addr_array->AddrArray[i].MaxSa[4]);
|
||||
ret = inet_pton(AF_INET, ipstr,
|
||||
&dns_addr_array->AddrArray[i].MaxSa[4]);
|
||||
} else {
|
||||
have_ipv6 = true;
|
||||
dns_addr_array->AddrArray[i].MaxSa[0] = 0x17;
|
||||
inet_pton(AF_INET6, ipstr,
|
||||
&dns_addr_array->AddrArray[i].MaxSa[8]);
|
||||
ret = inet_pton(AF_INET6, ipstr,
|
||||
&dns_addr_array->AddrArray[i].MaxSa[8]);
|
||||
}
|
||||
if (ret != 1) { /*yep, 1 means success for inet_pton */
|
||||
DBG_ERR("Interface %d address (%s) is invalid\n",
|
||||
i, ipstr);
|
||||
goto nomem;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user