xref: /titanic_50/usr/src/lib/nsswitch/nis/common/switch_err.c (revision b494511a9cf72b1fc4eb13a0e593f55c624ab829)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	switch_err.c
24  *
25  *	Copyright (c) 1988-1992 Sun Microsystems Inc
26  *	All Rights Reserved.
27  */
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <rpcsvc/ypclnt.h>
32 #include <nsswitch.h>
33 
34 /*
35  * maps errors returned by libnsl/yp routines into switch errors
36  */
37 
38 int
39 switch_err(ypclnt_err)
40 	int ypclnt_err;
41 {
42 	int serr;
43 
44 	switch (ypclnt_err) {
45 	case 0:
46 		serr = __NSW_SUCCESS;
47 		break;
48 	case YPERR_BADARGS:
49 	case YPERR_KEY:
50 	case YPERR_NOMORE:
51 		serr = __NSW_NOTFOUND;
52 		break;
53 	case YPERR_RPC:
54 	case YPERR_DOMAIN:
55 	case YPERR_MAP:
56 	case YPERR_YPERR:
57 	case YPERR_RESRC:
58 	case YPERR_PMAP:
59 	case YPERR_YPBIND:
60 	case YPERR_YPSERV:
61 	case YPERR_NODOM:
62 	case YPERR_BADDB:
63 	case YPERR_VERS:
64 	case YPERR_ACCESS:
65 		serr = __NSW_UNAVAIL;
66 		break;
67 	case YPERR_BUSY:
68 		serr = __NSW_TRYAGAIN; /* :-) */
69 	}
70 
71 	return (serr);
72 }
73