diff options
| author | michen <none@none> | 2007-10-01 16:26:48 -0700 |
|---|---|---|
| committer | michen <none@none> | 2007-10-01 16:26:48 -0700 |
| commit | 80b80bf0416a7eb4be4215b2e192cafd03ca80b7 (patch) | |
| tree | 3534771780381970cdbf089b59fe87f51eae5ba1 /usr/src/lib/nsswitch/dns | |
| parent | e03b47c81941d579c735ccfdf5a64874620d5f38 (diff) | |
| download | illumos-joyent-80b80bf0416a7eb4be4215b2e192cafd03ca80b7.tar.gz | |
6299080 nscd initialises name_service_door file with wrong permissions after JASS
6587024 nscd fails to notice nsswitch.conf changes within a second of its start time
6608351 nss2 test cases expose memory problems in the nss_dns and nss_nisplus backends
6609869 nscd has problems if an ip address resolves to an empty hostname
Diffstat (limited to 'usr/src/lib/nsswitch/dns')
| -rw-r--r-- | usr/src/lib/nsswitch/dns/common/dns_common.c | 19 | ||||
| -rw-r--r-- | usr/src/lib/nsswitch/dns/common/gethostent6.c | 13 |
2 files changed, 23 insertions, 9 deletions
diff --git a/usr/src/lib/nsswitch/dns/common/dns_common.c b/usr/src/lib/nsswitch/dns/common/dns_common.c index a30047ac6d..23d6c5c240 100644 --- a/usr/src/lib/nsswitch/dns/common/dns_common.c +++ b/usr/src/lib/nsswitch/dns/common/dns_common.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -217,7 +217,7 @@ ent2str( if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)*p)) { /* LINTED: E_BAD_PTR_CAST_ALIGN */ IN6_V4MAPPED_TO_INADDR((struct in6_addr *)*p, - &in4); + &in4); af = AF_INET; addr = &in4; } else { @@ -232,10 +232,16 @@ ent2str( if (res == NULL) return (NSS_STR_PARSE_PARSE); - if ((n = snprintf(s, l, "%s %s", res, hp->h_name)) >= l) + if ((n = snprintf(s, l, "%s", res)) >= l) return (NSS_STR_PARSE_ERANGE); l -= n; s += n; + if (hp->h_name != NULL && *hp->h_name != '\0') { + if ((n = snprintf(s, l, " %s", hp->h_name)) >= l) + return (NSS_STR_PARSE_ERANGE); + l -= n; + s += n; + } if (p == hp->h_addr_list) { for (q = hp->h_aliases; q && *q; q++) { if ((n = snprintf(s, l, " %s", *q)) >= l) @@ -338,7 +344,7 @@ _nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode) /* misc variables */ int af; char *ap, *apc; - int hlen, alen, iplen, len; + int hlen = 0, alen, iplen, len; statp = &stat; (void) memset(statp, '\0', sizeof (struct __res_state)); @@ -406,6 +412,11 @@ _nss_dns_gethost_withttl(void *buffer, size_t bufsize, int ipnode) return (NSS_ERROR); } else hlen = strlen(host); + /* no host name is an error, return */ + if (hlen <= 0) { + __res_ndestroy(statp); + return (NSS_ERROR); + } cp += n + QFIXEDSZ; if (cp > eom) { __res_ndestroy(statp); diff --git a/usr/src/lib/nsswitch/dns/common/gethostent6.c b/usr/src/lib/nsswitch/dns/common/gethostent6.c index b2d71d6b24..6e81ea61d9 100644 --- a/usr/src/lib/nsswitch/dns/common/gethostent6.c +++ b/usr/src/lib/nsswitch/dns/common/gethostent6.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* @@ -289,6 +289,7 @@ getbyname(be, a) sigset_t oldmask; int converr = 0, gotv6 = 0; struct hostent v6he; + struct hostent mhe; char *v6Name = 0; struct in6_addr **v6Addrs = 0, **mergeAddrs = 0; char **v6Aliases = 0, **mergeAliases = 0; @@ -361,6 +362,7 @@ getbyname(be, a) /* Merge the results */ if (he != NULL) { + mhe = *he; mergeAddrs = cloneAddrList(he, v6Addrs, &converr); if (converr) { if (v6Name != 0) @@ -375,7 +377,7 @@ getbyname(be, a) old_retry); return (_herrno2nss(argp->h_errno)); } - he->h_addr_list = (char **)mergeAddrs; + mhe.h_addr_list = (char **)mergeAddrs; mergeAliases = cloneAliasList(he, v6Aliases, &converr); if (converr) { @@ -393,11 +395,12 @@ getbyname(be, a) old_retry); return (_herrno2nss(argp->h_errno)); } - he->h_aliases = mergeAliases; + mhe.h_aliases = mergeAliases; /* reset h_length, h_addrtype */ - he->h_length = sizeof (struct in6_addr); - he->h_addrtype = AF_INET6; + mhe.h_length = sizeof (struct in6_addr); + mhe.h_addrtype = AF_INET6; + he = &mhe; } else if (gotv6) { v6he.h_name = v6Name; |
