Mercurial > illumos > illumos-gate
changeset 13580:e7b96961e15f
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>
author | Vitaliy Gusev <gusev.vitaliy@nexenta.com> |
---|---|
date | Thu, 17 Nov 2011 11:20:13 +0300 |
parents | eb88ab5c1435 |
children | eab0c2354e82 |
files | usr/src/head/nss_dbdefs.h usr/src/lib/libnsl/nss/netdir_inet.c |
diffstat | 2 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/head/nss_dbdefs.h Fri Jan 27 00:27:36 2012 -0500 +++ b/usr/src/head/nss_dbdefs.h Thu Nov 17 11:20:13 2011 +0300 @@ -666,6 +666,7 @@ (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 @@ (str)->key2str = (kfunc), \ (str)->returnval = 0, \ (str)->returnlen = 0, \ + (str)->h_errno = 0, \ (str)->erange = 0) #define NSS_XbyY_FINI(str) (\
--- a/usr/src/lib/libnsl/nss/netdir_inet.c Fri Jan 27 00:27:36 2012 -0500 +++ b/usr/src/lib/libnsl/nss/netdir_inet.c Thu Nov 17 11:20:13 2011 +0300 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); }