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 
37*e8031f0aSraf #include "mt.h"
387c478bd9Sstevel@tonic-gate #include <rpcsvc/ypclnt.h>
397c478bd9Sstevel@tonic-gate #include <sys/types.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * This returns a pointer to an error message string appropriate to an input
437c478bd9Sstevel@tonic-gate  * yp error code.  An input value of zero will return a success message.
447c478bd9Sstevel@tonic-gate  * In all cases, the message string will start with a lower case chararacter,
457c478bd9Sstevel@tonic-gate  * and will be terminated neither by a period (".") nor a newline.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate char *
yperr_string(int code)4961961e0fSrobinson yperr_string(int code)
507c478bd9Sstevel@tonic-gate {
517c478bd9Sstevel@tonic-gate 	switch (code) {
5261961e0fSrobinson 	case 0:
5361961e0fSrobinson 		return ("yp operation succeeded");
5461961e0fSrobinson 	case YPERR_BADARGS:
5561961e0fSrobinson 		return ("args to yp function are bad");
5661961e0fSrobinson 	case YPERR_RPC:
5761961e0fSrobinson 		return ("RPC failure on yp operation");
5861961e0fSrobinson 	case YPERR_DOMAIN:
5961961e0fSrobinson 		return ("can't bind to a server which serves domain");
6061961e0fSrobinson 	case YPERR_MAP:
6161961e0fSrobinson 		return ("no such map in server's domain");
6261961e0fSrobinson 	case YPERR_KEY:
6361961e0fSrobinson 		return ("no such key in map");
6461961e0fSrobinson 	case YPERR_YPERR:
6561961e0fSrobinson 		return ("internal yp server or client error");
6661961e0fSrobinson 	case YPERR_RESRC:
6761961e0fSrobinson 		return ("local resource allocation failure");
6861961e0fSrobinson 	case YPERR_NOMORE:
6961961e0fSrobinson 		return ("no more records in map database");
7061961e0fSrobinson 	case YPERR_PMAP:
7161961e0fSrobinson 		return ("can't communicate with rpcbind");
7261961e0fSrobinson 	case YPERR_YPBIND:
7361961e0fSrobinson 		return ("can't communicate with ypbind");
7461961e0fSrobinson 	case YPERR_YPSERV:
7561961e0fSrobinson 		return ("can't communicate with ypserv");
7661961e0fSrobinson 	case YPERR_NODOM:
7761961e0fSrobinson 		return ("local domain name not set");
7861961e0fSrobinson 	case YPERR_BADDB:
7961961e0fSrobinson 		return ("yp map data base is bad");
8061961e0fSrobinson 	case YPERR_VERS:
8161961e0fSrobinson 		return ("yp client/server version mismatch");
8261961e0fSrobinson 	case YPERR_ACCESS:
8361961e0fSrobinson 		return ("permission denied");
8461961e0fSrobinson 	case YPERR_BUSY:
8561961e0fSrobinson 		return ("database is busy");
8661961e0fSrobinson 	}
8761961e0fSrobinson 	return ("unknown yp client error code");
887c478bd9Sstevel@tonic-gate }
89