diff options
author | Keith M Wesolowski <wesolows@foobazco.org> | 2014-06-18 19:02:37 +0000 |
---|---|---|
committer | Keith M Wesolowski <wesolows@foobazco.org> | 2014-06-18 19:02:37 +0000 |
commit | 6195d87350b0bba6af0ab7a5d38275a20d7b666a (patch) | |
tree | 4b97937eb7cdcb2620ec4e55fe238f7a014b3882 | |
parent | 871a02fc0fcebe44fd4918ed634a1ed1729b3595 (diff) | |
parent | 09b0d01c5bc323b8ee7043100e09aded27cc12ab (diff) | |
download | illumos-joyent-6195d87350b0bba6af0ab7a5d38275a20d7b666a.tar.gz |
[illumos-gate merge]
commit 09b0d01c5bc323b8ee7043100e09aded27cc12ab
3910 t_look(3NSL) should never return T_ERROR
-rw-r--r-- | usr/src/cmd/avs/rdc/sndrd.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/bnu/interface.c | 183 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libnsl/dial/interface.c | 14 | ||||
-rw-r--r-- | usr/src/lib/libnsl/nsl/t_look.c | 24 | ||||
-rw-r--r-- | usr/src/lib/libnsl/nsl/tx.h | 9 | ||||
-rw-r--r-- | usr/src/lib/libnsl/rpc/svc_dg.c | 5 | ||||
-rw-r--r-- | usr/src/uts/common/fs/nfs/nfs_dump.c | 6 | ||||
-rw-r--r-- | usr/src/uts/common/ktli/t_krcvudat.c | 8 | ||||
-rw-r--r-- | usr/src/uts/common/rpc/sec/authdesubr.c | 303 | ||||
-rw-r--r-- | usr/src/uts/common/sys/tiuser.h | 4 |
11 files changed, 281 insertions, 283 deletions
diff --git a/usr/src/cmd/avs/rdc/sndrd.c b/usr/src/cmd/avs/rdc/sndrd.c index f11129478e..aa04f19127 100644 --- a/usr/src/cmd/avs/rdc/sndrd.c +++ b/usr/src/cmd/avs/rdc/sndrd.c @@ -25,6 +25,7 @@ */ /* * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2014 Gary Mills */ /* @@ -1278,9 +1279,8 @@ do_poll_cots_action(int fd, int conn_index) else goto fdclose; - case T_ERROR: default: - if (event == T_ERROR || t_errno == TSYSERR) { + if (t_errno == TSYSERR) { if ((errorstr = strerror(errno)) == NULL) { (void) snprintf(buf, sizeof (buf), "Unknown error num %d", errno); diff --git a/usr/src/cmd/bnu/interface.c b/usr/src/cmd/bnu/interface.c index bf4ca27021..ba1c9f9381 100644 --- a/usr/src/cmd/bnu/interface.c +++ b/usr/src/cmd/bnu/interface.c @@ -20,6 +20,7 @@ * CDDL HEADER END */ /* + * Copyright 2014 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -27,12 +28,11 @@ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" -/* interface( label ) - provide alternate definitions for the I/O functions through global - interfaces. -*/ +/* + * interface(label) + * provide alternate definitions for the I/O functions through global + * interfaces. + */ #include "uucp.h" #ifdef TLI @@ -61,7 +61,7 @@ static int usetup(), uteardown(); GLOBAL ssize_t (*Read)() = read, (*Write)() = write; #if defined(__STDC__) -GLOBAL int (*Ioctl)(int,int,...) = ioctl, +GLOBAL int (*Ioctl)(int, int, ...) = ioctl, #else GLOBAL int (*Ioctl)() = ioctl, #endif @@ -76,30 +76,30 @@ static int tioctl(int, int, ...), #else static int tioctl(), /* TLI i/o control */ #endif - tsetup(), /* TLI setup without streams module */ - tssetup(), /* TLI setup with streams module */ - tteardown(); /* TLI teardown, works with either setup - */ + tsetup(), /* TLI setup without streams module */ + tssetup(), /* TLI setup with streams module */ + tteardown(); /* TLI teardown, works with either setup */ #endif /* TLI */ -/* The IN_label in Interface[] imply different caller routines: - e.g. tlicall(). - If so, the names here and the names in callers.c must match. -*/ +/* + * The IN_label in Interface[] imply different caller routines: + * e.g. tlicall(). + * If so, the names here and the names in callers.c must match. + */ static - struct Interface { +struct Interface { char *IN_label; /* interface name */ ssize_t (*IN_read)(); /* read function */ ssize_t (*IN_write)(); /* write function */ #ifdef __STDC__ - int (*IN_ioctl)(int,int,...); + int (*IN_ioctl)(int, int, ...); #else int (*IN_ioctl)(); /* ioctl function */ #endif - int (*IN_setup)(); /* setup function, called before first - i/o operation */ - int (*IN_teardown)(); /* teardown function, called after last - i/o operation */ + int (*IN_setup)(); /* setup function, called before */ + /* first i/o operation */ + int (*IN_teardown)(); /* teardown function, called after */ + /* last i/o operation */ } Interface[] = { /* vanilla UNIX */ { "UNIX", read, write, ioctl, usetup, uteardown }, @@ -132,7 +132,7 @@ static #endif /* DATAKIT */ #ifdef UNET { "Unetserver", read, write, ioctl, usetup, uteardown }, -#endif +#endif { 0, 0, 0, 0, 0, 0 } }; @@ -143,41 +143,41 @@ char *label; { register int i; - for ( i = 0; Interface[i].IN_label; ++i ) { - if( !strcmp( Interface[i].IN_label, label ) ) { + for (i = 0; Interface[i].IN_label; ++i) { + if (0 == strcmp(Interface[i].IN_label, label)) { Read = Interface[i].IN_read; Write = Interface[i].IN_write; Ioctl = Interface[i].IN_ioctl; Setup = Interface[i].IN_setup; Teardown = Interface[i].IN_teardown; DEBUG(5, "set interface %s\n", label); - return( 0 ); + return (0); } } - return( FAIL ); + return (FAIL); } /* * usetup - vanilla unix setup routine */ static int -usetup( role, fdreadp, fdwritep ) +usetup(role, fdreadp, fdwritep) int *fdreadp, *fdwritep; { - if ( role == SLAVE ) + if (role == SLAVE) { *fdreadp = 0; *fdwritep = 1; /* 2 has been re-opened to RMTDEBUG in main() */ } - return(SUCCESS); + return (SUCCESS); } /* * uteardown - vanilla unix teardown routine */ static int -uteardown( role, fdread, fdwrite ) +uteardown(role, fdread, fdwrite) { int ret; char *ttyn; @@ -195,7 +195,7 @@ uteardown( role, fdread, fdwrite ) (void) close(fdread); (void) close(fdwrite); } - return(SUCCESS); + return (SUCCESS); } #ifdef DATAKIT @@ -206,51 +206,53 @@ uteardown( role, fdread, fdwrite ) */ static int -dksetup (role, fdreadp, fdwritep) +dksetup(role, fdreadp, fdwritep) int role; -int * fdreadp; -int * fdwritep; +int *fdreadp; +int *fdwritep; { static short dkrmode[3] = { DKR_BLOCK | DKR_TIME, 0, 0 }; int ret; (void) usetup(role, fdreadp, fdwritep); - if((ret = (*Ioctl)(*fdreadp, DIOCRMODE, dkrmode)) < 0) { + if ((ret = (*Ioctl)(*fdreadp, DIOCRMODE, dkrmode)) < 0) { DEBUG(4, "dksetup: failed to set block mode. ret=%d,\n", ret); DEBUG(4, "read fd=%d, ", *fdreadp); DEBUG(4, "errno=%d\n", errno); - return(FAIL); + return (FAIL); } - return(SUCCESS); + return (SUCCESS); } /* * dkteardown - DATAKIT teardown routine */ static int -dkteardown( role, fdread, fdwrite ) +dkteardown(role, fdread, fdwrite) int role, fdread, fdwrite; { char *ttyn; - if ( role == MASTER ) { + if (role == MASTER) { ttyn = ttyname(fdread); - if ( ttyn != NULL && Dev_mode != 0 ) + if (ttyn != NULL && Dev_mode != 0) chmod(ttyn, Dev_mode); /* can fail, but who cares? */ } /* must flush fd's for datakit */ /* else close can hang */ - if ( ioctl(fdread, DIOCFLUSH, NULL) != 0 ) - DEBUG(4, "dkteardown: DIOCFLUSH of input fd %d failed", fdread); - if ( ioctl(fdwrite, DIOCFLUSH, NULL) != 0 ) - DEBUG(4, "dkteardown: DIOCFLUSH of output fd %d failed", fdwrite); - - (void)close(fdread); - (void)close(fdwrite); - return(SUCCESS); + if (ioctl(fdread, DIOCFLUSH, NULL) != 0) + DEBUG(4, "dkteardown: DIOCFLUSH of input fd %d failed", + fdread); + if (ioctl(fdwrite, DIOCFLUSH, NULL) != 0) + DEBUG(4, "dkteardown: DIOCFLUSH of output fd %d failed", + fdwrite); + + (void) close(fdread); + (void) close(fdwrite); + return (SUCCESS); } #endif /* DATAKIT */ @@ -267,7 +269,7 @@ unsigned nbytes; { int rcvflags; - return((ssize_t)t_rcv(fd, buf, nbytes, &rcvflags)); + return ((ssize_t)t_rcv(fd, buf, nbytes, &rcvflags)); } /* @@ -284,39 +286,39 @@ unsigned nbytes; static int n_writ, got_info; static struct t_info info; - if ( got_info == 0 ) { - if ( t_getinfo(fd, &info) != 0 ) { + if (got_info == 0) { + if (t_getinfo(fd, &info) != 0) { tfaillog(fd, "twrite: t_getinfo\n"); - return(FAIL); + return (FAIL); } got_info = 1; } /* on every N_CHECKth call, check that are still in DATAXFER state */ - if ( ++n_writ == N_CHECK ) { + if (++n_writ == N_CHECK) { n_writ = 0; - if ( t_getstate(fd) != T_DATAXFER ) - return(FAIL); - } + if (t_getstate(fd) != T_DATAXFER) + return (FAIL); + } - if ( info.tsdu <= 0 || nbytes <= info.tsdu ) - return(t_snd(fd, buf, nbytes, NULL)); + if (info.tsdu <= 0 || nbytes <= info.tsdu) + return (t_snd(fd, buf, nbytes, NULL)); /* if get here, then there is a limit on transmit size */ /* (info.tsdu > 0) and buf exceeds it */ i = ret = 0; - while ( nbytes >= info.tsdu ) { - if ( (ret = t_snd(fd, &buf[i], info.tsdu, NULL)) != info.tsdu ) - return( ( ret >= 0 ? (i + ret) : ret ) ); + while (nbytes >= info.tsdu) { + if ((ret = t_snd(fd, &buf[i], info.tsdu, NULL)) != info.tsdu) + return ((ret >= 0 ? (i + ret) : ret)); i += info.tsdu; nbytes -= info.tsdu; } - if ( nbytes != 0 ) { - if ( (ret = t_snd(fd, &buf[i], nbytes, NULL)) != nbytes ) - return( (ssize_t)( ret >= 0 ? (i + ret) : ret ) ); + if (nbytes != 0) { + if ((ret = t_snd(fd, &buf[i], nbytes, NULL)) != nbytes) + return ((ssize_t)(ret >= 0 ? (i + ret) : ret)); i += nbytes; } - return((ssize_t)i); + return ((ssize_t)i); } @@ -332,7 +334,7 @@ tioctl(fd, request, arg) int fd, request; #endif { - return(SUCCESS); + return (SUCCESS); } /* @@ -340,21 +342,21 @@ int fd, request; * note blatant assumption that *fdreadp == *fdwritep == 0 */ static int -tsetup( role, fdreadp, fdwritep ) +tsetup(role, fdreadp, fdwritep) int *fdreadp, *fdwritep; { - if ( role == SLAVE ) { + if (role == SLAVE) { *fdreadp = 0; *fdwritep = 1; /* 2 has been re-opened to RMTDEBUG in main() */ errno = t_errno = 0; - if ( t_sync(*fdreadp) == -1 || t_sync(*fdwritep) == -1 ) { + if (t_sync(*fdreadp) == -1 || t_sync(*fdwritep) == -1) { tfaillog(*fdreadp, "tsetup: t_sync\n"); - return(FAIL); + return (FAIL); } } - return(SUCCESS); + return (SUCCESS); } /* @@ -362,11 +364,11 @@ int *fdreadp, *fdwritep; */ /*ARGSUSED*/ static int -tteardown( role, fdread, fdwrite ) +tteardown(role, fdread, fdwrite) { - (void)t_unbind(fdread); - (void)t_close(fdread); - return(SUCCESS); + (void) t_unbind(fdread); + (void) t_close(fdread); + return (SUCCESS); } #ifdef TLIS @@ -375,21 +377,21 @@ tteardown( role, fdread, fdwrite ) * note blatant assumption that *fdreadp == *fdwritep */ static int -tssetup( role, fdreadp, fdwritep ) +tssetup(role, fdreadp, fdwritep) int role; int *fdreadp; int *fdwritep; { - if ( role == SLAVE ) { + if (role == SLAVE) { *fdreadp = 0; *fdwritep = 1; /* 2 has been re-opened to RMTDEBUG in main() */ DEBUG(5, "tssetup: SLAVE mode: leaving ok\n%s", ""); - return(SUCCESS); + return (SUCCESS); } DEBUG(4, "tssetup: MASTER mode: leaving ok\n%s", ""); - return(SUCCESS); + return (SUCCESS); } /* @@ -403,13 +405,13 @@ char *s; char fmt[ BUFSIZ ]; if (0 < t_errno && t_errno < t_nerr) { - sprintf( fmt, "%s: %%s\n", s ); + sprintf(fmt, "%s: %%s\n", s); DEBUG(5, fmt, t_errlist[t_errno]); logent(s, t_errlist[t_errno]); - if ( t_errno == TSYSERR ) { + if (t_errno == TSYSERR) { strcpy(fmt, "tlicall: system error: %s\n"); DEBUG(5, fmt, strerror(errno)); - } else if ( t_errno == TLOOK ) { + } else if (t_errno == TLOOK) { show_tlook(fd); } } else { @@ -420,7 +422,6 @@ char *s; sprintf(fmt, "%s: %%s\n", s); DEBUG(5, fmt, strerror(errno)); } - return; } GLOBAL void @@ -434,7 +435,7 @@ int fd; * Find out the current state of the interface. */ errno = t_errno = 0; - switch( reason = t_getstate(fd) ) { + switch (reason = t_getstate(fd)) { case T_UNBND: msg = "T_UNBIND"; break; case T_IDLE: msg = "T_IDLE"; break; case T_OUTCON: msg = "T_OUTCON"; break; @@ -444,11 +445,11 @@ int fd; case T_INREL: msg = "T_INREL"; break; default: msg = NULL; break; } - if( msg == NULL ) + if (msg == NULL) return; DEBUG(5, "state is %s", msg); - switch( reason = t_look(fd) ) { + switch (reason = t_look(fd)) { case -1: msg = ""; break; case 0: msg = "NO ERROR"; break; case T_LISTEN: msg = "T_LISTEN"; break; @@ -457,18 +458,17 @@ int fd; case T_EXDATA: msg = "T_EXDATA"; break; case T_DISCONNECT: msg = "T_DISCONNECT"; break; case T_ORDREL: msg = "T_ORDREL"; break; - case T_ERROR: msg = "T_ERROR"; break; case T_UDERR: msg = "T_UDERR"; break; default: msg = "UNKNOWN ERROR"; break; } DEBUG(4, " reason is %s\n", msg); - if ( reason == T_DISCONNECT ) + if (reason == T_DISCONNECT) { struct t_discon *dropped; - if ( ((dropped = - (struct t_discon *)t_alloc(fd, T_DIS, T_ALL)) == 0) - || (t_rcvdis(fd, dropped) == -1 )) { + if (((dropped = + (struct t_discon *)t_alloc(fd, T_DIS, T_ALL)) == 0) || + (t_rcvdis(fd, dropped) == -1)) { if (dropped) t_free((char *)dropped, T_DIS); return; @@ -476,7 +476,6 @@ int fd; DEBUG(5, "disconnect reason #%d\n", dropped->reason); t_free((char *)dropped, T_DIS); } - return; } #endif /* TLIS */ diff --git a/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c b/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c index 8a7d4d6cd3..de5a9bffed 100644 --- a/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c +++ b/usr/src/cmd/fs.d/nfs/lib/nfs_tbind.c @@ -23,6 +23,7 @@ * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2014 Gary Mills */ @@ -1589,9 +1590,8 @@ printf("do_poll_cots_action(%s,%d): T_DISCONNECT event\n", nconf->nc_proto, fd); else goto fdclose; - case T_ERROR: default: - if (event == T_ERROR || t_errno == TSYSERR) { + if (t_errno == TSYSERR) { if ((errorstr = strerror(errno)) == NULL) { (void) sprintf(buf, "Unknown error num %d", errno); diff --git a/usr/src/lib/libnsl/dial/interface.c b/usr/src/lib/libnsl/dial/interface.c index 0381b9f5ee..09f0a8d55a 100644 --- a/usr/src/lib/libnsl/dial/interface.c +++ b/usr/src/lib/libnsl/dial/interface.c @@ -26,10 +26,9 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2014 Gary Mills */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * interface( label ) * provide alternate definitions for the I/O functions through global @@ -287,10 +286,10 @@ tfaillog(int fd, const char *s) } } else { (void) snprintf(fmt, sizeof (fmt), - "unknown tli error %d", t_errno); + "unknown tli error %d", t_errno); logent(s, fmt); (void) snprintf(fmt, sizeof (fmt), - "%s: unknown tli error %d", s, t_errno); + "%s: unknown tli error %d", s, t_errno); DEBUG(5, fmt, 0); (void) snprintf(fmt, sizeof (fmt), "%s: %%s\n", s); DEBUG(5, fmt, strerror(errno)); @@ -329,7 +328,6 @@ show_tlook(int fd) case T_EXDATA: msg = (const char *)"T_EXDATA"; break; case T_DISCONNECT: msg = (const char *)"T_DISCONNECT"; break; case T_ORDREL: msg = (const char *)"T_ORDREL"; break; - case T_ERROR: msg = (const char *)"T_ERROR"; break; case T_UDERR: msg = (const char *)"T_UDERR"; break; default: msg = (const char *)"UNKNOWN ERROR"; break; } @@ -338,9 +336,9 @@ show_tlook(int fd) if (reason == T_DISCONNECT) { struct t_discon *dropped; if (((dropped = - /* LINTED pointer cast */ - (struct t_discon *)t_alloc(fd, T_DIS, T_ALL)) == 0) || - (t_rcvdis(fd, dropped) == -1)) { + /* LINTED pointer cast */ + (struct t_discon *)t_alloc(fd, T_DIS, T_ALL)) == 0) || + (t_rcvdis(fd, dropped) == -1)) { if (dropped) (void) t_free((char *)dropped, T_DIS); return; diff --git a/usr/src/lib/libnsl/nsl/t_look.c b/usr/src/lib/libnsl/nsl/t_look.c index 91ff5271cf..2a91d3da6b 100644 --- a/usr/src/lib/libnsl/nsl/t_look.c +++ b/usr/src/lib/libnsl/nsl/t_look.c @@ -26,10 +26,9 @@ /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2014 Gary Mills */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "mt.h" #include <errno.h> #include <unistd.h> @@ -133,23 +132,9 @@ _t_look_locked( } while (retval < 0 && errno == EINTR); if (retval < 0) { - if (_T_IS_TLI(api_semantics)) { - /* - * This return of T_ERROR event is ancient - * SVR3 TLI semantics and not documented for - * current SVR4 TLI interface. - * Fixing this will impact some apps - * (e.g. nfsd,lockd) in ON consolidation - * so they need to be fixed first before TLI - * can be fixed. - * XXX Should we never fix this because it might - * break apps in field ? - */ - return (T_ERROR); - } /* - * XTI semantics (also identical to documented, - * but not implemented TLI semantics). + * XTI semantics (also identical to documented + * TLI semantics). */ t_errno = TSYSERR; return (-1); @@ -159,7 +144,8 @@ _t_look_locked( * if something there and cntl part also there */ if ((tiptr->ti_lookcnt > 0) || - ((retval > 0) && (strpeek.ctlbuf.len >= (int)sizeof (t_scalar_t)))) { + ((retval > 0) && (strpeek.ctlbuf.len >= + (int)sizeof (t_scalar_t)))) { /* LINTED pointer cast */ pptr = (union T_primitives *)strpeek.ctlbuf.buf; if (tiptr->ti_lookcnt > 0) { diff --git a/usr/src/lib/libnsl/nsl/tx.h b/usr/src/lib/libnsl/nsl/tx.h index bc0665711b..265e0d33b3 100644 --- a/usr/src/lib/libnsl/nsl/tx.h +++ b/usr/src/lib/libnsl/nsl/tx.h @@ -21,6 +21,7 @@ */ /* + * Copyright 2014 Gary Mills * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -28,8 +29,6 @@ #ifndef _TX_H #define _TX_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/uio.h> #ifdef __cplusplus @@ -251,12 +250,6 @@ extern char tiusr_statetbl[T_NOEVENTS][T_NOSTATES]; #define REMOTENAME 1 /* - * Obsolete error event for t_look() in TLI, still needed for compatibility - * to broken apps that are affected (e.g nfsd,lockd) if real error returned. - */ -#define T_ERROR 0x0020 - -/* * GENERAL UTILITY MACROS */ #define A_CNT(arr) (sizeof (arr)/sizeof (arr[0])) diff --git a/usr/src/lib/libnsl/rpc/svc_dg.c b/usr/src/lib/libnsl/rpc/svc_dg.c index 030a1e52b1..0ecd3819fa 100644 --- a/usr/src/lib/libnsl/rpc/svc_dg.c +++ b/usr/src/lib/libnsl/rpc/svc_dg.c @@ -20,6 +20,7 @@ */ /* + * Copyright 2014 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -384,7 +385,7 @@ again: int lookres; lookres = t_look(xprt->xp_fd); - if ((lookres & T_UDERR) && + if ((lookres == T_UDERR) && (t_rcvuderr(xprt->xp_fd, (struct t_uderr *)0) < 0)) { /*EMPTY*/ @@ -394,7 +395,7 @@ again: t_errno); #endif } - if (lookres & T_DATA) + if (lookres == T_DATA) goto again; } else if ((errno == EINTR) && (t_errno == TSYSERR)) goto again; diff --git a/usr/src/uts/common/fs/nfs/nfs_dump.c b/usr/src/uts/common/fs/nfs/nfs_dump.c index 9b570716d8..f49449fde8 100644 --- a/usr/src/uts/common/fs/nfs/nfs_dump.c +++ b/usr/src/uts/common/fs/nfs/nfs_dump.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2014 Gary Mills * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -369,6 +370,11 @@ nd_get_reply(TIUSER *tiptr, XDR *xdrp, uint32_t call_xid, int *badmsg) nd_log("nfs_dump: calling t_krcvudata\n"); if (error = t_krcvudata(tiptr, &rudata, &type, &uderr)) { + if (error == EBADMSG) { + cmn_err(CE_WARN, "\tnfs_dump: received EBADMSG"); + *badmsg = 1; + return (0); + } nfs_perror(error, "\nnfs_dump: t_krcvudata failed: %m\n"); return (EIO); } diff --git a/usr/src/uts/common/ktli/t_krcvudat.c b/usr/src/uts/common/ktli/t_krcvudat.c index e3be343d3f..b43da9e583 100644 --- a/usr/src/uts/common/ktli/t_krcvudat.c +++ b/usr/src/uts/common/ktli/t_krcvudat.c @@ -19,6 +19,7 @@ * CDDL HEADER END */ /* + * Copyright 2014 Gary Mills * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,8 +37,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Kernel TLI-like function to read a datagram off of a * transport endpoints stream head. @@ -49,7 +48,6 @@ * T_UDERR If an error indication has been received, * in which case uderr contains the unitdata * error number. - * T_ERROR */ #include <sys/param.h> @@ -294,14 +292,14 @@ t_krcvudata(TIUSER *tiptr, struct t_kunitdata *unitdata, int *type, int *uderr) case M_FLUSH: KTLILOG(1, "t_krcvudata: tli_recv returned M_FLUSH\n", 0); freemsg(bp); - *type = T_ERROR; + error = EBADMSG; break; default: KTLILOG(1, "t_krcvudata: unknown message type %x\n", bp->b_datap->db_type); freemsg(bp); - *type = T_ERROR; + error = EBADMSG; break; } diff --git a/usr/src/uts/common/rpc/sec/authdesubr.c b/usr/src/uts/common/rpc/sec/authdesubr.c index 420ccf04dd..b4264b98e4 100644 --- a/usr/src/uts/common/rpc/sec/authdesubr.c +++ b/usr/src/uts/common/rpc/sec/authdesubr.c @@ -20,6 +20,7 @@ * CDDL HEADER END */ /* + * Copyright 2014 Gary Mills * Copyright 2001 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +33,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Miscellaneous support routines for kernel implentation of AUTH_DES */ @@ -111,187 +110,207 @@ again: } if (synconfig->knc_semantics == NC_TPI_CLTS) { - if ((error = t_kalloc(tiptr, T_UNITDATA, T_UDATA|T_ADDR, - (char **)&unitdata)) != 0) { - RPCLOG(1, "rtime: t_kalloc %d\n", error); - (void) t_kclose(tiptr, 1); - return (-1); - } - - unitdata->addr.len = addrp->len; - bcopy(addrp->buf, unitdata->addr.buf, unitdata->addr.len); - - dummy = 0; - unitdata->udata.buf = (caddr_t)&dummy; - unitdata->udata.len = sizeof (dummy); - - if ((error = t_ksndudata(tiptr, unitdata, NULL)) != 0) { - RPCLOG(1, "rtime: t_ksndudata %d\n", error); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void) t_kclose(tiptr, 1); - return (-1); - } - - timo = TIMEVAL_TO_TICK(wait); - - RPCLOG(8, "rtime: timo %x\n", timo); - if ((error = t_kspoll(tiptr, timo, READWAIT, &type)) != 0) { - RPCLOG(1, "rtime: t_kspoll %d\n", error); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void) t_kclose(tiptr, 1); - return (-1); - } - - if (type == 0) { - RPCLOG0(1, "rtime: t_kspoll timed out\n"); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void) t_kclose(tiptr, 1); - return (-1); - } - - error = t_krcvudata(tiptr, unitdata, &type, &uderr); - if (error != 0) { - RPCLOG(1, "rtime: t_krcvudata %d\n", error); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void) t_kclose(tiptr, 1); - return (-1); - } - - if (type == T_UDERR) { - if (bcmp(addrp->buf, unitdata->addr.buf, - unitdata->addr.len) != 0) { - /* - * Response comes from some other - * destination: - * ignore it since it's not related to the - * request we just sent out. - */ - (void) t_kfree(tiptr, (char *)unitdata, - T_UNITDATA); - (void) t_kclose(tiptr, 1); - goto again; - } - } - - if (type != T_DATA) { - RPCLOG(1, "rtime: t_krcvudata returned type %d\n", - type); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void) t_kclose(tiptr, 1); - if (retries-- == 0) - return (-1); - goto again; - } - - if (unitdata->udata.len < sizeof (uint32_t)) { - RPCLOG(1, "rtime: bad rcvd length %d\n", - unitdata->udata.len); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - (void) t_kclose(tiptr, 1); - if (retries-- == 0) - return (-1); - goto again; - } - - /* LINTED pointer alignment */ - thetime = (time_t)ntohl(*(uint32_t *)unitdata->udata.buf); - (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); - - } else { - - if ((error = t_kalloc(tiptr, T_CALL, T_ADDR, - (char **)&server)) != 0) { - RPCLOG(1, "rtime: t_kalloc %d\n", error); - (void) t_kclose(tiptr, 1); - return (-1); - } - - server->addr.len = addrp->len; - bcopy(addrp->buf, server->addr.buf, server->addr.len); - - if ((error = t_kconnect(tiptr, server, NULL)) != 0) { - RPCLOG(1, "rtime: t_kconnect %d\n", error); - (void) t_kfree(tiptr, (char *)server, T_CALL); - (void) t_kclose(tiptr, 1); - return (-1); - } - (void) t_kfree(tiptr, (char *)server, T_CALL); + if ((error = t_kalloc(tiptr, T_UNITDATA, + T_UDATA|T_ADDR, (char **)&unitdata)) != 0) { + RPCLOG(1, "rtime: t_kalloc %d\n", error); + (void) t_kclose(tiptr, 1); + return (-1); + } - timo = TIMEVAL_TO_TICK(wait); + unitdata->addr.len = addrp->len; + bcopy(addrp->buf, unitdata->addr.buf, + unitdata->addr.len); - RPCLOG(8, "rtime: timo %x\n", timo); + dummy = 0; + unitdata->udata.buf = (caddr_t)&dummy; + unitdata->udata.len = sizeof (dummy); - i = 0; - dummy = 0; + if ((error = t_ksndudata(tiptr, unitdata, NULL)) != + 0) { + RPCLOG(1, "rtime: t_ksndudata %d\n", error); + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); + (void) t_kclose(tiptr, 1); + return (-1); + } - /* now read up to 4 bytes from the TIME server */ - while (i < sizeof (dummy)) { + timo = TIMEVAL_TO_TICK(wait); - error = t_kspoll(tiptr, timo, READWAIT, &type); - if (error != 0) { + RPCLOG(8, "rtime: timo %x\n", timo); + if ((error = t_kspoll(tiptr, timo, READWAIT, + &type)) != 0) { RPCLOG(1, "rtime: t_kspoll %d\n", error); + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); (void) t_kclose(tiptr, 1); return (-1); } if (type == 0) { RPCLOG0(1, "rtime: t_kspoll timed out\n"); + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); (void) t_kclose(tiptr, 1); return (-1); } - error = tli_recv(tiptr, &mp, tiptr->fp->f_flag); + error = t_krcvudata(tiptr, unitdata, &type, &uderr); if (error != 0) { - RPCLOG(1, "rtime: tli_recv %d\n", error); + RPCLOG(1, "rtime: t_krcvudata %d\n", error); + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); + (void) t_kclose(tiptr, 1); + if (error == EBADMSG && retries-- > 0) + goto again; + return (-1); + } + + if (type == T_UDERR) { + if (bcmp(addrp->buf, unitdata->addr.buf, + unitdata->addr.len) != 0) { + /* + * Response comes from some other + * destination: + * ignore it since it's not related to the + * request we just sent out. + */ + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); + (void) t_kclose(tiptr, 1); + goto again; + } + } + + if (type != T_DATA) { + RPCLOG(1, + "rtime: t_krcvudata returned type %d\n", + type); + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); + (void) t_kclose(tiptr, 1); + if (retries-- == 0) + return (-1); + goto again; + } + + if (unitdata->udata.len < sizeof (uint32_t)) { + RPCLOG(1, "rtime: bad rcvd length %d\n", + unitdata->udata.len); + (void) t_kfree(tiptr, (char *)unitdata, + T_UNITDATA); + (void) t_kclose(tiptr, 1); + if (retries-- == 0) + return (-1); + goto again; + } + + thetime = (time_t)ntohl( + /* LINTED pointer alignment */ + *(uint32_t *)unitdata->udata.buf); + (void) t_kfree(tiptr, (char *)unitdata, T_UNITDATA); + + } else { + + if ((error = t_kalloc(tiptr, T_CALL, T_ADDR, + (char **)&server)) != 0) { + RPCLOG(1, "rtime: t_kalloc %d\n", error); (void) t_kclose(tiptr, 1); return (-1); } - if (mp->b_datap->db_type != M_DATA) { - RPCLOG(1, "rtime: wrong msg type %d\n", - mp->b_datap->db_type); - RPCLOG(1, "rtime: wrong msg type: read %d" - " bytes\n", i); + server->addr.len = addrp->len; + bcopy(addrp->buf, server->addr.buf, server->addr.len); + + if ((error = t_kconnect(tiptr, server, NULL)) != 0) { + RPCLOG(1, "rtime: t_kconnect %d\n", error); + (void) t_kfree(tiptr, (char *)server, T_CALL); (void) t_kclose(tiptr, 1); - freemsg(mp); return (-1); } + (void) t_kfree(tiptr, (char *)server, T_CALL); + + timo = TIMEVAL_TO_TICK(wait); + + RPCLOG(8, "rtime: timo %x\n", timo); + + i = 0; + dummy = 0; - mp2 = mp; + /* now read up to 4 bytes from the TIME server */ + while (i < sizeof (dummy)) { - /* - * The outer loop iterates until we reach the end of - * the mblk chain. - */ - while (mp2 != NULL) { + error = t_kspoll(tiptr, timo, READWAIT, &type); + if (error != 0) { + RPCLOG(1, "rtime: t_kspoll %d\n", + error); + (void) t_kclose(tiptr, 1); + return (-1); + } + + if (type == 0) { + RPCLOG0(1, + "rtime: t_kspoll timed out\n"); + (void) t_kclose(tiptr, 1); + return (-1); + } + + error = tli_recv(tiptr, &mp, + tiptr->fp->f_flag); + if (error != 0) { + RPCLOG(1, "rtime: tli_recv %d\n", + error); + (void) t_kclose(tiptr, 1); + return (-1); + } + + if (mp->b_datap->db_type != M_DATA) { + RPCLOG(1, "rtime: wrong msg type %d\n", + mp->b_datap->db_type); + RPCLOG(1, + "rtime: wrong msg type: read %d" + " bytes\n", i); + (void) t_kclose(tiptr, 1); + freemsg(mp); + return (-1); + } + + mp2 = mp; /* - * The inner loop iterates until we've gotten - * 4 bytes or until the mblk is exhausted. + * The outer loop iterates until we reach the + * end of the mblk chain. */ - while (i < sizeof (dummy) && - mp2->b_rptr < mp2->b_wptr) { + while (mp2 != NULL) { - i++; + /* + * The inner loop iterates until + * we've gotten 4 bytes or until + * the mblk is exhausted. + */ + while (i < sizeof (dummy) && + mp2->b_rptr < mp2->b_wptr) { + + i++; /* * We avoid big-endian/little-endian * issues by serializing the result * one byte at a time. */ - dummy <<= 8; - dummy += ((*mp2->b_rptr) & 0xFF); + dummy <<= 8; + dummy += ((*mp2->b_rptr) & + 0xFF); - mp2->b_rptr++; - } + mp2->b_rptr++; + } - mp2 = mp2->b_cont; - } + mp2 = mp2->b_cont; + } freemsg(mp); - } + } - thetime = (time_t)dummy; + thetime = (time_t)dummy; } (void) t_kclose(tiptr, 1); diff --git a/usr/src/uts/common/sys/tiuser.h b/usr/src/uts/common/sys/tiuser.h index 5f0645c18b..72762d7210 100644 --- a/usr/src/uts/common/sys/tiuser.h +++ b/usr/src/uts/common/sys/tiuser.h @@ -28,13 +28,12 @@ /* * Copyright 2002 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2014 Gary Mills */ #ifndef _SYS_TIUSER_H #define _SYS_TIUSER_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> /* * The following include file has declarations needed by both the kernel @@ -55,7 +54,6 @@ extern "C" { #define T_DATA 0x0004 /* normal data received */ #define T_EXDATA 0x0008 /* expedited data received */ #define T_DISCONNECT 0x0010 /* disconnect received */ -#define T_ERROR 0x0020 /* fatal error occurred */ #define T_UDERR 0x0040 /* data gram error indication */ #define T_ORDREL 0x0080 /* orderly release indication */ #define T_EVENTS 0x00ff /* event mask */ |