rnusers.x revision 1.1
1/*
2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3 * unrestricted use provided that this legend is included on all tape
4 * media and as a part of the software program in whole or part.  Users
5 * may copy or modify Sun RPC without charge, but are not authorized
6 * to license or distribute it to anyone else except as part of a product or
7 * program developed by the user.
8 *
9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12 *
13 * Sun RPC is provided with no support and without any obligation on the
14 * part of Sun Microsystems, Inc. to assist in its use, correction,
15 * modification or enhancement.
16 *
17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19 * OR ANY PART THEREOF.
20 *
21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22 * or profits or other special, indirect and consequential damages, even if
23 * Sun has been advised of the possibility of such damages.
24 *
25 * Sun Microsystems, Inc.
26 * 2550 Garcia Avenue
27 * Mountain View, California  94043
28 */
29
30/*
31 * Find out about remote users
32 */
33
34#ifndef RPC_HDR
35%#ifndef lint
36%/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
37%/*static char sccsid[] = "from: @(#)rnusers.x	2.1 88/08/01 4.0 RPCSRC";*/
38%static char rcsid[] = "$Id: rnusers.x,v 1.1 1995/10/18 08:43:10 deraadt Exp $";
39%#endif /* not lint */
40#endif
41
42
43#ifdef RPC_HDR
44%/*
45% * The following structures are used by version 2 of the rusersd protocol.
46% * They were not developed with rpcgen, so they do not appear as RPCL.
47% */
48%
49%#define 	RUSERSVERS_ORIG 1	/* original version */
50%#define	RUSERSVERS_IDLE 2
51%#define	MAXUSERS 100
52%
53%/*
54% * This is the structure used in version 2 of the rusersd RPC service.
55% * It corresponds to the utmp structure for BSD sytems.
56% */
57%struct ru_utmp {
58%	char	ut_line[8];		/* tty name */
59%	char	ut_name[8];		/* user id */
60%	char	ut_host[16];		/* host name, if remote */
61%	long	ut_time;		/* time on */
62%};
63%typedef struct ru_utmp rutmp;
64%
65%struct utmparr {
66%	struct utmp **uta_arr;
67%	int uta_cnt;
68%};
69%typedef struct utmparr utmparr;
70%int xdr_utmparr();
71%
72%struct utmpidle {
73%	struct ru_utmp ui_utmp;
74%	unsigned ui_idle;
75%};
76%
77%struct utmpidlearr {
78%	struct utmpidle **uia_arr;
79%	int uia_cnt;
80%};
81%typedef struct utmpidlearr utmpidlearr;
82%int xdr_utmpidlearr();
83%
84%#define RUSERSVERS_1 ((u_long)1)
85%#define RUSERSVERS_2 ((u_long)2)
86%#ifndef RUSERSPROG
87%#define RUSERSPROG ((u_long)100002)
88%#endif
89%#ifndef RUSERSPROC_NUM
90%#define RUSERSPROC_NUM ((u_long)1)
91%#endif
92%#ifndef RUSERSPROC_NAMES
93%#define RUSERSPROC_NAMES ((u_long)2)
94%#endif
95%#ifndef RUSERSPROC_ALLNAMES
96%#define RUSERSPROC_ALLNAMES ((u_long)3)
97%#endif
98%
99#endif	/* RPC_HDR */
100
101#ifdef	RPC_XDR
102%bool_t
103%xdr_utmp(xdrs, objp)
104%	XDR *xdrs;
105%	struct ru_utmp *objp;
106%{
107%	char *ptr;
108%	int size;
109%
110%	ptr  = objp->ut_line;
111%	size = sizeof(objp->ut_line);
112%	if (!xdr_bytes(xdrs, &ptr, &size, size)) {
113%		return (FALSE);
114%	}
115%	ptr  = objp->ut_name;
116%	size = sizeof(objp->ut_line);
117%	if (!xdr_bytes(xdrs, &ptr, &size, size)) {
118%		return (FALSE);
119%	}
120%	ptr  = objp->ut_host;
121%	size = sizeof(objp->ut_host);
122%	if (!xdr_bytes(xdrs, &ptr, &size, size)) {
123%		return (FALSE);
124%	}
125%	if (!xdr_long(xdrs, &objp->ut_time)) {
126%		return (FALSE);
127%	}
128%	return (TRUE);
129%}
130%
131%bool_t
132%xdr_utmpptr(xdrs, objpp)
133%	XDR *xdrs;
134%	struct utmp **objpp;
135%{
136%	if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp),
137%			   xdr_utmp)) {
138%		return (FALSE);
139%	}
140%	return (TRUE);
141%}
142%
143%bool_t
144%xdr_utmparr(xdrs, objp)
145%	XDR *xdrs;
146%	struct utmparr *objp;
147%{
148%	if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt,
149%		       MAXUSERS, sizeof(struct utmp *), xdr_utmpptr)) {
150%		return (FALSE);
151%	}
152%	return (TRUE);
153%}
154%
155%bool_t
156%xdr_utmpidle(xdrs, objp)
157%	XDR *xdrs;
158%	struct utmpidle *objp;
159%{
160%	if (!xdr_utmp(xdrs, &objp->ui_utmp)) {
161%		return (FALSE);
162%	}
163%	if (!xdr_u_int(xdrs, &objp->ui_idle)) {
164%		return (FALSE);
165%	}
166%	return (TRUE);
167%}
168%
169%bool_t
170%xdr_utmpidleptr(xdrs, objpp)
171%	XDR *xdrs;
172%	struct utmpidle **objpp;
173%{
174%	if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle),
175%			   xdr_utmpidle)) {
176%		return (FALSE);
177%	}
178%	return (TRUE);
179%}
180%
181%bool_t
182%xdr_utmpidlearr(xdrs, objp)
183%	XDR *xdrs;
184%	struct utmpidlearr *objp;
185%{
186%	if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt,
187%		       MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) {
188%		return (FALSE);
189%	}
190%	return (TRUE);
191%}
192#endif
193