diff options
| author | Vitaliy Gusev <gusev.vitaliy@nexenta.com> | 2011-11-17 11:20:13 +0300 | 
|---|---|---|
| committer | Vitaliy Gusev <gusev.vitaliy@nexenta.com> | 2011-11-17 11:20:13 +0300 | 
| commit | ba2b2c94236651f014e4f9255b7075e654a853dd (patch) | |
| tree | 30e7c20c9570d1bbb13ee480d46a79b05625ce55 /usr/src | |
| parent | bc85e3968c23ab6602e7c5ccc41cba0656c98391 (diff) | |
| download | illumos-joyent-ba2b2c94236651f014e4f9255b7075e654a853dd.tar.gz | |
393 Invalid nd_hostservlist contents crash mountd
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/head/nss_dbdefs.h | 2 | ||||
| -rw-r--r-- | usr/src/lib/libnsl/nss/netdir_inet.c | 21 | 
2 files changed, 13 insertions, 10 deletions
| diff --git a/usr/src/head/nss_dbdefs.h b/usr/src/head/nss_dbdefs.h index dfb3ceb0a1..103d74a7ef 100644 --- a/usr/src/head/nss_dbdefs.h +++ b/usr/src/head/nss_dbdefs.h @@ -666,6 +666,7 @@ typedef struct {  	(str)->key2str  = NULL,				\  	(str)->returnval = 0,				\  	(str)->returnlen = 0,				\ +	(str)->h_errno    = 0,				\  	(str)->erange    = 0)  #define	NSS_XbyY_INIT_EXT(str, res, bufp, len, func, kfunc)	(\ @@ -677,6 +678,7 @@ typedef struct {  	(str)->key2str  = (kfunc),			\  	(str)->returnval = 0,				\  	(str)->returnlen = 0,				\ +	(str)->h_errno    = 0,				\  	(str)->erange    = 0)  #define	NSS_XbyY_FINI(str)				(\ diff --git a/usr/src/lib/libnsl/nss/netdir_inet.c b/usr/src/lib/libnsl/nss/netdir_inet.c index 37914da7e1..b6d02dea7f 100644 --- a/usr/src/lib/libnsl/nss/netdir_inet.c +++ b/usr/src/lib/libnsl/nss/netdir_inet.c @@ -20,6 +20,7 @@   */  /* + * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.   * Use is subject to license terms.   */ @@ -585,9 +586,7 @@ _get_hostserv_inetnetdir_byname(struct netconfig *nconf,  				    ndbuf4switch->buflen, &h_errnop);  				if (he == NULL) {  					NSS_XbyY_FREE(&ndbuf4switch); -					_nderror = h_errnop ? -					    __herrno2netdir(h_errnop) : -					    ND_NOHOST; +					_nderror = __herrno2netdir(h_errnop);  					return (_nderror);  				}  				/* @@ -673,9 +672,7 @@ _get_hostserv_inetnetdir_byname(struct netconfig *nconf,  				    args->arg.nss.host6.flags, &h_errnop);  				if (he == NULL) {  					NSS_XbyY_FREE(&ndbuf4switch); -					_nderror = h_errnop ? -					    __herrno2netdir(h_errnop) : -					    ND_NOHOST; +					_nderror = __herrno2netdir(h_errnop);  					return (_nderror);  				}  				/* @@ -1310,7 +1307,8 @@ _switch_gethostbyname_r(const char *name, struct hostent *result, char *buffer,  	res = nss_search(&db_root_hosts, _nss_initf_hosts,  	    NSS_DBOP_HOSTS_BYNAME, &arg);  	arg.status = res; -	*h_errnop = arg.h_errno; +	if (res != NSS_SUCCESS) +		*h_errnop = arg.h_errno ? arg.h_errno : __nss2herrno(res);  	if (arg.returnval != NULL)  		order_haddrlist_af(result->h_addrtype, result->h_addr_list);  	return ((struct hostent *)NSS_XbyY_FINI(&arg)); @@ -1331,7 +1329,8 @@ _switch_getipnodebyname_r(const char *name, struct hostent *result,  	res = nss_search(&db_root_ipnodes, _nss_initf_ipnodes,  	    NSS_DBOP_IPNODES_BYNAME, &arg);  	arg.status = res; -	*h_errnop = arg.h_errno; +	if (res != NSS_SUCCESS) +		*h_errnop = arg.h_errno ? arg.h_errno : __nss2herrno(res);  	if (arg.returnval != NULL)  		order_haddrlist_af(result->h_addrtype, result->h_addr_list);  	return ((struct hostent *)NSS_XbyY_FINI(&arg)); @@ -1352,7 +1351,8 @@ _switch_gethostbyaddr_r(const char *addr, int len, int type,  	res = nss_search(&db_root_hosts, _nss_initf_hosts,  	    NSS_DBOP_HOSTS_BYADDR, &arg);  	arg.status = res; -	*h_errnop = arg.h_errno; +	if (res != NSS_SUCCESS) +		*h_errnop = arg.h_errno ? arg.h_errno : __nss2herrno(res);  	return (struct hostent *)NSS_XbyY_FINI(&arg);  } @@ -1371,7 +1371,8 @@ _switch_getipnodebyaddr_r(const char *addr, int len, int type,  	res = nss_search(&db_root_ipnodes, _nss_initf_ipnodes,  	    NSS_DBOP_IPNODES_BYADDR, &arg);  	arg.status = res; -	*h_errnop = arg.h_errno; +	if (res != NSS_SUCCESS) +		*h_errnop = arg.h_errno ? arg.h_errno : __nss2herrno(res);  	return (struct hostent *)NSS_XbyY_FINI(&arg);  } | 
