xref: /onnv-gate/usr/src/lib/libnsl/yp/yperr_string.c (revision 1219:f89f56c2d9ac)
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
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
21132Srobinson  */
22132Srobinson 
23132Srobinson /*
24*1219Sraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
250Sstevel@tonic-gate  * Use is subject to license terms.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate 
280Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
290Sstevel@tonic-gate /*	  All Rights Reserved   */
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
330Sstevel@tonic-gate  * under license from the Regents of the University of
340Sstevel@tonic-gate  * California.
350Sstevel@tonic-gate  */
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
380Sstevel@tonic-gate 
39*1219Sraf #include "mt.h"
400Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
410Sstevel@tonic-gate #include <sys/types.h>
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
440Sstevel@tonic-gate  * This returns a pointer to an error message string appropriate to an input
450Sstevel@tonic-gate  * yp error code.  An input value of zero will return a success message.
460Sstevel@tonic-gate  * In all cases, the message string will start with a lower case chararacter,
470Sstevel@tonic-gate  * and will be terminated neither by a period (".") nor a newline.
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate char *
yperr_string(int code)51132Srobinson yperr_string(int code)
520Sstevel@tonic-gate {
530Sstevel@tonic-gate 	switch (code) {
54132Srobinson 	case 0:
55132Srobinson 		return ("yp operation succeeded");
56132Srobinson 	case YPERR_BADARGS:
57132Srobinson 		return ("args to yp function are bad");
58132Srobinson 	case YPERR_RPC:
59132Srobinson 		return ("RPC failure on yp operation");
60132Srobinson 	case YPERR_DOMAIN:
61132Srobinson 		return ("can't bind to a server which serves domain");
62132Srobinson 	case YPERR_MAP:
63132Srobinson 		return ("no such map in server's domain");
64132Srobinson 	case YPERR_KEY:
65132Srobinson 		return ("no such key in map");
66132Srobinson 	case YPERR_YPERR:
67132Srobinson 		return ("internal yp server or client error");
68132Srobinson 	case YPERR_RESRC:
69132Srobinson 		return ("local resource allocation failure");
70132Srobinson 	case YPERR_NOMORE:
71132Srobinson 		return ("no more records in map database");
72132Srobinson 	case YPERR_PMAP:
73132Srobinson 		return ("can't communicate with rpcbind");
74132Srobinson 	case YPERR_YPBIND:
75132Srobinson 		return ("can't communicate with ypbind");
76132Srobinson 	case YPERR_YPSERV:
77132Srobinson 		return ("can't communicate with ypserv");
78132Srobinson 	case YPERR_NODOM:
79132Srobinson 		return ("local domain name not set");
80132Srobinson 	case YPERR_BADDB:
81132Srobinson 		return ("yp map data base is bad");
82132Srobinson 	case YPERR_VERS:
83132Srobinson 		return ("yp client/server version mismatch");
84132Srobinson 	case YPERR_ACCESS:
85132Srobinson 		return ("permission denied");
86132Srobinson 	case YPERR_BUSY:
87132Srobinson 		return ("database is busy");
880Sstevel@tonic-gate 	}
89132Srobinson 	return ("unknown yp client error code");
900Sstevel@tonic-gate }
91