17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
2161961e0fSrobinson  */
2261961e0fSrobinson 
2361961e0fSrobinson /*
24*e8031f0aSraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
297c478bd9Sstevel@tonic-gate /*	  All Rights Reserved   */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley
337c478bd9Sstevel@tonic-gate  * under license from the Regents of the University of
347c478bd9Sstevel@tonic-gate  * California.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
387c478bd9Sstevel@tonic-gate 
39*e8031f0aSraf #include "mt.h"
407c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
417c478bd9Sstevel@tonic-gate #include <sys/types.h>
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * This returns a pointer to an error message string appropriate to an input
457c478bd9Sstevel@tonic-gate  * yp error code.  An input value of zero will return a success message.
467c478bd9Sstevel@tonic-gate  * In all cases, the message string will start with a lower case chararacter,
477c478bd9Sstevel@tonic-gate  * and will be terminated neither by a period (".") nor a newline.
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate char *
yperr_string(int code)5161961e0fSrobinson yperr_string(int code)
527c478bd9Sstevel@tonic-gate {
537c478bd9Sstevel@tonic-gate 	switch (code) {
5461961e0fSrobinson 	case 0:
5561961e0fSrobinson 		return ("yp operation succeeded");
5661961e0fSrobinson 	case YPERR_BADARGS:
5761961e0fSrobinson 		return ("args to yp function are bad");
5861961e0fSrobinson 	case YPERR_RPC:
5961961e0fSrobinson 		return ("RPC failure on yp operation");
6061961e0fSrobinson 	case YPERR_DOMAIN:
6161961e0fSrobinson 		return ("can't bind to a server which serves domain");
6261961e0fSrobinson 	case YPERR_MAP:
6361961e0fSrobinson 		return ("no such map in server's domain");
6461961e0fSrobinson 	case YPERR_KEY:
6561961e0fSrobinson 		return ("no such key in map");
6661961e0fSrobinson 	case YPERR_YPERR:
6761961e0fSrobinson 		return ("internal yp server or client error");
6861961e0fSrobinson 	case YPERR_RESRC:
6961961e0fSrobinson 		return ("local resource allocation failure");
7061961e0fSrobinson 	case YPERR_NOMORE:
7161961e0fSrobinson 		return ("no more records in map database");
7261961e0fSrobinson 	case YPERR_PMAP:
7361961e0fSrobinson 		return ("can't communicate with rpcbind");
7461961e0fSrobinson 	case YPERR_YPBIND:
7561961e0fSrobinson 		return ("can't communicate with ypbind");
7661961e0fSrobinson 	case YPERR_YPSERV:
7761961e0fSrobinson 		return ("can't communicate with ypserv");
7861961e0fSrobinson 	case YPERR_NODOM:
7961961e0fSrobinson 		return ("local domain name not set");
8061961e0fSrobinson 	case YPERR_BADDB:
8161961e0fSrobinson 		return ("yp map data base is bad");
8261961e0fSrobinson 	case YPERR_VERS:
8361961e0fSrobinson 		return ("yp client/server version mismatch");
8461961e0fSrobinson 	case YPERR_ACCESS:
8561961e0fSrobinson 		return ("permission denied");
8661961e0fSrobinson 	case YPERR_BUSY:
8761961e0fSrobinson 		return ("database is busy");
8861961e0fSrobinson 	}
8961961e0fSrobinson 	return ("unknown yp client error code");
907c478bd9Sstevel@tonic-gate }
91