diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-05-26 00:09:49 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-05-26 00:15:12 +0400 |
commit | 9fb817b84f4f2c3211a49380f43aac0c519d7319 (patch) | |
tree | f943c05fa492051f721534f4133995d230033aeb /libc | |
parent | f418babb0a89d34a2eb50c8d371c8235562fa93b (diff) | |
download | illumos-packaging-9fb817b84f4f2c3211a49380f43aac0c519d7319.tar.gz |
Backported illumos fixes for libnsl:
4867 Uninitialized variables in libnsl
4812 libnsl: Some nisplus leftovers
4808 libnsl: SI_SRPC_DOMAIN is always defined
4803 libnsl: recursive mutex lock in return_xprt_copy()
4724 Possible memory leak in _clnt_vc_create_timed()
4462 clnt_vc_control()/clnt_dg_control() could return RPC_FAILED instead of FALSE
Diffstat (limited to 'libc')
-rw-r--r-- | libc/debian/changelog | 7 | ||||
-rw-r--r-- | libc/debian/libc1-illumos-i386.symbols | 3 | ||||
-rw-r--r-- | libc/debian/libc1.symbols.illumos-amd64 | 3 | ||||
-rw-r--r-- | libc/debian/patches/libnsl-illumos-updates.patch | 1380 | ||||
-rw-r--r-- | libc/debian/patches/series | 1 |
5 files changed, 1388 insertions, 6 deletions
diff --git a/libc/debian/changelog b/libc/debian/changelog index fdaa9f6..ad08c2f 100644 --- a/libc/debian/changelog +++ b/libc/debian/changelog @@ -6,6 +6,13 @@ libc (4.3+1) UNRELEASED; urgency=medium has installed a signal handler to catch SIGCHLD signals. * Install manpages from section 2 * Added htobe16/be16toh and others BSD macros to endian.h + * Backported illumos fixes for libnsl: + 4867 Uninitialized variables in libnsl + 4812 libnsl: Some nisplus leftovers + 4808 libnsl: SI_SRPC_DOMAIN is always defined + 4803 libnsl: recursive mutex lock in return_xprt_copy() + 4724 Possible memory leak in _clnt_vc_create_timed() + 4462 clnt_vc_control()/clnt_dg_control() could return RPC_FAILED instead of FALSE -- Igor Pashev <pashev.igor@gmail.com> Mon, 07 Apr 2014 11:32:28 +0400 diff --git a/libc/debian/libc1-illumos-i386.symbols b/libc/debian/libc1-illumos-i386.symbols index 20759dd..95b4e1c 100644 --- a/libc/debian/libc1-illumos-i386.symbols +++ b/libc/debian/libc1-illumos-i386.symbols @@ -3353,9 +3353,6 @@ libnsl.so.1 libc1-illumos-i386 #MINVER# __seterr_reply@SUNWprivate_1.1 2.10-1 __sethostent6@SUNWprivate_1.2 2.10-1 __svc_get_svcauth@SUNWprivate_1.1 2.10-1 - __svc_nisplus_enable_timestamps@SUNWprivate_1.1 2.10-1 - __svc_nisplus_fdcleanup_hack@SUNWprivate_1.1 2.10-1 - __svc_nisplus_purge_since@SUNWprivate_1.1 2.10-1 __svc_set_proc_cleanup_cb@SUNWprivate_1.1 2.10-1 __svc_vc_dup@SUNWprivate_1.1 2.10-1 __svc_vc_dupcache_init@SUNWprivate_1.1 2.10-1 diff --git a/libc/debian/libc1.symbols.illumos-amd64 b/libc/debian/libc1.symbols.illumos-amd64 index c80d44e..d30a867 100644 --- a/libc/debian/libc1.symbols.illumos-amd64 +++ b/libc/debian/libc1.symbols.illumos-amd64 @@ -3230,9 +3230,6 @@ libnsl.so.1 libc1 #MINVER# __seterr_reply@SUNWprivate_1.1 2.10-1 __sethostent6@SUNWprivate_1.2 2.10-1 __svc_get_svcauth@SUNWprivate_1.1 2.10-1 - __svc_nisplus_enable_timestamps@SUNWprivate_1.1 2.10-1 - __svc_nisplus_fdcleanup_hack@SUNWprivate_1.1 2.10-1 - __svc_nisplus_purge_since@SUNWprivate_1.1 2.10-1 __svc_set_proc_cleanup_cb@SUNWprivate_1.1 2.10-1 __svc_vc_dup@SUNWprivate_1.1 2.10-1 __svc_vc_dupcache_init@SUNWprivate_1.1 2.10-1 diff --git a/libc/debian/patches/libnsl-illumos-updates.patch b/libc/debian/patches/libnsl-illumos-updates.patch new file mode 100644 index 0000000..85dca3a --- /dev/null +++ b/libc/debian/patches/libnsl-illumos-updates.patch @@ -0,0 +1,1380 @@ +Description: fixes illumos bugs: + 4867 Uninitialized variables in libnsl + 4812 libnsl: Some nisplus leftovers + 4808 libnsl: SI_SRPC_DOMAIN is always defined + 4803 libnsl: recursive mutex lock in return_xprt_copy() + 4724 Possible memory leak in _clnt_vc_create_timed() + 4462 clnt_vc_control()/clnt_dg_control() could return RPC_FAILED instead of FALSE +Index: libc/usr/src/lib/libnsl/common/llib-lnsl +=================================================================== +--- libc.orig/usr/src/lib/libnsl/common/llib-lnsl 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/common/llib-lnsl 2014-05-26 00:04:41.067232784 +0400 +@@ -23,7 +23,7 @@ + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + * +- * Copyright 2011 Nexenta Systems, Inc. All rights reserved. ++ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ + + +@@ -836,9 +836,6 @@ + /* svc_vc.c */ + SVCXPRT *svc_vc_create(int fd, uint_t sendsize, uint_t recvsize); + SVCXPRT *svc_fd_create(int fd, uint_t sendsize, uint_t recvsize); +-void __svc_nisplus_fdcleanup_hack(void); +-void __svc_nisplus_enable_timestamps(void); +-void __svc_nisplus_purge_since(long since); + bool_t __svc_vc_dupcache_init(SVCXPRT *xprt, void *condition, int basis); + int __svc_vc_dup(struct svc_req *req, caddr_t *resp_buf, uint_t *resp_bufsz); + int __svc_vc_dupdone(struct svc_req *req, caddr_t resp_buf, uint_t resp_bufsz, +Index: libc/usr/src/lib/libnsl/common/mapfile-vers +=================================================================== +--- libc.orig/usr/src/lib/libnsl/common/mapfile-vers 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/common/mapfile-vers 2014-05-26 00:04:41.077921847 +0400 +@@ -20,7 +20,7 @@ + # + # + # Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +-# Copyright 2011 Nexenta Systems, Inc. All rights reserved. ++# Copyright 2014 Nexenta Systems, Inc. All rights reserved. + # + + # +@@ -467,8 +467,8 @@ + + SYMBOL_VERSION SUNWprivate_1.5 { + global: +- inet_matchaddr; + clnt_create_service_timed; ++ inet_matchaddr; + } SUNWprivate_1.4; + + SYMBOL_VERSION SUNWprivate_1.4 { +@@ -663,9 +663,6 @@ + svc_get_local_cred; + _svc_getreqset_proc; + __svc_get_svcauth; +- __svc_nisplus_enable_timestamps; +- __svc_nisplus_fdcleanup_hack; +- __svc_nisplus_purge_since; + __svc_set_proc_cleanup_cb; + __svc_vc_dup; + __svc_vc_dupcache_init; +Index: libc/usr/src/lib/libnsl/key/publickey.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/key/publickey.c 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/key/publickey.c 2014-05-26 00:04:41.082413649 +0400 +@@ -23,6 +23,9 @@ + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + + /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ + /* All Rights Reserved */ +@@ -580,6 +583,7 @@ + syslog(LOG_INFO, "Unknown publickey nameservice '%s'", + look->service_name); + err = __NSW_UNAVAIL; ++ res = 0; + } + + switch (look->actions[err]) { +@@ -662,6 +666,7 @@ + syslog(LOG_INFO, "Unknown publickey nameservice '%s'", + look->service_name); + err = __NSW_UNAVAIL; ++ res = 0; + } + switch (look->actions[err]) { + case __NSW_CONTINUE : +Index: libc/usr/src/lib/libnsl/nsl/t_sndvudata.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/nsl/t_sndvudata.c 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/nsl/t_sndvudata.c 2014-05-26 00:04:41.086556645 +0400 +@@ -24,8 +24,9 @@ + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +- +-#pragma ident "%Z%%M% %I% %E% SMI" ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + + /* + * t_sndudata.c and t_sndvudata.c are very similar and contain common code. +@@ -56,7 +57,7 @@ + struct _ti_user *tiptr; + int sv_errno; + int didalloc; +- char *dataptr; ++ char *dataptr = NULL; + unsigned int nbytes; + + assert(api_semantics == TX_XTI_XNS5_API); +@@ -157,7 +158,6 @@ + + ctlbuf.len = size; + +- dataptr = NULL; + if (nbytes != 0) { + if ((dataptr = malloc((size_t)nbytes)) == NULL) { + t_errno = TSYSERR; +@@ -187,13 +187,12 @@ + sig_mutex_lock(&tiptr->ti_lock); + + _T_TX_NEXTSTATE(T_SNDUDATA, tiptr, +- "t_sndvudata: invalid state event T_SNDUDATA"); ++ "t_sndvudata: invalid state event T_SNDUDATA"); + if (didalloc) + free(ctlbuf.buf); + else + tiptr->ti_ctlbuf = ctlbuf.buf; +- if (dataptr != NULL) +- free(dataptr); ++ free(dataptr); + sig_mutex_unlock(&tiptr->ti_lock); + return (0); + err_out: +@@ -202,8 +201,7 @@ + free(ctlbuf.buf); + else + tiptr->ti_ctlbuf = ctlbuf.buf; +- if (dataptr != NULL) +- free(dataptr); ++ free(dataptr); + sig_mutex_unlock(&tiptr->ti_lock); + errno = sv_errno; + return (-1); +Index: libc/usr/src/lib/libnsl/nss/getexecattr.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/nss/getexecattr.c 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/nss/getexecattr.c 2014-05-26 00:04:41.099010929 +0400 +@@ -22,6 +22,9 @@ + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + + #include "mt.h" + #include <stdio.h> +@@ -167,36 +170,37 @@ + { + int getby_flag; + char policy_buf[BUFSIZ]; +- const char *empty = NULL; + nss_status_t res = NSS_NOTFOUND; + nss_XbyY_args_t arg; + _priv_execattr _priv_exec; + static mutex_t _nsw_exec_lock = DEFAULTMUTEX; + ++ if ((name != NULL) && (id != NULL)) { ++ getby_flag = NSS_DBOP_EXECATTR_BYNAMEID; ++ } else if (name != NULL) { ++ getby_flag = NSS_DBOP_EXECATTR_BYNAME; ++ } else if (id != NULL) { ++ getby_flag = NSS_DBOP_EXECATTR_BYID; ++ } else { ++ return (NULL); ++ } ++ + NSS_XbyY_INIT(&arg, result, buffer, buflen, str2execattr); + +- _priv_exec.name = (name == NULL) ? empty : (const char *)name; +- _priv_exec.type = (type == NULL) ? empty : (const char *)type; +- _priv_exec.id = (id == NULL) ? empty : (const char *)id; ++ _priv_exec.name = name; ++ _priv_exec.type = type; ++ _priv_exec.id = id; + #ifdef SI_SECPOLICY + if (sysinfo(SI_SECPOLICY, policy_buf, BUFSIZ) == -1) + #endif /* SI_SECPOLICY */ + (void) strncpy(policy_buf, DEFAULT_POLICY, BUFSIZ); + + retry_policy: +- _priv_exec.policy = IS_SEARCH_ALL(search_flag) ? empty : policy_buf; ++ _priv_exec.policy = IS_SEARCH_ALL(search_flag) ? NULL : policy_buf; + _priv_exec.search_flag = search_flag; + _priv_exec.head_exec = NULL; + _priv_exec.prev_exec = NULL; + +- if ((name != NULL) && (id != NULL)) { +- getby_flag = NSS_DBOP_EXECATTR_BYNAMEID; +- } else if (name != NULL) { +- getby_flag = NSS_DBOP_EXECATTR_BYNAME; +- } else if (id != NULL) { +- getby_flag = NSS_DBOP_EXECATTR_BYID; +- } +- + arg.key.attrp = &(_priv_exec); + + switch (getby_flag) { +Index: libc/usr/src/lib/libnsl/rpc/clnt_dg.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/rpc/clnt_dg.c 2014-05-11 14:28:41.008749610 +0400 ++++ libc/usr/src/lib/libnsl/rpc/clnt_dg.c 2014-05-26 00:04:41.121149212 +0400 +@@ -24,6 +24,10 @@ + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ ++ + /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ + /* All Rights Reserved */ + /* +@@ -32,8 +36,6 @@ + * California. + */ + +-#pragma ident "%Z%%M% %I% %E% SMI" +- + /* + * Implements a connectionless client side RPC. + */ +@@ -164,7 +166,7 @@ + */ + if (tinfo.servtype == T_CLTS) + (void) __rpc_tli_set_options(fd, SOL_SOCKET, SO_DGRAM_ERRIND, +- 1); ++ 1); + /* + * Find the receive and the send size + */ +@@ -212,11 +214,9 @@ + } + cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs)); + XDR_DESTROY(&(cu->cu_outxdrs)); +- xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf_start, ssz, +- XDR_ENCODE); ++ xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf_start, ssz, XDR_ENCODE); + /* LINTED pointer alignment */ +- tr_data = (struct t_unitdata *)t_alloc(fd, +- T_UNITDATA, T_ADDR | T_OPT); ++ tr_data = (struct t_unitdata *)t_alloc(fd, T_UNITDATA, T_ADDR | T_OPT); + if (tr_data == NULL) { + goto err1; + } +@@ -310,9 +310,9 @@ + + if (cl->cl_auth->ah_cred.oa_flavor != RPCSEC_GSS) { + if ((!XDR_PUTBYTES(xdrs, cu->cu_outbuf, cu->cu_xdrpos)) || +- (!XDR_PUTINT32(xdrs, (int32_t *)&proc)) || +- (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || +- (!xargs(xdrs, argsp))) { ++ (!XDR_PUTINT32(xdrs, (int32_t *)&proc)) || ++ (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || ++ (!xargs(xdrs, argsp))) { + rpc_fd_unlock(dgtbl, cu->cu_fd); + return (rpc_callerr.re_status = RPC_CANTENCODEARGS); + } +@@ -368,7 +368,7 @@ + } + + if (poll_time.tv_sec < 0 || (poll_time.tv_sec == 0 && +- poll_time.tv_usec == 0)) { ++ poll_time.tv_usec == 0)) { + /* + * this could happen if time_waited >= timeout + */ +@@ -377,8 +377,8 @@ + } + + if (poll_time.tv_sec > retransmit_time.tv_sec || +- (poll_time.tv_sec == retransmit_time.tv_sec && +- poll_time.tv_usec > retransmit_time.tv_usec)) ++ (poll_time.tv_sec == retransmit_time.tv_sec && ++ poll_time.tv_usec > retransmit_time.tv_usec)) + poll_time = retransmit_time; + + +@@ -387,7 +387,7 @@ + (void) gettimeofday(&startime, NULL); + + switch (poll(&cu->pfdp, 1, +- __rpc_timeval_to_msec(&poll_time))) { ++ __rpc_timeval_to_msec(&poll_time))) { + case -1: + if (errno != EINTR && errno != EAGAIN) { + rpc_callerr.re_errno = errno; +@@ -404,7 +404,7 @@ + timeout: (void) gettimeofday(&curtime, NULL); + time_waited.tv_sec += curtime.tv_sec - startime.tv_sec; + time_waited.tv_usec += curtime.tv_usec - +- startime.tv_usec; ++ startime.tv_usec; + while (time_waited.tv_usec >= 1000000) { + time_waited.tv_usec -= 1000000; + time_waited.tv_sec++; +@@ -432,8 +432,7 @@ + * if there's time left to poll, poll again + */ + if (poll_time.tv_sec > 0 || +- (poll_time.tv_sec == 0 && +- poll_time.tv_usec > 0)) ++ (poll_time.tv_sec == 0 && poll_time.tv_usec > 0)) + continue; + + /* +@@ -441,8 +440,8 @@ + * otherwise, return timeout error + */ + if (time_waited.tv_sec < timeout.tv_sec || +- (time_waited.tv_sec == timeout.tv_sec && +- time_waited.tv_usec < timeout.tv_usec)) { ++ (time_waited.tv_sec == timeout.tv_sec && ++ time_waited.tv_usec < timeout.tv_usec)) { + /* + * update retransmit_time + */ +@@ -454,16 +453,16 @@ + } + if (retransmit_time.tv_sec >= RPC_MAX_BACKOFF) { + retransmit_time.tv_sec = +- RPC_MAX_BACKOFF; ++ RPC_MAX_BACKOFF; + retransmit_time.tv_usec = 0; + } + /* + * redo AUTH_MARSHAL if AUTH_DES or RPCSEC_GSS. + */ + if (cl->cl_auth->ah_cred.oa_flavor == +- AUTH_DES || +- cl->cl_auth->ah_cred.oa_flavor == +- RPCSEC_GSS) ++ AUTH_DES || ++ cl->cl_auth->ah_cred.oa_flavor == ++ RPCSEC_GSS) + goto call_again; + else + goto send_again; +@@ -538,8 +537,8 @@ + /* see if reply transaction id matches sent id */ + /* LINTED pointer alignment */ + if (*((uint32_t *)(cu->cu_inbuf)) != +- /* LINTED pointer alignment */ +- *((uint32_t *)(cu->cu_outbuf))) ++ /* LINTED pointer alignment */ ++ *((uint32_t *)(cu->cu_outbuf))) + goto timeout; + /* we now assume we have the proper reply */ + break; +@@ -550,32 +549,34 @@ + */ + + xdrmem_create(&reply_xdrs, cu->cu_inbuf, +- (uint_t)cu->cu_tr_data->udata.len, XDR_DECODE); ++ (uint_t)cu->cu_tr_data->udata.len, XDR_DECODE); + ok = xdr_replymsg(&reply_xdrs, &reply_msg); + /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */ + if (ok) { + if ((reply_msg.rm_reply.rp_stat == MSG_ACCEPTED) && +- (reply_msg.acpted_rply.ar_stat == SUCCESS)) ++ (reply_msg.acpted_rply.ar_stat == SUCCESS)) + rpc_callerr.re_status = RPC_SUCCESS; + else + __seterr_reply(&reply_msg, &(rpc_callerr)); + + if (rpc_callerr.re_status == RPC_SUCCESS) { + if (!AUTH_VALIDATE(cl->cl_auth, +- &reply_msg.acpted_rply.ar_verf)) { ++ &reply_msg.acpted_rply.ar_verf)) { + rpc_callerr.re_status = RPC_AUTHERROR; + rpc_callerr.re_why = AUTH_INVALIDRESP; + } else if (cl->cl_auth->ah_cred.oa_flavor != +- RPCSEC_GSS) { ++ RPCSEC_GSS) { + if (!(*xresults)(&reply_xdrs, resultsp)) { +- if (rpc_callerr.re_status == RPC_SUCCESS) +- rpc_callerr.re_status = +- RPC_CANTDECODERES; ++ if (rpc_callerr.re_status == ++ RPC_SUCCESS) ++ rpc_callerr.re_status = ++ RPC_CANTDECODERES; + } + } else if (!__rpc_gss_unwrap(cl->cl_auth, &reply_xdrs, +- xresults, resultsp)) { ++ xresults, resultsp)) { + if (rpc_callerr.re_status == RPC_SUCCESS) +- rpc_callerr.re_status = RPC_CANTDECODERES; ++ rpc_callerr.re_status = ++ RPC_CANTDECODERES; + } + } /* end successful completion */ + /* +@@ -600,10 +601,10 @@ + /* end of unsuccessful completion */ + /* free verifier */ + if (reply_msg.rm_reply.rp_stat == MSG_ACCEPTED && +- reply_msg.acpted_rply.ar_verf.oa_base != NULL) { ++ reply_msg.acpted_rply.ar_verf.oa_base != NULL) { + xdrs->x_op = XDR_FREE; + (void) xdr_opaque_auth(xdrs, +- &(reply_msg.acpted_rply.ar_verf)); ++ &(reply_msg.acpted_rply.ar_verf)); + } + } /* end of valid reply message */ + else { +@@ -647,9 +648,9 @@ + + if (cl->cl_auth->ah_cred.oa_flavor != RPCSEC_GSS) { + if ((!XDR_PUTBYTES(xdrs, cu->cu_outbuf, cu->cu_xdrpos)) || +- (!XDR_PUTINT32(xdrs, (int32_t *)&proc)) || +- (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || +- (!xargs(xdrs, argsp))) { ++ (!XDR_PUTINT32(xdrs, (int32_t *)&proc)) || ++ (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || ++ (!xargs(xdrs, argsp))) { + rpc_fd_unlock(dgtbl, cu->cu_fd); + return (rpc_callerr.re_status = RPC_CANTENCODEARGS); + } +@@ -717,7 +718,7 @@ + struct netbuf *addr; + if (rpc_fd_lock(dgtbl, cu->cu_fd)) { + rpc_fd_unlock(dgtbl, cu->cu_fd); +- return (RPC_FAILED); ++ return (FALSE); + } + + switch (request) { +@@ -815,14 +816,14 @@ + */ + /* LINTED pointer alignment */ + *(uint32_t *)info = ntohl(*(uint32_t *)(cu->cu_outbuf + +- 4 * BYTES_PER_XDR_UNIT)); ++ 4 * BYTES_PER_XDR_UNIT)); + break; + + case CLSET_VERS: + /* LINTED pointer alignment */ + *(uint32_t *)(cu->cu_outbuf + 4 * BYTES_PER_XDR_UNIT) = + /* LINTED pointer alignment */ +- htonl(*(uint32_t *)info); ++ htonl(*(uint32_t *)info); + break; + + case CLGET_PROG: +@@ -834,14 +835,14 @@ + */ + /* LINTED pointer alignment */ + *(uint32_t *)info = ntohl(*(uint32_t *)(cu->cu_outbuf + +- 3 * BYTES_PER_XDR_UNIT)); ++ 3 * BYTES_PER_XDR_UNIT)); + break; + + case CLSET_PROG: + /* LINTED pointer alignment */ + *(uint32_t *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT) = + /* LINTED pointer alignment */ +- htonl(*(uint32_t *)info); ++ htonl(*(uint32_t *)info); + break; + + default: +@@ -904,7 +905,7 @@ + time_not_ok(struct timeval *t) + { + return (t->tv_sec < -1 || t->tv_sec > 100000000 || +- t->tv_usec < -1 || t->tv_usec > 1000000); ++ t->tv_usec < -1 || t->tv_usec > 1000000); + } + + /* +@@ -921,8 +922,7 @@ + + old = t_errno; + /* LINTED pointer cast */ +- uderr = (struct t_uderr *) +- t_alloc(cu->cu_fd, T_UDERROR, T_ADDR); ++ uderr = (struct t_uderr *)t_alloc(cu->cu_fd, T_UDERROR, T_ADDR); + + if (t_rcvuderr(cu->cu_fd, uderr) == 0) { + if (uderr == NULL) +Index: libc/usr/src/lib/libnsl/rpc/clnt_vc.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/rpc/clnt_vc.c 2014-05-11 14:28:41.038324193 +0400 ++++ libc/usr/src/lib/libnsl/rpc/clnt_vc.c 2014-05-26 00:04:41.136254180 +0400 +@@ -23,6 +23,9 @@ + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + + /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ + /* All Rights Reserved */ +@@ -32,8 +35,6 @@ + * California. + */ + +-#pragma ident "%Z%%M% %I% %E% SMI" +- + /* + * clnt_vc.c + * +@@ -216,7 +217,7 @@ + const rpcvers_t vers, const uint_t sendsz, const uint_t recvsz) + { + return (_clnt_vc_create_timed(fd, svcaddr, prog, vers, sendsz, +- recvsz, NULL)); ++ recvsz, NULL)); + } + + /* +@@ -242,16 +243,17 @@ + int flag; + + cl = malloc(sizeof (*cl)); +- ct = malloc(sizeof (*ct)); ++ if ((ct = malloc(sizeof (*ct))) != NULL) ++ ct->ct_addr.buf = NULL; ++ + if ((cl == NULL) || (ct == NULL)) { + (void) syslog(LOG_ERR, clnt_vc_errstr, +- clnt_vc_str, __no_mem_str); ++ clnt_vc_str, __no_mem_str); + rpc_createerr.cf_stat = RPC_SYSTEMERROR; + rpc_createerr.cf_error.re_errno = errno; + rpc_createerr.cf_error.re_terrno = 0; + goto err; + } +- ct->ct_addr.buf = NULL; + + /* + * The only use of vctbl_lock is for serializing the creation of +@@ -353,7 +355,7 @@ + */ + ct->ct_xdrs.x_ops = NULL; + xdrrec_create(&(ct->ct_xdrs), sendsz, recvsz, (caddr_t)ct, +- read_vc, write_vc); ++ read_vc, write_vc); + if (ct->ct_xdrs.x_ops == NULL) { + rpc_createerr.cf_stat = RPC_SYSTEMERROR; + rpc_createerr.cf_error.re_terrno = 0; +@@ -368,14 +370,12 @@ + return (cl); + + err: +- if (cl) { +- if (ct) { +- if (ct->ct_addr.len) +- free(ct->ct_addr.buf); +- free(ct); +- } +- free(cl); ++ if (ct) { ++ free(ct->ct_addr.buf); ++ free(ct); + } ++ free(cl); ++ + return (NULL); + } + +@@ -511,18 +511,22 @@ + * for other reason, default timeout will be used. + */ + if (tp != NULL) { +- int ms; ++ int ms; + +- /* TCP_CONN_ABORT_THRESHOLD takes int value in millisecs */ +- ms = tp->tv_sec * SECS_TO_MS + tp->tv_usec * USECS_TO_MS; +- if (((curr_time = _get_tcp_conntime(fd)) != -1) && +- (_set_tcp_conntime(fd, ms) == 0)) { +- /* EMPTY */ ++ /* ++ * TCP_CONN_ABORT_THRESHOLD takes int value in millisecs ++ */ ++ ms = tp->tv_sec * SECS_TO_MS + ++ tp->tv_usec * USECS_TO_MS; ++ if (((curr_time = _get_tcp_conntime(fd)) != -1) && ++ (_set_tcp_conntime(fd, ms) == 0)) { ++ /* EMPTY */ + #ifdef DEBUG +- fprintf(stderr, "set_up_connection: set tcp "); +- fprintf(stderr, "connection timeout to %d ms\n", ms); ++ fprintf(stderr, "set_up_connection: set tcp "); ++ fprintf(stderr, "connection timeout to %d ms\n", ++ ms); + #endif +- } ++ } + } + + for (nconnect = 0; nconnect < 3; nconnect++) { +@@ -573,7 +577,7 @@ + (void) t_free((char *)rcvcall, T_CALL); + #ifdef DEBUG + fprintf(stderr, "clnt_vc: t_connect error %d\n", +- rpc_createerr.cf_error.re_terrno); ++ rpc_createerr.cf_error.re_terrno); + #endif + return (FALSE); + } +@@ -598,14 +602,14 @@ + ct->ct_addr.buf = malloc(svcaddr->len); + if (ct->ct_addr.buf == NULL) { + (void) syslog(LOG_ERR, clnt_vc_errstr, +- clnt_vc_str, __no_mem_str); ++ clnt_vc_str, __no_mem_str); + rpc_createerr.cf_stat = RPC_SYSTEMERROR; + rpc_createerr.cf_error.re_errno = errno; + rpc_createerr.cf_error.re_terrno = 0; + return (FALSE); + } + (void) memcpy(ct->ct_addr.buf, svcaddr->buf, +- (size_t)svcaddr->len); ++ (size_t)svcaddr->len); + ct->ct_addr.len = ct->ct_addr.maxlen = svcaddr->len; + } + break; +@@ -741,16 +745,17 @@ + + if (rpc_callerr.re_status == RPC_SUCCESS) { + if (!AUTH_VALIDATE(cl->cl_auth, +- &reply_msg.acpted_rply.ar_verf)) { ++ &reply_msg.acpted_rply.ar_verf)) { + rpc_callerr.re_status = RPC_AUTHERROR; + rpc_callerr.re_why = AUTH_INVALIDRESP; + } else if (cl->cl_auth->ah_cred.oa_flavor != RPCSEC_GSS) { + if (!(*xdr_results)(xdrs, results_ptr)) { + if (rpc_callerr.re_status == RPC_SUCCESS) +- rpc_callerr.re_status = RPC_CANTDECODERES; ++ rpc_callerr.re_status = ++ RPC_CANTDECODERES; + } + } else if (!__rpc_gss_unwrap(cl->cl_auth, xdrs, xdr_results, +- results_ptr)) { ++ results_ptr)) { + if (rpc_callerr.re_status == RPC_SUCCESS) + rpc_callerr.re_status = RPC_CANTDECODERES; + } +@@ -774,7 +779,7 @@ + } /* end of unsuccessful completion */ + /* free verifier ... */ + if (reply_msg.rm_reply.rp_stat == MSG_ACCEPTED && +- reply_msg.acpted_rply.ar_verf.oa_base != NULL) { ++ reply_msg.acpted_rply.ar_verf.oa_base != NULL) { + xdrs->x_op = XDR_FREE; + (void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf)); + } +@@ -884,7 +889,7 @@ + + if (rpc_fd_lock(vctbl, ct->ct_fd)) { + rpc_fd_unlock(vctbl, ct->ct_fd); +- return (RPC_FAILED); ++ return (FALSE); + } + + switch (request) { +@@ -905,6 +910,8 @@ + /* LINTED pointer cast */ + ct->ct_blocking_mode: *(int *)info); + ret = (0 == res); ++ } else { ++ ret = FALSE; + } + rpc_fd_unlock(vctbl, ct->ct_fd); + return (ret); +@@ -930,8 +937,7 @@ + /* LINTED pointer alignment */ + ((struct timeval *)info)->tv_sec = ct->ct_wait / 1000; + /* LINTED pointer alignment */ +- ((struct timeval *)info)->tv_usec = +- (ct->ct_wait % 1000) * 1000; ++ ((struct timeval *)info)->tv_usec = (ct->ct_wait % 1000) * 1000; + break; + case CLGET_SERVER_ADDR: /* For compatibility only */ + (void) memcpy(info, ct->ct_addr.buf, (size_t)ct->ct_addr.len); +@@ -960,7 +966,7 @@ + return (FALSE); + } + ret = set_up_connection(ct->ct_fd, (struct netbuf *)info, +- ct, NULL)); ++ ct, NULL); + rpc_fd_unlock(vctbl, ct->ct_fd); + return (ret); + #else +@@ -991,14 +997,14 @@ + */ + /* LINTED pointer alignment */ + *(uint32_t *)info = ntohl(*(uint32_t *)(ct->ct_mcall + +- 4 * BYTES_PER_XDR_UNIT)); ++ 4 * BYTES_PER_XDR_UNIT)); + break; + + case CLSET_VERS: + /* LINTED pointer alignment */ + *(uint32_t *)(ct->ct_mcall + 4 * BYTES_PER_XDR_UNIT) = + /* LINTED pointer alignment */ +- htonl(*(uint32_t *)info); ++ htonl(*(uint32_t *)info); + break; + + case CLGET_PROG: +@@ -1010,29 +1016,29 @@ + */ + /* LINTED pointer alignment */ + *(uint32_t *)info = ntohl(*(uint32_t *)(ct->ct_mcall + +- 3 * BYTES_PER_XDR_UNIT)); ++ 3 * BYTES_PER_XDR_UNIT)); + break; + + case CLSET_PROG: + /* LINTED pointer alignment */ + *(uint32_t *)(ct->ct_mcall + 3 * BYTES_PER_XDR_UNIT) = + /* LINTED pointer alignment */ +- htonl(*(uint32_t *)info); ++ htonl(*(uint32_t *)info); + break; + + case CLSET_IO_MODE: + /* LINTED pointer cast */ + if (!set_io_mode(ct, *(int *)info)) { +- rpc_fd_unlock(vctbl, ct->ct_fd); +- return (FALSE); ++ rpc_fd_unlock(vctbl, ct->ct_fd); ++ return (FALSE); + } + break; + case CLSET_FLUSH_MODE: + /* Set a specific FLUSH_MODE */ + /* LINTED pointer cast */ + if (!set_flush_mode(ct, *(int *)info)) { +- rpc_fd_unlock(vctbl, ct->ct_fd); +- return (FALSE); ++ rpc_fd_unlock(vctbl, ct->ct_fd); ++ return (FALSE); + } + break; + case CLGET_FLUSH_MODE: +@@ -1151,7 +1157,7 @@ + pfdp = thr_get_storage(&pfdp_key, sizeof (struct pollfd), free); + if (pfdp == NULL) { + (void) syslog(LOG_ERR, clnt_vc_errstr, +- clnt_read_vc_str, __no_mem_str); ++ clnt_read_vc_str, __no_mem_str); + rpc_callerr.re_status = RPC_SYSTEMERROR; + rpc_callerr.re_errno = errno; + rpc_callerr.re_terrno = 0; +@@ -1186,12 +1192,12 @@ + /* reallocate pfdp to svc_max_pollfd +1 */ + if (npfd != (svc_max_pollfd + 1)) { + struct pollfd *tmp_pfdp = realloc(pfdp, +- sizeof (struct pollfd) * +- (svc_max_pollfd + 1)); ++ sizeof (struct pollfd) * ++ (svc_max_pollfd + 1)); + if (tmp_pfdp == NULL) { + sig_rw_unlock(&svc_fd_lock); + (void) syslog(LOG_ERR, clnt_vc_errstr, +- clnt_read_vc_str, __no_mem_str); ++ clnt_read_vc_str, __no_mem_str); + rpc_callerr.re_status = RPC_SYSTEMERROR; + rpc_callerr.re_errno = errno; + rpc_callerr.re_terrno = 0; +@@ -1232,13 +1238,12 @@ + continue; + }; + delta = (curtime.tv_sec - +- starttime.tv_sec) * 1000 + +- (curtime.tv_usec - +- starttime.tv_usec) / 1000; ++ starttime.tv_sec) * 1000 + ++ (curtime.tv_usec - ++ starttime.tv_usec) / 1000; + poll_time -= delta; + if (poll_time < 0) { +- rpc_callerr.re_status = +- RPC_TIMEDOUT; ++ rpc_callerr.re_status = RPC_TIMEDOUT; + errno = 0; + return (-1); + } else { +@@ -1352,7 +1357,7 @@ + for (cnt = len, i = 0; cnt > 0; cnt -= i, buf += i) { + flag = cnt > maxsz ? T_MORE : 0; + if ((i = t_snd(ct->ct_fd, buf, (unsigned)MIN(cnt, maxsz), +- flag)) == -1) { ++ flag)) == -1) { + rpc_callerr.re_terrno = t_errno; + rpc_callerr.re_errno = 0; + rpc_callerr.re_status = RPC_CANTSEND; +@@ -1431,7 +1436,7 @@ + time_not_ok(struct timeval *t) + { + return (t->tv_sec <= -1 || t->tv_sec > 100000000 || +- t->tv_usec <= -1 || t->tv_usec > 1000000); ++ t->tv_usec <= -1 || t->tv_usec > 1000000); + } + + +@@ -1746,7 +1751,7 @@ + /* And add the remaining part of the message. */ + if (len != nBytes) { + if (addInBuffer(ct, (char *)buff + len, +- nBytes-len) == -1) { ++ nBytes-len) == -1) { + return (-1); + } + } +Index: libc/usr/src/lib/libnsl/rpc/getdname.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/rpc/getdname.c 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/rpc/getdname.c 2014-05-26 00:04:41.148947410 +0400 +@@ -24,6 +24,9 @@ + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + + /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ + /* All Rights Reserved */ +@@ -33,120 +36,28 @@ + * California. + */ + +-#pragma ident "%Z%%M% %I% %E% SMI" +- + /* + * Gets and sets the domain name of the system + */ + +-#include "mt.h" +-#include "rpc_mt.h" +-#include <stdio.h> +-#include <stdlib.h> +-#include <sys/types.h> +-#include <sys/utsname.h> + #include <sys/systeminfo.h> +-#include <sys/time.h> +-#include <syslog.h> +- +-#ifndef SI_SRPC_DOMAIN +-#define use_file +-#endif +- +-#ifdef use_file +-char DOMAIN[] = "/etc/domain"; +-#endif +- +-int setdomainname(); +- +-#ifdef use_file +-static char *domainname; +-#endif +- +-extern mutex_t dname_lock; + + int +-getdomainname(name, namelen) +- char *name; +- int namelen; ++getdomainname(char *name, int namelen) + { +-#ifdef use_file +- FILE *domain_fd; +- char *line; +- +- (void) mutex_lock(&dname_lock); +- if (domainname) { +- (void) strncpy(name, domainname, namelen); +- (void) mutex_unlock(&dname_lock); +- return (0); +- } +- +- domainname = calloc(1, 256); +- if (domainname == NULL) { +- syslog(LOG_ERR, "getdomainname : out of memory."); +- (void) mutex_unlock(&dname_lock); +- return (-1); +- } +- +- if ((domain_fd = fopen(DOMAIN, "r")) == NULL) { +- +- (void) mutex_unlock(&dname_lock); +- return (-1); +- } +- if (fscanf(domain_fd, "%s", domainname) == NULL) { +- (void) fclose(domain_fd); +- (void) mutex_unlock(&dname_lock); +- return (-1); +- } +- (void) fclose(domain_fd); +- (void) strncpy(name, domainname, namelen); +- (void) mutex_unlock(&dname_lock); +- return (0); +-#else + int sysinfostatus; + + sysinfostatus = sysinfo(SI_SRPC_DOMAIN, name, namelen); + + return ((sysinfostatus < 0) ? -1 : 0); +-#endif + } + + int +-setdomainname(domain, len) +- char *domain; +- int len; ++setdomainname(char *domain, int len) + { +-#ifdef use_file +- +- FILE *domain_fd; +- +- (void) mutex_lock(&dname_lock); +- if (domainname) +- free(domainname); +- +- if ((domain_fd = fopen(DOMAIN, "w")) == NULL) { +- (void) mutex_unlock(&dname_lock); +- return (-1); +- } +- if (fputs(domain, domain_fd) == NULL) { +- (void) mutex_unlock(&dname_lock); +- return (-1); +- } +- (void) fclose(domain_fd); +- domainname = calloc(1, 256); +- if (domainname == NULL) { +- syslog(LOG_ERR, "setdomainname : out of memory."); +- (void) mutex_unlock(&dname_lock); +- return (-1); +- } +- (void) strncpy(domainname, domain, len); +- (void) mutex_unlock(&dname_lock); +- return (0); +-#else + int sysinfostatus; + + sysinfostatus = sysinfo(SI_SET_SRPC_DOMAIN, +- domain, len + 1); /* add null */ ++ domain, len + 1); /* add null */ + return ((sysinfostatus < 0) ? -1 : 0); +-#endif + } +Index: libc/usr/src/lib/libnsl/rpc/netnamer.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/rpc/netnamer.c 2014-03-01 16:18:15.000000000 +0400 ++++ libc/usr/src/lib/libnsl/rpc/netnamer.c 2014-05-26 00:04:41.160833702 +0400 +@@ -23,6 +23,9 @@ + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ + /* All Rights Reserved */ + /* +@@ -429,6 +432,7 @@ + "netname2user: unknown nameservice for publickey" + "info '%s'\n", look->service_name); + err = __NSW_UNAVAIL; ++ res = 0; + } + switch (look->actions[err]) { + case __NSW_CONTINUE : +Index: libc/usr/src/lib/libnsl/rpc/svc_door.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/rpc/svc_door.c 2014-05-11 14:28:41.057213086 +0400 ++++ libc/usr/src/lib/libnsl/rpc/svc_door.c 2014-05-26 00:04:41.173753550 +0400 +@@ -23,6 +23,9 @@ + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ ++/* ++ * Copyright 2014 Nexenta Systems, Inc. All rights reserved. ++ */ + + /* + * svc_door.c, Server side for doors IPC based RPC. +@@ -172,7 +175,7 @@ + return (FALSE); + } + return ((statbuf.st_mode & S_IFMT) == S_IFDIR && +- (statbuf.st_mode & 01777) == 01777); ++ (statbuf.st_mode & 01777) == 01777); + } + + static void +@@ -199,7 +202,7 @@ + } + + if (su->call_info.prognum == r->rq_prog && su->call_info.versnum == +- r->rq_vers) { ++ r->rq_vers) { + (*su->call_info.dispatch)(r, xprt); + return; + } +@@ -210,7 +213,7 @@ + */ + if (su->call_info.prognum == r->rq_prog) + svcerr_progvers(xprt, su->call_info.versnum, +- su->call_info.versnum); ++ su->call_info.versnum); + else + svcerr_noprog(xprt); + } +@@ -246,7 +249,7 @@ + (void) mutex_lock(&svc_door_mutex); + if ((xprt = get_xprt_copy(parent, result_buf)) == NULL) { + (void) syslog(LOG_ERR, +- "door_server: memory allocation failure"); ++ "door_server: memory allocation failure"); + (void) mutex_unlock(&svc_door_mutex); + (void) door_return(NULL, 0, NULL, 0); + /*NOTREACHED*/ +@@ -323,7 +326,7 @@ + + if (!make_tmp_dir()) { + (void) syslog(LOG_ERR, "svc_door_create: cannot open %s", +- RPC_DOOR_DIR); ++ RPC_DOOR_DIR); + (void) mutex_unlock(&svc_door_mutex); + return (NULL); + } +@@ -336,7 +339,7 @@ + svc_flags(xprt) |= SVC_DOOR; + + (void) sprintf(rendezvous, RPC_DOOR_RENDEZVOUS, (int)prognum, +- (int)versnum); ++ (int)versnum); + mask = umask(0); + fd = open(rendezvous, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0644); + (void) umask(mask); +@@ -344,24 +347,24 @@ + if (errno == EEXIST) { + if (unlink(rendezvous) < 0) { + (void) syslog(LOG_ERR, +- "svc_door_create: %s %s:%m", rendezvous, +- "exists and could not be removed"); ++ "svc_door_create: %s %s:%m", rendezvous, ++ "exists and could not be removed"); + goto freedata; + } + mask = umask(0); +- fd = open(rendezvous, O_WRONLY|O_CREAT|O_EXCL| +- O_TRUNC, 0644); ++ fd = open(rendezvous, O_WRONLY | O_CREAT | O_EXCL | ++ O_TRUNC, 0644); + (void) umask(mask); + if (fd < 0) { + (void) syslog(LOG_ERR, +- "svc_door_create: %s %s:%m", +- "could not create", rendezvous); ++ "svc_door_create: %s %s:%m", ++ "could not create", rendezvous); + goto freedata; + } + } else { + (void) syslog(LOG_ERR, +- "svc_door_create: could not create %s:%m", +- rendezvous); ++ "svc_door_create: could not create %s:%m", ++ rendezvous); + goto freedata; + } + } +@@ -369,15 +372,15 @@ + did = door_create(door_server, (void *)xprt, DOOR_REFUSE_DESC); + if (did < 0) { + (void) syslog(LOG_ERR, +- "svc_door_create: door_create failed: %m"); ++ "svc_door_create: door_create failed: %m"); + goto freedata; + } + + if (fattach(did, rendezvous) < 0) { + if (errno != EBUSY || fdetach(rendezvous) < 0 || +- fattach(did, rendezvous) < 0) { ++ fattach(did, rendezvous) < 0) { + (void) syslog(LOG_ERR, +- "svc_door_create: fattach failed: %m"); ++ "svc_door_create: fattach failed: %m"); + goto freedata; + } + } +@@ -555,7 +558,7 @@ + svc_flags(parent) |= SVC_DEFUNCT; + /* LINTED pointer cast */ + if (SVCEXT(parent)->refcnt == 0) +- svc_door_destroy(xprt); ++ svc_door_destroy_pvt(xprt); + } + (void) mutex_unlock(&svc_door_mutex); + return (len); +Index: libc/usr/src/lib/libnsl/rpc/svc_vc.c +=================================================================== +--- libc.orig/usr/src/lib/libnsl/rpc/svc_vc.c 2014-05-11 14:28:41.066829891 +0400 ++++ libc/usr/src/lib/libnsl/rpc/svc_vc.c 2014-05-26 00:04:41.193218822 +0400 +@@ -78,7 +78,6 @@ + extern int __td_setnodelay(int); + extern bool_t __xdrrec_getbytes_nonblock(XDR *, enum xprt_stat *); + extern bool_t __xdrrec_set_conn_nonblock(XDR *, uint32_t); +-extern int _t_do_ioctl(int, char *, int, int, int *); + extern int __rpc_legal_connmaxrec(int); + /* Structure used to initialize SVC_XP_AUTH(xprt).svc_ah_ops. */ + extern struct svc_auth_ops svc_auth_any_ops; +@@ -91,7 +90,6 @@ + static int read_vc(SVCXPRT *, caddr_t, int); + static int write_vc(SVCXPRT *, caddr_t, int); + static SVCXPRT *makefd_xprt(int, uint_t, uint_t, t_scalar_t, char *); +-static bool_t fd_is_dead(int); + static void update_nonblock_timestamps(SVCXPRT *); + + struct cf_rendezvous { /* kept in xprt->xp_p1 for rendezvouser */ +@@ -127,9 +125,6 @@ + extern int __xdrrec_resetfirst(XDR *); + extern int __is_xdrrec_first(XDR *); + +-void __svc_nisplus_enable_timestamps(void); +-void __svc_timeout_nonblock_xprt(void); +- + /* + * This is intended as a performance improvement on the old string handling + * stuff by read only moving data into the text segment. +@@ -156,14 +151,6 @@ + static const char no_nonblock_str[] = "could not set transport non-blocking"; + + /* +- * Records a timestamp when data comes in on a descriptor. This is +- * only used if timestamps are enabled with __svc_nisplus_enable_timestamps(). +- */ +-static long *timestamps; +-static int ntimestamps; /* keep track how many timestamps */ +-static mutex_t timestamp_lock = DEFAULTMUTEX; +- +-/* + * Used to determine whether the time-out logic should be executed. + */ + static bool_t check_nonblock_timestamps = FALSE; +@@ -1193,12 +1180,6 @@ + __xprt_unregister_private(xprt, lock_not_held); + (void) t_close(xprt->xp_fd); + +- (void) mutex_lock(×tamp_lock); +- if (timestamps && xprt->xp_fd < ntimestamps) { +- timestamps[xprt->xp_fd] = 0; +- } +- (void) mutex_unlock(×tamp_lock); +- + if (svc_mt_mode != RPC_SVC_MT_NONE) { + svc_xprt_destroy(xprt); + } else { +@@ -1286,43 +1267,11 @@ + /* + * All read operations timeout after 35 seconds. + * A timeout is fatal for the connection. +- * update_timestamps() is used by nisplus operations, + * update_nonblock_timestamps() is used for nonblocked + * connection fds. + */ + #define WAIT_PER_TRY 35000 /* milliseconds */ + +-static void +-update_timestamps(int fd) +-{ +- (void) mutex_lock(×tamp_lock); +- if (timestamps) { +- struct timeval tv; +- +- (void) gettimeofday(&tv, NULL); +- while (fd >= ntimestamps) { +- long *tmp_timestamps = timestamps; +- +- /* allocate more timestamps */ +- tmp_timestamps = realloc(timestamps, sizeof (long) * +- (ntimestamps + FD_INCREMENT)); +- if (tmp_timestamps == NULL) { +- (void) mutex_unlock(×tamp_lock); +- syslog(LOG_ERR, +- "update_timestamps: out of memory"); +- return; +- } +- +- timestamps = tmp_timestamps; +- (void) memset(×tamps[ntimestamps], 0, +- sizeof (long) * FD_INCREMENT); +- ntimestamps += FD_INCREMENT; +- } +- timestamps[fd] = tv.tv_sec; +- } +- (void) mutex_unlock(×tamp_lock); +-} +- + static void + update_nonblock_timestamps(SVCXPRT *xprt_conn) + { +@@ -1372,7 +1321,6 @@ + */ + if ((len = t_rcvnonblock(xprt, buf, len)) >= 0) { + if (len > 0) { +- update_timestamps(fd); + update_nonblock_timestamps(xprt); + } + return (len); +@@ -1402,7 +1350,6 @@ + } + (void) __xdrrec_resetfirst(xdrs); + if ((len = t_rcvall(fd, buf, len)) > 0) { +- update_timestamps(fd); + return (len); + } + +@@ -1866,142 +1813,6 @@ + } + + /* +- * PRIVATE RPC INTERFACE +- * +- * This is a hack to let NIS+ clean up connections that have already been +- * closed. This problem arises because rpc.nisd forks a child to handle +- * existing connections when it does checkpointing. The child may close +- * some of these connections. But the descriptors still stay open in the +- * parent, and because TLI descriptors don't support persistent EOF +- * condition (like sockets do), the parent will never detect that these +- * descriptors are dead. +- * +- * The following internal procedure __svc_nisplus_fdcleanup_hack() - should +- * be removed as soon as rpc.nisd is rearchitected to do the right thing. +- * This procedure should not find its way into any header files. +- * +- * This procedure should be called only when rpc.nisd knows that there +- * are no children servicing clients. +- */ +- +-static bool_t +-fd_is_dead(int fd) +-{ +- struct T_info_ack inforeq; +- int retval; +- +- inforeq.PRIM_type = T_INFO_REQ; +- if (!_t_do_ioctl(fd, (caddr_t)&inforeq, sizeof (struct T_info_req), +- TI_GETINFO, &retval)) +- return (TRUE); +- if (retval != (int)sizeof (struct T_info_ack)) +- return (TRUE); +- +- switch (inforeq.CURRENT_state) { +- case TS_UNBND: +- case TS_IDLE: +- return (TRUE); +- default: +- break; +- } +- return (FALSE); +-} +- +-void +-__svc_nisplus_fdcleanup_hack(void) +-{ +- SVCXPRT *xprt; +- SVCXPRT *dead_xprt[CLEANUP_SIZE]; +- int i, fd_idx = 0, dead_idx = 0; +- +- if (svc_xports == NULL) +- return; +- for (;;) { +- (void) rw_wrlock(&svc_fd_lock); +- for (dead_idx = 0; fd_idx < svc_max_pollfd; fd_idx++) { +- if ((xprt = svc_xports[fd_idx]) == NULL) +- continue; +-/* LINTED pointer alignment */ +- if (svc_type(xprt) != SVC_CONNECTION) +- continue; +- if (fd_is_dead(fd_idx)) { +- dead_xprt[dead_idx++] = xprt; +- if (dead_idx >= CLEANUP_SIZE) +- break; +- } +- } +- +- for (i = 0; i < dead_idx; i++) { +- /* Still holding svc_fd_lock */ +- _svc_vc_destroy_private(dead_xprt[i], FALSE); +- } +- (void) rw_unlock(&svc_fd_lock); +- if (fd_idx++ >= svc_max_pollfd) +- return; +- } +-} +- +-void +-__svc_nisplus_enable_timestamps(void) +-{ +- (void) mutex_lock(×tamp_lock); +- if (!timestamps) { +- timestamps = calloc(FD_INCREMENT, sizeof (long)); +- if (timestamps != NULL) +- ntimestamps = FD_INCREMENT; +- else { +- (void) mutex_unlock(×tamp_lock); +- syslog(LOG_ERR, "__svc_nisplus_enable_timestamps: " +- "out of memory"); +- return; +- } +- } +- (void) mutex_unlock(×tamp_lock); +-} +- +-void +-__svc_nisplus_purge_since(long since) +-{ +- SVCXPRT *xprt; +- SVCXPRT *dead_xprt[CLEANUP_SIZE]; +- int i, fd_idx = 0, dead_idx = 0; +- +- if (svc_xports == NULL) +- return; +- for (;;) { +- (void) rw_wrlock(&svc_fd_lock); +- (void) mutex_lock(×tamp_lock); +- for (dead_idx = 0; fd_idx < svc_max_pollfd; fd_idx++) { +- if ((xprt = svc_xports[fd_idx]) == NULL) { +- continue; +- } +- /* LINTED pointer cast */ +- if (svc_type(xprt) != SVC_CONNECTION) { +- continue; +- } +- if (fd_idx >= ntimestamps) { +- break; +- } +- if (timestamps[fd_idx] && +- timestamps[fd_idx] < since) { +- dead_xprt[dead_idx++] = xprt; +- if (dead_idx >= CLEANUP_SIZE) +- break; +- } +- } +- (void) mutex_unlock(×tamp_lock); +- +- for (i = 0; i < dead_idx; i++) { +- /* Still holding svc_fd_lock */ +- _svc_vc_destroy_private(dead_xprt[i], FALSE); +- } +- (void) rw_unlock(&svc_fd_lock); +- if (fd_idx++ >= svc_max_pollfd) +- return; +- } +-} +- +-/* + * dup cache wrapper functions for vc requests. The set of dup + * functions were written with the view that they may be expanded + * during creation of a generic svc_vc_enablecache routine diff --git a/libc/debian/patches/series b/libc/debian/patches/series index 8a4040c..90cef81 100644 --- a/libc/debian/patches/series +++ b/libc/debian/patches/series @@ -104,3 +104,4 @@ syslog-LOG_PERROR.patch illumos-4688-getlogin_r.patch libc-pipe.patch libc-accept.patch +libnsl-illumos-updates.patch |