[Bug 1472] CID 116 CID 117 minor warnings in new DNS code.
bk: 4b665b2fBsbs_TvJiquvPh7sFf514w
+* [Bug 1471] CID 120 CID 121 CID 122 is_ip_address() uninit family.
+* [Bug 1472] CID 116 CID 117 minor warnings in new DNS code.
(4.2.7p13) 2010/01/31 Released by Harlan Stenn <stenn@ntp.org>
* Include (4.2.6p1) - [Bug 1467] Fix bogus rebuild of sntp/sntp.html.
(4.2.7p12) 2010/01/30 Released by Harlan Stenn <stenn@ntp.org>
SOCKET move_fd(SOCKET fd);
isc_boolean_t get_broadcastclient_flag(void);
-isc_boolean_t is_ip_address(const char *, isc_netaddr_t *);
+isc_boolean_t is_ip_address(const char *, u_short, isc_netaddr_t *);
extern void sau_from_netaddr(sockaddr_u *, const isc_netaddr_t *);
extern void add_nic_rule(nic_rule_match match_type,
const char *if_name, int prefixlen,
pchSlash = strchr(if_name, '/');
if (pchSlash != NULL)
*pchSlash = '\0';
- if (is_ip_address(if_name, &netaddr)) {
+ if (is_ip_address(if_name, AF_UNSPEC,
+ &netaddr)) {
match_type = MATCH_IFADDR;
if (pchSlash != NULL) {
sscanf(pchSlash + 1, "%d",
* getaddrinfo in the mainline with it. Otherwise
* hand it off to the blocking child.
*/
- memset(&i_netaddr, 0, sizeof(i_netaddr));
- i_netaddr.family = (u_short)curr_peer->addr->type;
-
if (1 == num_needed
&& is_ip_address(curr_peer->addr->address,
+ (u_short)curr_peer->addr->type,
&i_netaddr)) {
AF(&peeraddr) = (u_short)i_netaddr.family;
* getaddrinfo in the mainline with it. Otherwise
* hand it off to the blocking child.
*/
- memset(&i_netaddr, 0, sizeof(i_netaddr));
- i_netaddr.family = (u_short)curr_unpeer->addr->type;
-
- if (is_ip_address(curr_unpeer->addr->address, &i_netaddr)) {
+ if (is_ip_address(curr_unpeer->addr->address,
+ (u_short)curr_unpeer->addr->type,
+ &i_netaddr)) {
AF(&peeraddr) = (u_short)i_netaddr.family;
if (AF_INET6 == i_netaddr.family)
}
lookup = nameornum;
- if (is_ip_address(nameornum, &ipaddr)) {
+ if (is_ip_address(nameornum, AF_UNSPEC, &ipaddr)) {
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = ipaddr.family;
if ('[' == nameornum[0]) {
next_dns_timeslot = max(now, next_dns_timeslot);
gai_req->scheduled = now;
gai_req->earliest = next_dns_timeslot;
- gai_req->hints = *hints;
+ if (NULL == hints)
+ memset(&gai_req->hints, 0, sizeof(gai_req->hints));
+ else
+ gai_req->hints = *hints;
gai_req->retry = INITIAL_DNS_RETRY;
gai_req->callback = callback;
gai_req->context = context;
isc_boolean_t
is_ip_address(
const char * host,
+ u_short af,
isc_netaddr_t * addr
)
{
* addresses (up to 46 bytes), the delimiter character and the
* terminating NULL character.
*/
- if (AF_UNSPEC == addr->family || AF_INET == addr->family)
+ if (AF_UNSPEC == af || AF_INET == af)
if (inet_pton(AF_INET, host, &in4) == 1) {
isc_netaddr_fromin(addr, &in4);
return (ISC_TRUE);
}
- if (AF_UNSPEC == addr->family || AF_INET6 == addr->family)
+ if (AF_UNSPEC == af || AF_INET6 == af)
if (sizeof(tmpbuf) > strlen(host)) {
if ('[' == host[0]) {
strncpy(tmpbuf, &host[1], sizeof(tmpbuf));
} else if (MATCH_IFADDR == match_type) {
NTP_REQUIRE(NULL != if_name);
/* set rule->netaddr */
- is_ip = is_ip_address(if_name, &rule->netaddr);
+ is_ip = is_ip_address(if_name, AF_UNSPEC,
+ &rule->netaddr);
NTP_REQUIRE(is_ip);
} else
NTP_REQUIRE(NULL == if_name);
new_file = fopen(abs_fname, "a");
}
- if (NULL == new_file)
+ if (NULL == new_file) {
+ free(abs_fname);
return -1;
+ }
/* leave a pointer in the old log */
if (log_fname != syslog_abs_fname)
while (ifacect-- > 0) {
add_nic_rule(
- is_ip_address(*ifaces, &netaddr)
- ? MATCH_IFADDR
- : MATCH_IFNAME,
+ is_ip_address(*ifaces, AF_UNSPEC,
+ &netaddr)
+ ? MATCH_IFADDR
+ : MATCH_IFNAME,
*ifaces, -1, ACTION_LISTEN);
ifaces++;
}