version 1.11, 2009/04/12 17:07:17 |
version 1.11.6.1, 2012/04/17 00:05:22 |
Line 116 __RCSID("$NetBSD$"); |
|
Line 116 __RCSID("$NetBSD$"); |
|
#include <arpa/inet.h> |
#include <arpa/inet.h> |
#include <arpa/nameser.h> |
#include <arpa/nameser.h> |
|
|
|
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
#include <math.h> |
#include <math.h> |
Line 176 do_section(const res_state statp, |
|
Line 177 do_section(const res_state statp, |
|
/* |
/* |
* Print answer records. |
* Print answer records. |
*/ |
*/ |
sflag = (statp->pfcode & pflag); |
sflag = (int)(statp->pfcode & pflag); |
if (statp->pfcode && !sflag) |
if (statp->pfcode && !sflag) |
return; |
return; |
|
|
Line 207 do_section(const res_state statp, |
|
Line 208 do_section(const res_state statp, |
|
p_type(ns_rr_type(rr)), |
p_type(ns_rr_type(rr)), |
p_class(ns_rr_class(rr))); |
p_class(ns_rr_class(rr))); |
else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { |
else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { |
u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr); |
size_t rdatalen, ttl; |
u_int32_t ttl = ns_rr_ttl(rr); |
uint16_t optcode, optlen; |
|
|
|
rdatalen = ns_rr_rdlen(rr); |
|
ttl = ns_rr_ttl(rr); |
|
|
fprintf(file, |
fprintf(file, |
"; EDNS: version: %u, udp=%u, flags=%04x\n", |
"; EDNS: version: %zu, udp=%u, flags=%04zx\n", |
(ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); |
(ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); |
|
|
while (rdatalen >= 4) { |
while (rdatalen >= 4) { |
Line 368 p_cdnname(const u_char *cp, const u_char |
|
Line 372 p_cdnname(const u_char *cp, const u_char |
|
char name[MAXDNAME]; |
char name[MAXDNAME]; |
int n; |
int n; |
|
|
if ((n = dn_expand(msg, msg + len, cp, name, sizeof name)) < 0) |
if ((n = dn_expand(msg, msg + len, cp, name, (int)sizeof name)) < 0) |
return (NULL); |
return (NULL); |
if (name[0] == '\0') |
if (name[0] == '\0') |
putc('.', file); |
putc('.', file); |
Line 393 p_fqnname(cp, msg, msglen, name, namelen |
|
Line 397 p_fqnname(cp, msg, msglen, name, namelen |
|
char *name; |
char *name; |
int namelen; |
int namelen; |
{ |
{ |
int n, newlen; |
int n; |
|
size_t newlen; |
|
|
if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0) |
if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0) |
return (NULL); |
return (NULL); |
newlen = strlen(name); |
newlen = strlen(name); |
if (newlen == 0 || name[newlen - 1] != '.') { |
if (newlen == 0 || name[newlen - 1] != '.') { |
if (newlen + 1 >= namelen) /*%< Lack space for final dot */ |
if ((int)newlen + 1 >= namelen) /*%< Lack space for final dot */ |
return (NULL); |
return (NULL); |
else |
else |
strcpy(name + newlen, "."); |
strcpy(name + newlen, "."); |
Line 414 p_fqname(const u_char *cp, const u_char |
|
Line 419 p_fqname(const u_char *cp, const u_char |
|
char name[MAXDNAME]; |
char name[MAXDNAME]; |
const u_char *n; |
const u_char *n; |
|
|
n = p_fqnname(cp, msg, MAXCDNAME, name, sizeof name); |
n = p_fqnname(cp, msg, MAXCDNAME, name, (int)sizeof name); |
if (n == NULL) |
if (n == NULL) |
return (NULL); |
return (NULL); |
fputs(name, file); |
fputs(name, file); |
Line 749 p_sockun(union res_sockaddr_union u, cha |
|
Line 754 p_sockun(union res_sockaddr_union u, cha |
|
|
|
switch (u.sin.sin_family) { |
switch (u.sin.sin_family) { |
case AF_INET: |
case AF_INET: |
inet_ntop(AF_INET, &u.sin.sin_addr, ret, sizeof ret); |
inet_ntop(AF_INET, &u.sin.sin_addr, ret, (socklen_t)sizeof ret); |
break; |
break; |
#ifdef HAS_INET6_STRUCTS |
#ifdef HAS_INET6_STRUCTS |
case AF_INET6: |
case AF_INET6: |
Line 1153 loc_ntoa(binary, ascii) |
|
Line 1158 loc_ntoa(binary, ascii) |
|
/*% Return the number of DNS hierarchy levels in the name. */ |
/*% Return the number of DNS hierarchy levels in the name. */ |
int |
int |
dn_count_labels(const char *name) { |
dn_count_labels(const char *name) { |
int i, len, count; |
size_t len, i, count; |
|
|
len = strlen(name); |
len = strlen(name); |
for (i = 0, count = 0; i < len; i++) { |
for (i = 0, count = 0; i < len; i++) { |
Line 1172 dn_count_labels(const char *name) { |
|
Line 1177 dn_count_labels(const char *name) { |
|
/* count to include last label */ |
/* count to include last label */ |
if (len > 0 && name[len-1] != '.') |
if (len > 0 && name[len-1] != '.') |
count++; |
count++; |
return (count); |
_DIAGASSERT(__type_fit(int, count)); |
|
return (int)count; |
} |
} |
|
|
/*% |
/*% |