1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate *
4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate * with the License.
8*7c478bd9Sstevel@tonic-gate *
9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate *
14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate *
20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1991, 1999 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate * All rights reserved.
25*7c478bd9Sstevel@tonic-gate */
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate #ident "%Z%%M% %I% %E% SMI" /* SunOS */
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
30*7c478bd9Sstevel@tonic-gate #include <sys/errno.h>
31*7c478bd9Sstevel@tonic-gate #include <setjmp.h>
32*7c478bd9Sstevel@tonic-gate #include <string.h>
33*7c478bd9Sstevel@tonic-gate
34*7c478bd9Sstevel@tonic-gate #include <sys/socket.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/sockio.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/tiuser.h>
37*7c478bd9Sstevel@tonic-gate #include <net/if.h>
38*7c478bd9Sstevel@tonic-gate #include <netinet/in_systm.h>
39*7c478bd9Sstevel@tonic-gate #include <netinet/in.h>
40*7c478bd9Sstevel@tonic-gate #include <rpc/types.h>
41*7c478bd9Sstevel@tonic-gate #include <rpc/xdr.h>
42*7c478bd9Sstevel@tonic-gate #include <rpc/auth.h>
43*7c478bd9Sstevel@tonic-gate #include <rpc/clnt.h>
44*7c478bd9Sstevel@tonic-gate #include <rpc/rpc_msg.h>
45*7c478bd9Sstevel@tonic-gate #include <rpcsvc/yp_prot.h>
46*7c478bd9Sstevel@tonic-gate #include "snoop.h"
47*7c478bd9Sstevel@tonic-gate
48*7c478bd9Sstevel@tonic-gate extern char *dlc_header;
49*7c478bd9Sstevel@tonic-gate extern jmp_buf xdr_err;
50*7c478bd9Sstevel@tonic-gate char *ypbind_error();
51*7c478bd9Sstevel@tonic-gate char *sum_ypxfrstat();
52*7c478bd9Sstevel@tonic-gate char *sum_ypmaplist();
53*7c478bd9Sstevel@tonic-gate void detail_ypmaplist();
54*7c478bd9Sstevel@tonic-gate
55*7c478bd9Sstevel@tonic-gate static void niscall(int);
56*7c478bd9Sstevel@tonic-gate static void nisreply(int);
57*7c478bd9Sstevel@tonic-gate static int detail_ypstat(void);
58*7c478bd9Sstevel@tonic-gate static int sum_ypstat(char *);
59*7c478bd9Sstevel@tonic-gate
60*7c478bd9Sstevel@tonic-gate /*
61*7c478bd9Sstevel@tonic-gate * Defines missing from 5.0 yp_prot.h
62*7c478bd9Sstevel@tonic-gate */
63*7c478bd9Sstevel@tonic-gate #define YPBINDPROG ((ulong_t)100007)
64*7c478bd9Sstevel@tonic-gate #define YPBINDVERS ((ulong_t)2)
65*7c478bd9Sstevel@tonic-gate #define YPBINDVERS_ORIG ((ulong_t)1)
66*7c478bd9Sstevel@tonic-gate
67*7c478bd9Sstevel@tonic-gate /* Procedure symbols */
68*7c478bd9Sstevel@tonic-gate
69*7c478bd9Sstevel@tonic-gate #define YPBINDPROC_NULL ((ulong_t)0)
70*7c478bd9Sstevel@tonic-gate #define YPBINDPROC_DOMAIN ((ulong_t)1)
71*7c478bd9Sstevel@tonic-gate #define YPBINDPROC_SETDOM ((ulong_t)2)
72*7c478bd9Sstevel@tonic-gate
73*7c478bd9Sstevel@tonic-gate #define YPBIND_ERR_ERR 1 /* Internal error */
74*7c478bd9Sstevel@tonic-gate #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */
75*7c478bd9Sstevel@tonic-gate #define YPBIND_ERR_RESC 3 /* System resource allocation failure */
76*7c478bd9Sstevel@tonic-gate
77*7c478bd9Sstevel@tonic-gate
78*7c478bd9Sstevel@tonic-gate static char *procnames_bind_short[] = {
79*7c478bd9Sstevel@tonic-gate "NULL", /* 0 */
80*7c478bd9Sstevel@tonic-gate "DOMAIN", /* 1 */
81*7c478bd9Sstevel@tonic-gate "SETDOMAIN", /* 2 */
82*7c478bd9Sstevel@tonic-gate };
83*7c478bd9Sstevel@tonic-gate
84*7c478bd9Sstevel@tonic-gate static char *procnames_bind_long[] = {
85*7c478bd9Sstevel@tonic-gate "Null procedure", /* 0 */
86*7c478bd9Sstevel@tonic-gate "Get domain name", /* 1 */
87*7c478bd9Sstevel@tonic-gate "Set domain name", /* 2 */
88*7c478bd9Sstevel@tonic-gate };
89*7c478bd9Sstevel@tonic-gate
90*7c478bd9Sstevel@tonic-gate static char *procnames_short[] = {
91*7c478bd9Sstevel@tonic-gate "NULL", /* 0 */
92*7c478bd9Sstevel@tonic-gate "DOMAIN", /* 1 */
93*7c478bd9Sstevel@tonic-gate "DOMAIN_NONACK", /* 2 */
94*7c478bd9Sstevel@tonic-gate "MATCH", /* 3 */
95*7c478bd9Sstevel@tonic-gate "FIRST", /* 4 */
96*7c478bd9Sstevel@tonic-gate "NEXT", /* 5 */
97*7c478bd9Sstevel@tonic-gate "XFR", /* 6 */
98*7c478bd9Sstevel@tonic-gate "CLEAR", /* 7 */
99*7c478bd9Sstevel@tonic-gate "ALL", /* 8 */
100*7c478bd9Sstevel@tonic-gate "MASTER", /* 9 */
101*7c478bd9Sstevel@tonic-gate "ORDER", /* 10 */
102*7c478bd9Sstevel@tonic-gate "MAPLIST", /* 11 */
103*7c478bd9Sstevel@tonic-gate "NEWXFR", /* 12 */
104*7c478bd9Sstevel@tonic-gate };
105*7c478bd9Sstevel@tonic-gate
106*7c478bd9Sstevel@tonic-gate #define MAXPROC_BIND 2
107*7c478bd9Sstevel@tonic-gate #define MAXPROC 12
108*7c478bd9Sstevel@tonic-gate
109*7c478bd9Sstevel@tonic-gate static char *procnames_long[] = {
110*7c478bd9Sstevel@tonic-gate "Null procedure", /* 0 */
111*7c478bd9Sstevel@tonic-gate "Verify domain support", /* 1 */
112*7c478bd9Sstevel@tonic-gate "Verify domain support (broadcast)", /* 2 */
113*7c478bd9Sstevel@tonic-gate "Return value of a key", /* 3 */
114*7c478bd9Sstevel@tonic-gate "Return first key-value pair in map", /* 4 */
115*7c478bd9Sstevel@tonic-gate "Return next key-value pair in map", /* 5 */
116*7c478bd9Sstevel@tonic-gate "Request map update (old)", /* 6 */
117*7c478bd9Sstevel@tonic-gate "Close current map on server", /* 7 */
118*7c478bd9Sstevel@tonic-gate "Get all key-value pairs in map", /* 8 */
119*7c478bd9Sstevel@tonic-gate "Get master server", /* 9 */
120*7c478bd9Sstevel@tonic-gate "Get order", /* 10 */
121*7c478bd9Sstevel@tonic-gate "Return list of supported maps", /* 11 */
122*7c478bd9Sstevel@tonic-gate "Request map update", /* 12 */
123*7c478bd9Sstevel@tonic-gate };
124*7c478bd9Sstevel@tonic-gate
125*7c478bd9Sstevel@tonic-gate void
interpret_nisbind(flags,type,xid,vers,proc,data,len)126*7c478bd9Sstevel@tonic-gate interpret_nisbind(flags, type, xid, vers, proc, data, len)
127*7c478bd9Sstevel@tonic-gate int flags, type, xid, vers, proc;
128*7c478bd9Sstevel@tonic-gate char *data;
129*7c478bd9Sstevel@tonic-gate int len;
130*7c478bd9Sstevel@tonic-gate {
131*7c478bd9Sstevel@tonic-gate char *line;
132*7c478bd9Sstevel@tonic-gate char buff[YPMAXDOMAIN + 1];
133*7c478bd9Sstevel@tonic-gate unsigned int status;
134*7c478bd9Sstevel@tonic-gate
135*7c478bd9Sstevel@tonic-gate if (proc < 0 || proc > MAXPROC_BIND)
136*7c478bd9Sstevel@tonic-gate return;
137*7c478bd9Sstevel@tonic-gate
138*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) {
139*7c478bd9Sstevel@tonic-gate if (setjmp(xdr_err)) {
140*7c478bd9Sstevel@tonic-gate return;
141*7c478bd9Sstevel@tonic-gate }
142*7c478bd9Sstevel@tonic-gate
143*7c478bd9Sstevel@tonic-gate line = get_sum_line();
144*7c478bd9Sstevel@tonic-gate
145*7c478bd9Sstevel@tonic-gate if (type == CALL) {
146*7c478bd9Sstevel@tonic-gate (void) sprintf(line,
147*7c478bd9Sstevel@tonic-gate "NISBIND C %s",
148*7c478bd9Sstevel@tonic-gate procnames_bind_short[proc]);
149*7c478bd9Sstevel@tonic-gate line += strlen(line);
150*7c478bd9Sstevel@tonic-gate switch (proc) {
151*7c478bd9Sstevel@tonic-gate case YPBINDPROC_NULL:
152*7c478bd9Sstevel@tonic-gate break;
153*7c478bd9Sstevel@tonic-gate case YPBINDPROC_DOMAIN:
154*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " %s",
155*7c478bd9Sstevel@tonic-gate getxdr_string(buff, YPMAXDOMAIN));
156*7c478bd9Sstevel@tonic-gate break;
157*7c478bd9Sstevel@tonic-gate case YPBINDPROC_SETDOM:
158*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " %s",
159*7c478bd9Sstevel@tonic-gate getxdr_string(buff, YPMAXDOMAIN));
160*7c478bd9Sstevel@tonic-gate break;
161*7c478bd9Sstevel@tonic-gate default:
162*7c478bd9Sstevel@tonic-gate break;
163*7c478bd9Sstevel@tonic-gate }
164*7c478bd9Sstevel@tonic-gate check_retransmit(line, xid);
165*7c478bd9Sstevel@tonic-gate } else {
166*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "NISBIND R %s ",
167*7c478bd9Sstevel@tonic-gate procnames_bind_short[proc]);
168*7c478bd9Sstevel@tonic-gate line += strlen(line);
169*7c478bd9Sstevel@tonic-gate switch (proc) {
170*7c478bd9Sstevel@tonic-gate case YPBINDPROC_NULL:
171*7c478bd9Sstevel@tonic-gate break;
172*7c478bd9Sstevel@tonic-gate case YPBINDPROC_DOMAIN:
173*7c478bd9Sstevel@tonic-gate status = getxdr_long();
174*7c478bd9Sstevel@tonic-gate if (status == 1) { /* success */
175*7c478bd9Sstevel@tonic-gate (void) strcat(line, "OK");
176*7c478bd9Sstevel@tonic-gate } else { /* failure */
177*7c478bd9Sstevel@tonic-gate status = getxdr_long();
178*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "ERROR=%s",
179*7c478bd9Sstevel@tonic-gate ypbind_error(status));
180*7c478bd9Sstevel@tonic-gate }
181*7c478bd9Sstevel@tonic-gate break;
182*7c478bd9Sstevel@tonic-gate case YPBINDPROC_SETDOM:
183*7c478bd9Sstevel@tonic-gate break;
184*7c478bd9Sstevel@tonic-gate default:
185*7c478bd9Sstevel@tonic-gate break;
186*7c478bd9Sstevel@tonic-gate }
187*7c478bd9Sstevel@tonic-gate }
188*7c478bd9Sstevel@tonic-gate }
189*7c478bd9Sstevel@tonic-gate
190*7c478bd9Sstevel@tonic-gate if (flags & F_DTAIL) {
191*7c478bd9Sstevel@tonic-gate show_header("NISBIND:",
192*7c478bd9Sstevel@tonic-gate "Network Information Service Bind", len);
193*7c478bd9Sstevel@tonic-gate show_space();
194*7c478bd9Sstevel@tonic-gate if (setjmp(xdr_err)) {
195*7c478bd9Sstevel@tonic-gate return;
196*7c478bd9Sstevel@tonic-gate }
197*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
198*7c478bd9Sstevel@tonic-gate "Proc = %d (%s)",
199*7c478bd9Sstevel@tonic-gate proc, procnames_bind_long[proc]);
200*7c478bd9Sstevel@tonic-gate if (type == CALL) {
201*7c478bd9Sstevel@tonic-gate switch (proc) {
202*7c478bd9Sstevel@tonic-gate case YPBINDPROC_NULL:
203*7c478bd9Sstevel@tonic-gate break;
204*7c478bd9Sstevel@tonic-gate case YPBINDPROC_DOMAIN:
205*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN,
206*7c478bd9Sstevel@tonic-gate "Domain = %s");
207*7c478bd9Sstevel@tonic-gate break;
208*7c478bd9Sstevel@tonic-gate case YPBINDPROC_SETDOM:
209*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN,
210*7c478bd9Sstevel@tonic-gate "Domain = %s");
211*7c478bd9Sstevel@tonic-gate (void) showxdr_hex(4, "Address=%s");
212*7c478bd9Sstevel@tonic-gate (void) showxdr_hex(2, "Port=%s");
213*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Version=%lu");
214*7c478bd9Sstevel@tonic-gate break;
215*7c478bd9Sstevel@tonic-gate default:
216*7c478bd9Sstevel@tonic-gate break;
217*7c478bd9Sstevel@tonic-gate }
218*7c478bd9Sstevel@tonic-gate } else {
219*7c478bd9Sstevel@tonic-gate switch (proc) {
220*7c478bd9Sstevel@tonic-gate case YPBINDPROC_NULL:
221*7c478bd9Sstevel@tonic-gate break;
222*7c478bd9Sstevel@tonic-gate case YPBINDPROC_DOMAIN:
223*7c478bd9Sstevel@tonic-gate status = getxdr_u_long();
224*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
225*7c478bd9Sstevel@tonic-gate "Status = %lu (%s)",
226*7c478bd9Sstevel@tonic-gate status,
227*7c478bd9Sstevel@tonic-gate status == 1 ? "OK":"Fail");
228*7c478bd9Sstevel@tonic-gate if (status == 1) {
229*7c478bd9Sstevel@tonic-gate (void) showxdr_hex(4,
230*7c478bd9Sstevel@tonic-gate "Address=%s");
231*7c478bd9Sstevel@tonic-gate (void) showxdr_hex(2,
232*7c478bd9Sstevel@tonic-gate "Port=%s");
233*7c478bd9Sstevel@tonic-gate } else {
234*7c478bd9Sstevel@tonic-gate status = getxdr_u_long();
235*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
236*7c478bd9Sstevel@tonic-gate "Error = %lu (%s)",
237*7c478bd9Sstevel@tonic-gate status,
238*7c478bd9Sstevel@tonic-gate ypbind_error(status));
239*7c478bd9Sstevel@tonic-gate }
240*7c478bd9Sstevel@tonic-gate break;
241*7c478bd9Sstevel@tonic-gate case YPBINDPROC_SETDOM:
242*7c478bd9Sstevel@tonic-gate break;
243*7c478bd9Sstevel@tonic-gate default:
244*7c478bd9Sstevel@tonic-gate break;
245*7c478bd9Sstevel@tonic-gate }
246*7c478bd9Sstevel@tonic-gate }
247*7c478bd9Sstevel@tonic-gate show_trailer();
248*7c478bd9Sstevel@tonic-gate }
249*7c478bd9Sstevel@tonic-gate }
250*7c478bd9Sstevel@tonic-gate
251*7c478bd9Sstevel@tonic-gate void
interpret_nis(flags,type,xid,vers,proc,data,len)252*7c478bd9Sstevel@tonic-gate interpret_nis(flags, type, xid, vers, proc, data, len)
253*7c478bd9Sstevel@tonic-gate int flags, type, xid, vers, proc;
254*7c478bd9Sstevel@tonic-gate char *data;
255*7c478bd9Sstevel@tonic-gate int len;
256*7c478bd9Sstevel@tonic-gate {
257*7c478bd9Sstevel@tonic-gate char *line;
258*7c478bd9Sstevel@tonic-gate char *dom, *map, *key;
259*7c478bd9Sstevel@tonic-gate int transid, status;
260*7c478bd9Sstevel@tonic-gate /* buffers are all the same size so we don't have to keep track */
261*7c478bd9Sstevel@tonic-gate char buff1[YPMAXRECORD + 1], buff2[YPMAXRECORD + 1];
262*7c478bd9Sstevel@tonic-gate char buff3[YPMAXRECORD + 1];
263*7c478bd9Sstevel@tonic-gate
264*7c478bd9Sstevel@tonic-gate if (flags & F_SUM) {
265*7c478bd9Sstevel@tonic-gate if (setjmp(xdr_err)) {
266*7c478bd9Sstevel@tonic-gate return;
267*7c478bd9Sstevel@tonic-gate }
268*7c478bd9Sstevel@tonic-gate
269*7c478bd9Sstevel@tonic-gate line = get_sum_line();
270*7c478bd9Sstevel@tonic-gate
271*7c478bd9Sstevel@tonic-gate if (type == CALL) {
272*7c478bd9Sstevel@tonic-gate if (proc > MAXPROC)
273*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "NIS C %d", proc);
274*7c478bd9Sstevel@tonic-gate else
275*7c478bd9Sstevel@tonic-gate (void) sprintf(line,
276*7c478bd9Sstevel@tonic-gate "NIS C %s",
277*7c478bd9Sstevel@tonic-gate procnames_short[proc]);
278*7c478bd9Sstevel@tonic-gate line += strlen(line);
279*7c478bd9Sstevel@tonic-gate switch (proc) {
280*7c478bd9Sstevel@tonic-gate case YPPROC_NULL:
281*7c478bd9Sstevel@tonic-gate break;
282*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN:
283*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN_NONACK:
284*7c478bd9Sstevel@tonic-gate case YPPROC_MAPLIST:
285*7c478bd9Sstevel@tonic-gate /* YPMAXDOMAIN > YPMAXMAP */
286*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " %s",
287*7c478bd9Sstevel@tonic-gate getxdr_string(buff1, YPMAXDOMAIN));
288*7c478bd9Sstevel@tonic-gate break;
289*7c478bd9Sstevel@tonic-gate case YPPROC_FIRST:
290*7c478bd9Sstevel@tonic-gate dom = getxdr_string(buff1, YPMAXDOMAIN);
291*7c478bd9Sstevel@tonic-gate map = getxdr_string(buff2, YPMAXMAP);
292*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " %s", map);
293*7c478bd9Sstevel@tonic-gate break;
294*7c478bd9Sstevel@tonic-gate case YPPROC_MATCH:
295*7c478bd9Sstevel@tonic-gate case YPPROC_NEXT:
296*7c478bd9Sstevel@tonic-gate dom = getxdr_string(buff1, YPMAXDOMAIN);
297*7c478bd9Sstevel@tonic-gate map = getxdr_string(buff2, YPMAXMAP);
298*7c478bd9Sstevel@tonic-gate key = getxdr_string(buff3, YPMAXRECORD);
299*7c478bd9Sstevel@tonic-gate (void) sprintf(line,
300*7c478bd9Sstevel@tonic-gate " %s in %s",
301*7c478bd9Sstevel@tonic-gate key, map);
302*7c478bd9Sstevel@tonic-gate break;
303*7c478bd9Sstevel@tonic-gate case YPPROC_NEWXFR:
304*7c478bd9Sstevel@tonic-gate case YPPROC_XFR:
305*7c478bd9Sstevel@tonic-gate dom = getxdr_string(buff1, YPMAXDOMAIN);
306*7c478bd9Sstevel@tonic-gate map = getxdr_string(buff2, YPMAXMAP);
307*7c478bd9Sstevel@tonic-gate (void) sprintf(line,
308*7c478bd9Sstevel@tonic-gate " map %s in %s",
309*7c478bd9Sstevel@tonic-gate map, dom);
310*7c478bd9Sstevel@tonic-gate break;
311*7c478bd9Sstevel@tonic-gate case YPPROC_CLEAR:
312*7c478bd9Sstevel@tonic-gate break;
313*7c478bd9Sstevel@tonic-gate case YPPROC_ALL:
314*7c478bd9Sstevel@tonic-gate case YPPROC_MASTER:
315*7c478bd9Sstevel@tonic-gate case YPPROC_ORDER:
316*7c478bd9Sstevel@tonic-gate dom = getxdr_string(buff1, YPMAXDOMAIN);
317*7c478bd9Sstevel@tonic-gate map = getxdr_string(buff2, YPMAXMAP);
318*7c478bd9Sstevel@tonic-gate (void) sprintf(line,
319*7c478bd9Sstevel@tonic-gate " map %s in %s",
320*7c478bd9Sstevel@tonic-gate map, dom);
321*7c478bd9Sstevel@tonic-gate break;
322*7c478bd9Sstevel@tonic-gate default:
323*7c478bd9Sstevel@tonic-gate break;
324*7c478bd9Sstevel@tonic-gate }
325*7c478bd9Sstevel@tonic-gate check_retransmit(line, xid);
326*7c478bd9Sstevel@tonic-gate } else {
327*7c478bd9Sstevel@tonic-gate if (proc > MAXPROC)
328*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "NIS R %d ", proc);
329*7c478bd9Sstevel@tonic-gate else
330*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "NIS R %s ",
331*7c478bd9Sstevel@tonic-gate procnames_short[proc]);
332*7c478bd9Sstevel@tonic-gate line += strlen(line);
333*7c478bd9Sstevel@tonic-gate switch (proc) {
334*7c478bd9Sstevel@tonic-gate case YPPROC_NULL:
335*7c478bd9Sstevel@tonic-gate break;
336*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN:
337*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN_NONACK:
338*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "%s",
339*7c478bd9Sstevel@tonic-gate getxdr_long() ? "OK":"Fail");
340*7c478bd9Sstevel@tonic-gate break;
341*7c478bd9Sstevel@tonic-gate case YPPROC_MATCH:
342*7c478bd9Sstevel@tonic-gate (void) sum_ypstat(line);
343*7c478bd9Sstevel@tonic-gate break;
344*7c478bd9Sstevel@tonic-gate case YPPROC_FIRST:
345*7c478bd9Sstevel@tonic-gate case YPPROC_NEXT:
346*7c478bd9Sstevel@tonic-gate if (sum_ypstat(line) == YP_TRUE) {
347*7c478bd9Sstevel@tonic-gate line += strlen(line);
348*7c478bd9Sstevel@tonic-gate (void) getxdr_string(buff1,
349*7c478bd9Sstevel@tonic-gate YPMAXRECORD);
350*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " key=%s",
351*7c478bd9Sstevel@tonic-gate getxdr_string(buff1,
352*7c478bd9Sstevel@tonic-gate YPMAXRECORD));
353*7c478bd9Sstevel@tonic-gate }
354*7c478bd9Sstevel@tonic-gate break;
355*7c478bd9Sstevel@tonic-gate case YPPROC_NEWXFR:
356*7c478bd9Sstevel@tonic-gate case YPPROC_XFR:
357*7c478bd9Sstevel@tonic-gate transid = getxdr_u_long();
358*7c478bd9Sstevel@tonic-gate status = getxdr_long();
359*7c478bd9Sstevel@tonic-gate (void) sprintf(line, "transid=%lu %s",
360*7c478bd9Sstevel@tonic-gate transid,
361*7c478bd9Sstevel@tonic-gate sum_ypxfrstat(status));
362*7c478bd9Sstevel@tonic-gate break;
363*7c478bd9Sstevel@tonic-gate case YPPROC_CLEAR:
364*7c478bd9Sstevel@tonic-gate break;
365*7c478bd9Sstevel@tonic-gate case YPPROC_ALL:
366*7c478bd9Sstevel@tonic-gate if (getxdr_u_long()) {
367*7c478bd9Sstevel@tonic-gate (void) sum_ypstat(line);
368*7c478bd9Sstevel@tonic-gate line += strlen(line);
369*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " key=%s",
370*7c478bd9Sstevel@tonic-gate getxdr_string(buff1, YPMAXRECORD));
371*7c478bd9Sstevel@tonic-gate } else {
372*7c478bd9Sstevel@tonic-gate (void) sprintf(line,
373*7c478bd9Sstevel@tonic-gate "No more");
374*7c478bd9Sstevel@tonic-gate }
375*7c478bd9Sstevel@tonic-gate break;
376*7c478bd9Sstevel@tonic-gate case YPPROC_MASTER:
377*7c478bd9Sstevel@tonic-gate if (sum_ypstat(line) == YP_TRUE) {
378*7c478bd9Sstevel@tonic-gate line += strlen(line);
379*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " peer=%s",
380*7c478bd9Sstevel@tonic-gate getxdr_string(buff1,
381*7c478bd9Sstevel@tonic-gate YPMAXPEER));
382*7c478bd9Sstevel@tonic-gate }
383*7c478bd9Sstevel@tonic-gate break;
384*7c478bd9Sstevel@tonic-gate case YPPROC_ORDER:
385*7c478bd9Sstevel@tonic-gate if (sum_ypstat(line) == YP_TRUE) {
386*7c478bd9Sstevel@tonic-gate line += strlen(line);
387*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " order=%lu",
388*7c478bd9Sstevel@tonic-gate getxdr_u_long());
389*7c478bd9Sstevel@tonic-gate }
390*7c478bd9Sstevel@tonic-gate break;
391*7c478bd9Sstevel@tonic-gate case YPPROC_MAPLIST:
392*7c478bd9Sstevel@tonic-gate if (sum_ypstat(line) == YP_TRUE) {
393*7c478bd9Sstevel@tonic-gate line += strlen(line);
394*7c478bd9Sstevel@tonic-gate (void) sprintf(line, " %s",
395*7c478bd9Sstevel@tonic-gate sum_ypmaplist());
396*7c478bd9Sstevel@tonic-gate }
397*7c478bd9Sstevel@tonic-gate break;
398*7c478bd9Sstevel@tonic-gate default:
399*7c478bd9Sstevel@tonic-gate break;
400*7c478bd9Sstevel@tonic-gate }
401*7c478bd9Sstevel@tonic-gate }
402*7c478bd9Sstevel@tonic-gate }
403*7c478bd9Sstevel@tonic-gate
404*7c478bd9Sstevel@tonic-gate if (flags & F_DTAIL) {
405*7c478bd9Sstevel@tonic-gate show_header("NIS: ", "Network Information Service", len);
406*7c478bd9Sstevel@tonic-gate show_space();
407*7c478bd9Sstevel@tonic-gate if (setjmp(xdr_err)) {
408*7c478bd9Sstevel@tonic-gate return;
409*7c478bd9Sstevel@tonic-gate }
410*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
411*7c478bd9Sstevel@tonic-gate "Proc = %d (%s)",
412*7c478bd9Sstevel@tonic-gate proc,
413*7c478bd9Sstevel@tonic-gate proc > MAXPROC ? "unknown" : procnames_long[proc]);
414*7c478bd9Sstevel@tonic-gate if (type == CALL)
415*7c478bd9Sstevel@tonic-gate niscall(proc);
416*7c478bd9Sstevel@tonic-gate else
417*7c478bd9Sstevel@tonic-gate nisreply(proc);
418*7c478bd9Sstevel@tonic-gate show_trailer();
419*7c478bd9Sstevel@tonic-gate }
420*7c478bd9Sstevel@tonic-gate }
421*7c478bd9Sstevel@tonic-gate
422*7c478bd9Sstevel@tonic-gate /*
423*7c478bd9Sstevel@tonic-gate * Print out version 2 NIS call packets
424*7c478bd9Sstevel@tonic-gate */
425*7c478bd9Sstevel@tonic-gate
426*7c478bd9Sstevel@tonic-gate static void
niscall(proc)427*7c478bd9Sstevel@tonic-gate niscall(proc)
428*7c478bd9Sstevel@tonic-gate int proc;
429*7c478bd9Sstevel@tonic-gate {
430*7c478bd9Sstevel@tonic-gate switch (proc) {
431*7c478bd9Sstevel@tonic-gate case YPPROC_NULL:
432*7c478bd9Sstevel@tonic-gate break;
433*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN:
434*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN_NONACK:
435*7c478bd9Sstevel@tonic-gate case YPPROC_MAPLIST:
436*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN, "Domain = %s");
437*7c478bd9Sstevel@tonic-gate break;
438*7c478bd9Sstevel@tonic-gate case YPPROC_FIRST:
439*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN, "Domain = %s");
440*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXMAP, "Map = %s");
441*7c478bd9Sstevel@tonic-gate break;
442*7c478bd9Sstevel@tonic-gate case YPPROC_MATCH:
443*7c478bd9Sstevel@tonic-gate case YPPROC_NEXT:
444*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN, "Domain = %s");
445*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXMAP, "Map = %s");
446*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXRECORD, "Key = %s");
447*7c478bd9Sstevel@tonic-gate break;
448*7c478bd9Sstevel@tonic-gate case YPPROC_NEWXFR:
449*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN, "Domain = %s");
450*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXMAP, "Map = %s");
451*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Order = %lu");
452*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXPEER, "Peer = %s");
453*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Transid = %lu");
454*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Prog = %lu");
455*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXPEER, "Name = %s");
456*7c478bd9Sstevel@tonic-gate break;
457*7c478bd9Sstevel@tonic-gate case YPPROC_XFR:
458*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN, "Domain = %s");
459*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXMAP, "Map = %s");
460*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Order = %lu");
461*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXPEER, "Peer = %s");
462*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Transid = %lu");
463*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Prog = %lu");
464*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Port = %lu");
465*7c478bd9Sstevel@tonic-gate break;
466*7c478bd9Sstevel@tonic-gate case YPPROC_CLEAR:
467*7c478bd9Sstevel@tonic-gate break;
468*7c478bd9Sstevel@tonic-gate case YPPROC_ALL:
469*7c478bd9Sstevel@tonic-gate case YPPROC_MASTER:
470*7c478bd9Sstevel@tonic-gate case YPPROC_ORDER:
471*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXDOMAIN, "Domain = %s");
472*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXMAP, "Map = %s");
473*7c478bd9Sstevel@tonic-gate break;
474*7c478bd9Sstevel@tonic-gate default:
475*7c478bd9Sstevel@tonic-gate break;
476*7c478bd9Sstevel@tonic-gate }
477*7c478bd9Sstevel@tonic-gate }
478*7c478bd9Sstevel@tonic-gate
479*7c478bd9Sstevel@tonic-gate /*
480*7c478bd9Sstevel@tonic-gate * Print out version 2 NIS reply packets
481*7c478bd9Sstevel@tonic-gate */
482*7c478bd9Sstevel@tonic-gate
483*7c478bd9Sstevel@tonic-gate void
nisreply(proc)484*7c478bd9Sstevel@tonic-gate nisreply(proc)
485*7c478bd9Sstevel@tonic-gate int proc;
486*7c478bd9Sstevel@tonic-gate {
487*7c478bd9Sstevel@tonic-gate unsigned int xfrstat, more;
488*7c478bd9Sstevel@tonic-gate
489*7c478bd9Sstevel@tonic-gate switch (proc) {
490*7c478bd9Sstevel@tonic-gate case YPPROC_NULL:
491*7c478bd9Sstevel@tonic-gate break;
492*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN:
493*7c478bd9Sstevel@tonic-gate case YPPROC_DOMAIN_NONACK:
494*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
495*7c478bd9Sstevel@tonic-gate "Result=%s",
496*7c478bd9Sstevel@tonic-gate getxdr_u_long() ? "OK":"Fail");
497*7c478bd9Sstevel@tonic-gate break;
498*7c478bd9Sstevel@tonic-gate case YPPROC_MATCH:
499*7c478bd9Sstevel@tonic-gate (void) detail_ypstat();
500*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXRECORD, "Value = %s");
501*7c478bd9Sstevel@tonic-gate break;
502*7c478bd9Sstevel@tonic-gate case YPPROC_FIRST:
503*7c478bd9Sstevel@tonic-gate case YPPROC_NEXT:
504*7c478bd9Sstevel@tonic-gate (void) detail_ypstat();
505*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXRECORD, "Value = %s");
506*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXRECORD, "Key = %s");
507*7c478bd9Sstevel@tonic-gate break;
508*7c478bd9Sstevel@tonic-gate case YPPROC_NEWXFR:
509*7c478bd9Sstevel@tonic-gate case YPPROC_XFR:
510*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Transid = %lu");
511*7c478bd9Sstevel@tonic-gate xfrstat = getxdr_u_long();
512*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
513*7c478bd9Sstevel@tonic-gate "Transfer status = %lu (%s)",
514*7c478bd9Sstevel@tonic-gate xfrstat, sum_ypxfrstat(xfrstat));
515*7c478bd9Sstevel@tonic-gate break;
516*7c478bd9Sstevel@tonic-gate case YPPROC_CLEAR:
517*7c478bd9Sstevel@tonic-gate break;
518*7c478bd9Sstevel@tonic-gate case YPPROC_ALL:
519*7c478bd9Sstevel@tonic-gate more = getxdr_u_long();
520*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
521*7c478bd9Sstevel@tonic-gate "More = %s",
522*7c478bd9Sstevel@tonic-gate more ? "true" : "false");
523*7c478bd9Sstevel@tonic-gate if (more) {
524*7c478bd9Sstevel@tonic-gate (void) detail_ypstat();
525*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXRECORD, "Value = %s");
526*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXRECORD, "Key = %s");
527*7c478bd9Sstevel@tonic-gate }
528*7c478bd9Sstevel@tonic-gate break;
529*7c478bd9Sstevel@tonic-gate case YPPROC_MASTER:
530*7c478bd9Sstevel@tonic-gate (void) detail_ypstat();
531*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXPEER, "Peer = %s");
532*7c478bd9Sstevel@tonic-gate case YPPROC_ORDER:
533*7c478bd9Sstevel@tonic-gate (void) detail_ypstat();
534*7c478bd9Sstevel@tonic-gate (void) showxdr_u_long("Order=%lu");
535*7c478bd9Sstevel@tonic-gate break;
536*7c478bd9Sstevel@tonic-gate case YPPROC_MAPLIST:
537*7c478bd9Sstevel@tonic-gate (void) detail_ypstat();
538*7c478bd9Sstevel@tonic-gate detail_ypmaplist();
539*7c478bd9Sstevel@tonic-gate break;
540*7c478bd9Sstevel@tonic-gate default:
541*7c478bd9Sstevel@tonic-gate break;
542*7c478bd9Sstevel@tonic-gate }
543*7c478bd9Sstevel@tonic-gate }
544*7c478bd9Sstevel@tonic-gate
545*7c478bd9Sstevel@tonic-gate char *
sum_ypxfrstat(status)546*7c478bd9Sstevel@tonic-gate sum_ypxfrstat(status)
547*7c478bd9Sstevel@tonic-gate int status;
548*7c478bd9Sstevel@tonic-gate {
549*7c478bd9Sstevel@tonic-gate static char buff [16];
550*7c478bd9Sstevel@tonic-gate
551*7c478bd9Sstevel@tonic-gate switch (status) {
552*7c478bd9Sstevel@tonic-gate case 1: return ("Success");
553*7c478bd9Sstevel@tonic-gate case 2: return ("Master's version not newer");
554*7c478bd9Sstevel@tonic-gate case -1: return ("Can't find server for map");
555*7c478bd9Sstevel@tonic-gate case -2: return ("No such domain");
556*7c478bd9Sstevel@tonic-gate case -3: return ("Resource allocation failure");
557*7c478bd9Sstevel@tonic-gate case -4: return ("RPC failure talking to server");
558*7c478bd9Sstevel@tonic-gate case -5: return ("Can't get master address");
559*7c478bd9Sstevel@tonic-gate case -6: return ("NIS server/map db error");
560*7c478bd9Sstevel@tonic-gate case -7: return ("Bad arguments");
561*7c478bd9Sstevel@tonic-gate case -8: return ("Local dbm operation failed");
562*7c478bd9Sstevel@tonic-gate case -9: return ("Local file I/O operation failed");
563*7c478bd9Sstevel@tonic-gate case -10: return ("Map version skew during transfer");
564*7c478bd9Sstevel@tonic-gate case -11: return ("Can't send clear req to local ypserv");
565*7c478bd9Sstevel@tonic-gate case -12: return ("No local order number in map");
566*7c478bd9Sstevel@tonic-gate case -13: return ("Transfer error");
567*7c478bd9Sstevel@tonic-gate case -14: return ("Transfer request refused");
568*7c478bd9Sstevel@tonic-gate default:
569*7c478bd9Sstevel@tonic-gate (void) sprintf(buff, "(%d)", status);
570*7c478bd9Sstevel@tonic-gate return (buff);
571*7c478bd9Sstevel@tonic-gate }
572*7c478bd9Sstevel@tonic-gate /* NOTREACHED */
573*7c478bd9Sstevel@tonic-gate }
574*7c478bd9Sstevel@tonic-gate
575*7c478bd9Sstevel@tonic-gate static int
sum_ypstat(line)576*7c478bd9Sstevel@tonic-gate sum_ypstat(line)
577*7c478bd9Sstevel@tonic-gate char *line;
578*7c478bd9Sstevel@tonic-gate {
579*7c478bd9Sstevel@tonic-gate ulong_t status;
580*7c478bd9Sstevel@tonic-gate char *str;
581*7c478bd9Sstevel@tonic-gate char buff[16];
582*7c478bd9Sstevel@tonic-gate
583*7c478bd9Sstevel@tonic-gate status = getxdr_u_long();
584*7c478bd9Sstevel@tonic-gate switch (status) {
585*7c478bd9Sstevel@tonic-gate case YP_TRUE: str = "OK"; break;
586*7c478bd9Sstevel@tonic-gate case YP_NOMORE: str = "No more entries"; break;
587*7c478bd9Sstevel@tonic-gate case YP_FALSE: str = "Fail"; break;
588*7c478bd9Sstevel@tonic-gate case YP_NOMAP: str = "No such map"; break;
589*7c478bd9Sstevel@tonic-gate case YP_NODOM: str = "No such domain"; break;
590*7c478bd9Sstevel@tonic-gate case YP_NOKEY: str = "No such key"; break;
591*7c478bd9Sstevel@tonic-gate case YP_BADOP: str = "Invalid operation"; break;
592*7c478bd9Sstevel@tonic-gate case YP_BADDB: str = "Bad database"; break;
593*7c478bd9Sstevel@tonic-gate case YP_YPERR: str = "Server error"; break;
594*7c478bd9Sstevel@tonic-gate case YP_BADARGS:str = "Bad args"; break;
595*7c478bd9Sstevel@tonic-gate case YP_VERS: str = "Version mismatch"; break;
596*7c478bd9Sstevel@tonic-gate default: (void) sprintf(buff, "(%lu)", status);
597*7c478bd9Sstevel@tonic-gate str = buff;
598*7c478bd9Sstevel@tonic-gate break;
599*7c478bd9Sstevel@tonic-gate }
600*7c478bd9Sstevel@tonic-gate (void) strcpy(line, str);
601*7c478bd9Sstevel@tonic-gate return ((int)status);
602*7c478bd9Sstevel@tonic-gate }
603*7c478bd9Sstevel@tonic-gate
604*7c478bd9Sstevel@tonic-gate static int
detail_ypstat()605*7c478bd9Sstevel@tonic-gate detail_ypstat()
606*7c478bd9Sstevel@tonic-gate {
607*7c478bd9Sstevel@tonic-gate ulong_t status;
608*7c478bd9Sstevel@tonic-gate char buff[32];
609*7c478bd9Sstevel@tonic-gate
610*7c478bd9Sstevel@tonic-gate
611*7c478bd9Sstevel@tonic-gate status = sum_ypstat(buff);
612*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
613*7c478bd9Sstevel@tonic-gate "Status = %d (%s)",
614*7c478bd9Sstevel@tonic-gate status, buff);
615*7c478bd9Sstevel@tonic-gate
616*7c478bd9Sstevel@tonic-gate return ((int)status);
617*7c478bd9Sstevel@tonic-gate }
618*7c478bd9Sstevel@tonic-gate
619*7c478bd9Sstevel@tonic-gate char *
sum_ypmaplist()620*7c478bd9Sstevel@tonic-gate sum_ypmaplist()
621*7c478bd9Sstevel@tonic-gate {
622*7c478bd9Sstevel@tonic-gate static char buff[YPMAXMAP + 1];
623*7c478bd9Sstevel@tonic-gate int maps = 0;
624*7c478bd9Sstevel@tonic-gate
625*7c478bd9Sstevel@tonic-gate if (setjmp(xdr_err)) {
626*7c478bd9Sstevel@tonic-gate (void) sprintf(buff, "%d+ maps", maps);
627*7c478bd9Sstevel@tonic-gate return (buff);
628*7c478bd9Sstevel@tonic-gate }
629*7c478bd9Sstevel@tonic-gate
630*7c478bd9Sstevel@tonic-gate while (getxdr_long()) {
631*7c478bd9Sstevel@tonic-gate (void) getxdr_string(buff, YPMAXMAP);
632*7c478bd9Sstevel@tonic-gate maps++;
633*7c478bd9Sstevel@tonic-gate }
634*7c478bd9Sstevel@tonic-gate
635*7c478bd9Sstevel@tonic-gate (void) sprintf(buff, "%d maps", maps);
636*7c478bd9Sstevel@tonic-gate return (buff);
637*7c478bd9Sstevel@tonic-gate }
638*7c478bd9Sstevel@tonic-gate
639*7c478bd9Sstevel@tonic-gate void
detail_ypmaplist()640*7c478bd9Sstevel@tonic-gate detail_ypmaplist()
641*7c478bd9Sstevel@tonic-gate {
642*7c478bd9Sstevel@tonic-gate int maps = 0;
643*7c478bd9Sstevel@tonic-gate
644*7c478bd9Sstevel@tonic-gate if (setjmp(xdr_err)) {
645*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0),
646*7c478bd9Sstevel@tonic-gate " %d+ maps. (Frame is incomplete)",
647*7c478bd9Sstevel@tonic-gate maps);
648*7c478bd9Sstevel@tonic-gate return;
649*7c478bd9Sstevel@tonic-gate }
650*7c478bd9Sstevel@tonic-gate
651*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "Map list");
652*7c478bd9Sstevel@tonic-gate
653*7c478bd9Sstevel@tonic-gate while (getxdr_long()) {
654*7c478bd9Sstevel@tonic-gate (void) showxdr_string(YPMAXMAP, " %s");
655*7c478bd9Sstevel@tonic-gate maps++;
656*7c478bd9Sstevel@tonic-gate }
657*7c478bd9Sstevel@tonic-gate
658*7c478bd9Sstevel@tonic-gate (void) sprintf(get_line(0, 0), "%d maps", maps);
659*7c478bd9Sstevel@tonic-gate }
660*7c478bd9Sstevel@tonic-gate
661*7c478bd9Sstevel@tonic-gate char *
ypbind_error(err)662*7c478bd9Sstevel@tonic-gate ypbind_error(err)
663*7c478bd9Sstevel@tonic-gate int err;
664*7c478bd9Sstevel@tonic-gate {
665*7c478bd9Sstevel@tonic-gate static char buff[16];
666*7c478bd9Sstevel@tonic-gate
667*7c478bd9Sstevel@tonic-gate switch (err) {
668*7c478bd9Sstevel@tonic-gate case YPBIND_ERR_ERR: return ("Internal error");
669*7c478bd9Sstevel@tonic-gate case YPBIND_ERR_NOSERV: return ("Internal error");
670*7c478bd9Sstevel@tonic-gate case YPBIND_ERR_RESC: return ("Resource allocation fail");
671*7c478bd9Sstevel@tonic-gate default:
672*7c478bd9Sstevel@tonic-gate (void) sprintf(buff, "(%d)", err);
673*7c478bd9Sstevel@tonic-gate return (buff);
674*7c478bd9Sstevel@tonic-gate }
675*7c478bd9Sstevel@tonic-gate /* NOTREACHED */
676*7c478bd9Sstevel@tonic-gate }
677