xref: /onnv-gate/usr/src/lib/libnsl/rpc/clnt_perror.c (revision 3864:2ae506652d11)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3864Sraf  * Common Development and Distribution License (the "License").
6*3864Sraf  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
20132Srobinson  */
21132Srobinson 
22132Srobinson /*
23*3864Sraf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
26*3864Sraf 
270Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
280Sstevel@tonic-gate /* All Rights Reserved */
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
310Sstevel@tonic-gate  * 4.3 BSD under license from the Regents of the University of
320Sstevel@tonic-gate  * California.
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  * clnt_perror.c
390Sstevel@tonic-gate  *
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #include "mt.h"
430Sstevel@tonic-gate #include "rpc_mt.h"
440Sstevel@tonic-gate #include <stdio.h>
450Sstevel@tonic-gate #include <libintl.h>
460Sstevel@tonic-gate #include <string.h>
470Sstevel@tonic-gate #include <rpc/types.h>
480Sstevel@tonic-gate #include <rpc/auth.h>
490Sstevel@tonic-gate #include <sys/tiuser.h>
500Sstevel@tonic-gate #include <rpc/clnt.h>
510Sstevel@tonic-gate #include <stdlib.h>
520Sstevel@tonic-gate #include <syslog.h>
530Sstevel@tonic-gate #include <string.h>
540Sstevel@tonic-gate 
550Sstevel@tonic-gate extern char *netdir_sperror();
560Sstevel@tonic-gate 
570Sstevel@tonic-gate const char __nsl_dom[]  = "SUNW_OST_NETRPC";
580Sstevel@tonic-gate 
590Sstevel@tonic-gate #define	ERRBUFSZ	512
600Sstevel@tonic-gate 
610Sstevel@tonic-gate static char *
__buf(void)62132Srobinson __buf(void)
630Sstevel@tonic-gate {
640Sstevel@tonic-gate 	char *buf;
650Sstevel@tonic-gate 	static char buf_main[ERRBUFSZ];
66*3864Sraf 	static pthread_key_t perror_key = PTHREAD_ONCE_KEY_NP;
670Sstevel@tonic-gate 
680Sstevel@tonic-gate 	buf = thr_main()? buf_main :
690Sstevel@tonic-gate 		thr_get_storage(&perror_key, ERRBUFSZ, free);
700Sstevel@tonic-gate 	if (buf == NULL)
710Sstevel@tonic-gate 		syslog(LOG_WARNING,
720Sstevel@tonic-gate 		"clnt_sperror: malloc failed when trying to create buffer\n");
730Sstevel@tonic-gate 	return (buf);
740Sstevel@tonic-gate }
750Sstevel@tonic-gate 
760Sstevel@tonic-gate static char *
auth_errmsg(enum auth_stat stat)77132Srobinson auth_errmsg(enum auth_stat stat)
780Sstevel@tonic-gate {
790Sstevel@tonic-gate 	switch (stat) {
800Sstevel@tonic-gate 	case AUTH_OK:
810Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Authentication OK"));
820Sstevel@tonic-gate 	case AUTH_BADCRED:
830Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Invalid client credential"));
840Sstevel@tonic-gate 	case AUTH_REJECTEDCRED:
850Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Server rejected credential"));
860Sstevel@tonic-gate 	case AUTH_BADVERF:
870Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Invalid client verifier"));
880Sstevel@tonic-gate 	case AUTH_REJECTEDVERF:
890Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Server rejected verifier"));
900Sstevel@tonic-gate 	case AUTH_TOOWEAK:
910Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Client credential too weak"));
920Sstevel@tonic-gate 	case AUTH_INVALIDRESP:
930Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Invalid server verifier"));
940Sstevel@tonic-gate 	case AUTH_FAILED:
950Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Failed (unspecified error)"));
960Sstevel@tonic-gate 
970Sstevel@tonic-gate 	/* kerberos specific */
980Sstevel@tonic-gate 	case AUTH_DECODE:
990Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Could not decode authenticator"));
1000Sstevel@tonic-gate 	case AUTH_TIMEEXPIRE:
1010Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Time of credential expired"));
1020Sstevel@tonic-gate 	case AUTH_TKT_FILE:
1030Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
1040Sstevel@tonic-gate 			"Something wrong with kerberos ticket file"));
1050Sstevel@tonic-gate 	case AUTH_NET_ADDR:
1060Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
1070Sstevel@tonic-gate 		"Incorrect network address in kerberos ticket"));
1080Sstevel@tonic-gate 	case AUTH_KERB_GENERIC:
1090Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "Kerberos generic error"));
1100Sstevel@tonic-gate 	}
1110Sstevel@tonic-gate 	return (dgettext(__nsl_dom, "Unknown authentication error"));
1120Sstevel@tonic-gate }
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate /*
1150Sstevel@tonic-gate  * Return string reply error info. For use after clnt_call()
1160Sstevel@tonic-gate  */
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate #define	REMAINDER	(ERRBUFSZ - (str - strstart))
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate char *
clnt_sperror(const CLIENT * cl,const char * s)121132Srobinson clnt_sperror(const CLIENT *cl, const char *s)
1220Sstevel@tonic-gate {
1230Sstevel@tonic-gate 	struct rpc_err e;
1240Sstevel@tonic-gate 	char *err;
1250Sstevel@tonic-gate 	char *str = __buf();
1260Sstevel@tonic-gate 	char *strstart = str;
1270Sstevel@tonic-gate 
128132Srobinson 	if (str == NULL)
1290Sstevel@tonic-gate 		return (NULL);
1300Sstevel@tonic-gate 	CLNT_GETERR((CLIENT *) cl, &e);
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate 	(void) snprintf(str, ERRBUFSZ, "%s: ", s);
1330Sstevel@tonic-gate 	str += strlcat(str, clnt_sperrno(e.re_status), ERRBUFSZ);
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate 	switch (e.re_status) {
1360Sstevel@tonic-gate 	case RPC_SUCCESS:
1370Sstevel@tonic-gate 	case RPC_CANTENCODEARGS:
1380Sstevel@tonic-gate 	case RPC_CANTDECODERES:
1390Sstevel@tonic-gate 	case RPC_TIMEDOUT:
1400Sstevel@tonic-gate 	case RPC_PROGUNAVAIL:
1410Sstevel@tonic-gate 	case RPC_PROCUNAVAIL:
1420Sstevel@tonic-gate 	case RPC_CANTDECODEARGS:
1430Sstevel@tonic-gate 	case RPC_SYSTEMERROR:
1440Sstevel@tonic-gate 	case RPC_UNKNOWNHOST:
1450Sstevel@tonic-gate 	case RPC_UNKNOWNPROTO:
1460Sstevel@tonic-gate 	case RPC_UNKNOWNADDR:
1470Sstevel@tonic-gate 	case RPC_NOBROADCAST:
1480Sstevel@tonic-gate 	case RPC_RPCBFAILURE:
1490Sstevel@tonic-gate 	case RPC_PROGNOTREGISTERED:
1500Sstevel@tonic-gate 	case RPC_FAILED:
1510Sstevel@tonic-gate 		break;
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate 	case RPC_N2AXLATEFAILURE:
1540Sstevel@tonic-gate 		(void) snprintf(str, REMAINDER, "; %s", netdir_sperror());
1550Sstevel@tonic-gate 		str += strlen(str);
1560Sstevel@tonic-gate 		break;
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate 	case RPC_TLIERROR:
1590Sstevel@tonic-gate 		(void) snprintf(str, REMAINDER, "; %s", t_errlist[e.re_terrno]);
1600Sstevel@tonic-gate 		str += strlen(str);
1610Sstevel@tonic-gate 		if (e.re_errno) {
1620Sstevel@tonic-gate 			(void) snprintf(str, REMAINDER,
1630Sstevel@tonic-gate 			    "; %s", strerror(e.re_errno));
1640Sstevel@tonic-gate 			str += strlen(str);
1650Sstevel@tonic-gate 		}
1660Sstevel@tonic-gate 		break;
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate 	case RPC_CANTSTORE:
1690Sstevel@tonic-gate 	case RPC_CANTSEND:
1700Sstevel@tonic-gate 	case RPC_CANTRECV:
1710Sstevel@tonic-gate 		if (e.re_errno) {
1720Sstevel@tonic-gate 			(void) snprintf(str, REMAINDER, "; errno = %s",
1730Sstevel@tonic-gate 					strerror(e.re_errno));
1740Sstevel@tonic-gate 			str += strlen(str);
1750Sstevel@tonic-gate 		}
1760Sstevel@tonic-gate 		if (e.re_terrno) {
1770Sstevel@tonic-gate 			(void) snprintf(str, REMAINDER,
1780Sstevel@tonic-gate 				"; %s", t_errlist[e.re_terrno]);
1790Sstevel@tonic-gate 			str += strlen(str);
1800Sstevel@tonic-gate 		}
1810Sstevel@tonic-gate 		break;
1820Sstevel@tonic-gate 
1830Sstevel@tonic-gate 	case RPC_VERSMISMATCH:
1840Sstevel@tonic-gate 		(void) snprintf(str, REMAINDER,
1850Sstevel@tonic-gate 				"; low version = %lu, high version = %lu",
1860Sstevel@tonic-gate 				e.re_vers.low, e.re_vers.high);
1870Sstevel@tonic-gate 		str += strlen(str);
1880Sstevel@tonic-gate 		break;
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate 	case RPC_AUTHERROR:
1910Sstevel@tonic-gate 		err = auth_errmsg(e.re_why);
1920Sstevel@tonic-gate 		(void) snprintf(str, REMAINDER, "; why = ");
1930Sstevel@tonic-gate 		str += strlen(str);
1940Sstevel@tonic-gate 		if (err != NULL) {
1950Sstevel@tonic-gate 			(void) snprintf(str, REMAINDER, "%s", err);
1960Sstevel@tonic-gate 		} else {
1970Sstevel@tonic-gate 			(void) snprintf(str, REMAINDER,
1980Sstevel@tonic-gate 				"(unknown authentication error - %d)",
1990Sstevel@tonic-gate 				(int)e.re_why);
2000Sstevel@tonic-gate 		}
2010Sstevel@tonic-gate 		str += strlen(str);
2020Sstevel@tonic-gate 		break;
2030Sstevel@tonic-gate 
2040Sstevel@tonic-gate 	case RPC_PROGVERSMISMATCH:
2050Sstevel@tonic-gate 		(void) snprintf(str, REMAINDER,
2060Sstevel@tonic-gate 				"; low version = %lu, high version = %lu",
2070Sstevel@tonic-gate 				e.re_vers.low, e.re_vers.high);
2080Sstevel@tonic-gate 		str += strlen(str);
2090Sstevel@tonic-gate 		break;
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate 	default:	/* unknown */
2120Sstevel@tonic-gate 		(void) snprintf(str, REMAINDER, "; s1 = %lu, s2 = %lu",
2130Sstevel@tonic-gate 				e.re_lb.s1, e.re_lb.s2);
2140Sstevel@tonic-gate 		str += strlen(str);
2150Sstevel@tonic-gate 		break;
2160Sstevel@tonic-gate 	}
2170Sstevel@tonic-gate 	return (strstart);
2180Sstevel@tonic-gate }
2190Sstevel@tonic-gate #undef	REMAINDER
2200Sstevel@tonic-gate 
2210Sstevel@tonic-gate void
clnt_perror(const CLIENT * cl,const char * s)222132Srobinson clnt_perror(const CLIENT *cl, const char *s)
2230Sstevel@tonic-gate {
2240Sstevel@tonic-gate 	(void) fprintf(stderr, "%s\n", clnt_sperror(cl, s));
2250Sstevel@tonic-gate }
2260Sstevel@tonic-gate 
2270Sstevel@tonic-gate void
clnt_perrno(const enum clnt_stat num)228132Srobinson clnt_perrno(const enum clnt_stat num)
2290Sstevel@tonic-gate {
2300Sstevel@tonic-gate 	(void) fprintf(stderr, "%s\n", clnt_sperrno(num));
2310Sstevel@tonic-gate }
2320Sstevel@tonic-gate 
2330Sstevel@tonic-gate /*
2340Sstevel@tonic-gate  * Why a client handle could not be created
2350Sstevel@tonic-gate  */
2360Sstevel@tonic-gate char *
clnt_spcreateerror(const char * s)237132Srobinson clnt_spcreateerror(const char *s)
2380Sstevel@tonic-gate {
2390Sstevel@tonic-gate 	char *errstr;
2400Sstevel@tonic-gate 	char *str = __buf();
2410Sstevel@tonic-gate 
242132Srobinson 	if (str == NULL)
2430Sstevel@tonic-gate 		return (NULL);
2440Sstevel@tonic-gate 	(void) snprintf(str, ERRBUFSZ, "%s: ", s);
2450Sstevel@tonic-gate 	(void) strlcat(str, clnt_sperrno(rpc_createerr.cf_stat), ERRBUFSZ);
2460Sstevel@tonic-gate 
2470Sstevel@tonic-gate 	switch (rpc_createerr.cf_stat) {
2480Sstevel@tonic-gate 	case RPC_N2AXLATEFAILURE:
2490Sstevel@tonic-gate 		(void) strlcat(str, " - ", ERRBUFSZ);
2500Sstevel@tonic-gate 		(void) strlcat(str, netdir_sperror(), ERRBUFSZ);
2510Sstevel@tonic-gate 		break;
2520Sstevel@tonic-gate 
2530Sstevel@tonic-gate 	case RPC_RPCBFAILURE:
2540Sstevel@tonic-gate 		(void) strlcat(str, " - ", ERRBUFSZ);
2550Sstevel@tonic-gate 		(void) strlcat(str,
2560Sstevel@tonic-gate 			clnt_sperrno(rpc_createerr.cf_error.re_status),
2570Sstevel@tonic-gate 			ERRBUFSZ);
2580Sstevel@tonic-gate 		break;
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate 	case RPC_SYSTEMERROR:
2610Sstevel@tonic-gate 		(void) strlcat(str, " - ", ERRBUFSZ);
2620Sstevel@tonic-gate 		errstr = strerror(rpc_createerr.cf_error.re_errno);
2630Sstevel@tonic-gate 		if (errstr != NULL)
2640Sstevel@tonic-gate 			(void) strlcat(str, errstr, ERRBUFSZ);
2650Sstevel@tonic-gate 		else
2660Sstevel@tonic-gate 			(void) snprintf(&str[strlen(str)],
2670Sstevel@tonic-gate 			    ERRBUFSZ - strlen(str), "Error %d",
2680Sstevel@tonic-gate 			    rpc_createerr.cf_error.re_errno);
2690Sstevel@tonic-gate 		break;
2700Sstevel@tonic-gate 
2710Sstevel@tonic-gate 	case RPC_TLIERROR:
2720Sstevel@tonic-gate 		(void) strlcat(str, " - ", ERRBUFSZ);
2730Sstevel@tonic-gate 		if ((rpc_createerr.cf_error.re_terrno > 0) &&
2740Sstevel@tonic-gate 			(rpc_createerr.cf_error.re_terrno < t_nerr)) {
2750Sstevel@tonic-gate 			(void) strlcat(str,
2760Sstevel@tonic-gate 				t_errlist[rpc_createerr.cf_error.re_terrno],
2770Sstevel@tonic-gate 				ERRBUFSZ);
2780Sstevel@tonic-gate 			if (rpc_createerr.cf_error.re_terrno == TSYSERR) {
2790Sstevel@tonic-gate 				char *err;
2800Sstevel@tonic-gate 				err = strerror(rpc_createerr.cf_error.re_errno);
2810Sstevel@tonic-gate 				if (err) {
282132Srobinson 					(void) strlcat(str, " (", ERRBUFSZ);
283132Srobinson 					(void) strlcat(str, err, ERRBUFSZ);
284132Srobinson 					(void) strlcat(str, ")", ERRBUFSZ);
2850Sstevel@tonic-gate 				}
2860Sstevel@tonic-gate 			}
2870Sstevel@tonic-gate 		} else {
2880Sstevel@tonic-gate 			(void) snprintf(&str[strlen(str)],
2890Sstevel@tonic-gate 			    ERRBUFSZ - strlen(str),
2900Sstevel@tonic-gate 			    dgettext(__nsl_dom,  "TLI Error %d"),
2910Sstevel@tonic-gate 			    rpc_createerr.cf_error.re_terrno);
2920Sstevel@tonic-gate 		}
2930Sstevel@tonic-gate 		errstr = strerror(rpc_createerr.cf_error.re_errno);
2940Sstevel@tonic-gate 		if (errstr != NULL)
2950Sstevel@tonic-gate 			(void) strlcat(str, errstr, ERRBUFSZ);
2960Sstevel@tonic-gate 		else
2970Sstevel@tonic-gate 			(void) snprintf(&str[strlen(str)],
2980Sstevel@tonic-gate 			    ERRBUFSZ - strlen(str), "Error %d",
2990Sstevel@tonic-gate 			    rpc_createerr.cf_error.re_errno);
3000Sstevel@tonic-gate 		break;
3010Sstevel@tonic-gate 
3020Sstevel@tonic-gate 	case RPC_AUTHERROR:
3030Sstevel@tonic-gate 		(void) strlcat(str, " - ", ERRBUFSZ);
3040Sstevel@tonic-gate 		(void) strlcat(str,
3050Sstevel@tonic-gate 			auth_errmsg(rpc_createerr.cf_error.re_why), ERRBUFSZ);
3060Sstevel@tonic-gate 		break;
3070Sstevel@tonic-gate 	}
3080Sstevel@tonic-gate 	return (str);
3090Sstevel@tonic-gate }
3100Sstevel@tonic-gate 
3110Sstevel@tonic-gate void
clnt_pcreateerror(const char * s)312132Srobinson clnt_pcreateerror(const char *s)
3130Sstevel@tonic-gate {
3140Sstevel@tonic-gate 	(void) fprintf(stderr, "%s\n", clnt_spcreateerror(s));
3150Sstevel@tonic-gate }
3160Sstevel@tonic-gate 
3170Sstevel@tonic-gate /*
3180Sstevel@tonic-gate  * This interface for use by rpc_call() and rpc_broadcast()
3190Sstevel@tonic-gate  */
3200Sstevel@tonic-gate const char *
clnt_sperrno(const enum clnt_stat stat)321132Srobinson clnt_sperrno(const enum clnt_stat stat)
3220Sstevel@tonic-gate {
3230Sstevel@tonic-gate 	switch (stat) {
3240Sstevel@tonic-gate 	case RPC_SUCCESS:
3250Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Success"));
3260Sstevel@tonic-gate 	case RPC_CANTENCODEARGS:
3270Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Can't encode arguments"));
3280Sstevel@tonic-gate 	case RPC_CANTDECODERES:
3290Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Can't decode result"));
3300Sstevel@tonic-gate 	case RPC_CANTSTORE:
3310Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Can't store request"));
3320Sstevel@tonic-gate 	case RPC_CANTSEND:
3330Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Unable to send"));
3340Sstevel@tonic-gate 	case RPC_CANTRECV:
3350Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Unable to receive"));
3360Sstevel@tonic-gate 	case RPC_TIMEDOUT:
3370Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Timed out"));
3380Sstevel@tonic-gate 	case RPC_VERSMISMATCH:
3390Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
3400Sstevel@tonic-gate 			"RPC: Incompatible versions of RPC"));
3410Sstevel@tonic-gate 	case RPC_AUTHERROR:
3420Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Authentication error"));
3430Sstevel@tonic-gate 	case RPC_PROGUNAVAIL:
3440Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Program unavailable"));
3450Sstevel@tonic-gate 	case RPC_PROGVERSMISMATCH:
3460Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Program/version mismatch"));
3470Sstevel@tonic-gate 	case RPC_PROCUNAVAIL:
3480Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Procedure unavailable"));
3490Sstevel@tonic-gate 	case RPC_CANTDECODEARGS:
3500Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
3510Sstevel@tonic-gate 			"RPC: Server can't decode arguments"));
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate 	case RPC_SYSTEMERROR:
3540Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Remote system error"));
3550Sstevel@tonic-gate 	case RPC_UNKNOWNHOST:
3560Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Unknown host"));
3570Sstevel@tonic-gate 	case RPC_UNKNOWNPROTO:
3580Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Unknown protocol"));
3590Sstevel@tonic-gate 	case RPC_RPCBFAILURE:
3600Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Rpcbind failure"));
3610Sstevel@tonic-gate 	case RPC_N2AXLATEFAILURE:
3620Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
3630Sstevel@tonic-gate 			"RPC: Name to address translation failed"));
3640Sstevel@tonic-gate 	case RPC_NOBROADCAST:
3650Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Broadcast not supported"));
3660Sstevel@tonic-gate 	case RPC_PROGNOTREGISTERED:
3670Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Program not registered"));
3680Sstevel@tonic-gate 	case RPC_UNKNOWNADDR:
3690Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
3700Sstevel@tonic-gate 			"RPC: Remote server address unknown"));
3710Sstevel@tonic-gate 	case RPC_TLIERROR:
3720Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Miscellaneous tli error"));
3730Sstevel@tonic-gate 	case RPC_FAILED:
3740Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Failed (unspecified error)"));
3750Sstevel@tonic-gate 	case RPC_INPROGRESS:
3760Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: RAC call in progress"));
3770Sstevel@tonic-gate 	case RPC_STALERACHANDLE:
3780Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Stale RAC handle"));
3790Sstevel@tonic-gate 	case RPC_CANTCONNECT:
3800Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Couldn't make connection"));
3810Sstevel@tonic-gate 	case RPC_XPRTFAILED:
3820Sstevel@tonic-gate 		return (dgettext(__nsl_dom,
3830Sstevel@tonic-gate 			"RPC: Received disconnect from remote"));
3840Sstevel@tonic-gate 	case RPC_CANTCREATESTREAM:
3850Sstevel@tonic-gate 		return (dgettext(__nsl_dom, "RPC: Can't push RPC module"));
3860Sstevel@tonic-gate 	}
3870Sstevel@tonic-gate 	return (dgettext(__nsl_dom, "RPC: (unknown error code)"));
3880Sstevel@tonic-gate }
389