xref: /netbsd-src/lib/librpcsvc/rnusers.x (revision 988ab2c9fa920fc50a0512deb7d1a0d65a70e31e)
1958e765fSjtc /*
2958e765fSjtc  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3958e765fSjtc  * unrestricted use provided that this legend is included on all tape
4958e765fSjtc  * media and as a part of the software program in whole or part.  Users
5958e765fSjtc  * may copy or modify Sun RPC without charge, but are not authorized
6958e765fSjtc  * to license or distribute it to anyone else except as part of a product or
7958e765fSjtc  * program developed by the user.
8958e765fSjtc  *
9958e765fSjtc  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10958e765fSjtc  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11958e765fSjtc  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12958e765fSjtc  *
13958e765fSjtc  * Sun RPC is provided with no support and without any obligation on the
14958e765fSjtc  * part of Sun Microsystems, Inc. to assist in its use, correction,
15958e765fSjtc  * modification or enhancement.
16958e765fSjtc  *
17958e765fSjtc  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18958e765fSjtc  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19958e765fSjtc  * OR ANY PART THEREOF.
20958e765fSjtc  *
21958e765fSjtc  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22958e765fSjtc  * or profits or other special, indirect and consequential damages, even if
23958e765fSjtc  * Sun has been advised of the possibility of such damages.
24958e765fSjtc  *
25958e765fSjtc  * Sun Microsystems, Inc.
26958e765fSjtc  * 2550 Garcia Avenue
27958e765fSjtc  * Mountain View, California  94043
28958e765fSjtc  */
29958e765fSjtc 
30958e765fSjtc /*
31958e765fSjtc  * Find out about remote users
32958e765fSjtc  */
33958e765fSjtc 
34958e765fSjtc #ifndef RPC_HDR
356112a51eSlukem %#include <sys/cdefs.h>
36d93fc4c1Skleink %#ifndef __lint__
37958e765fSjtc %/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
38958e765fSjtc %/*static char sccsid[] = "from: @(#)rnusers.x	2.1 88/08/01 4.0 RPCSRC";*/
39*988ab2c9Smsaitoh %__RCSID("$NetBSD: rnusers.x,v 1.16 2022/01/01 10:32:28 msaitoh Exp $");
40d93fc4c1Skleink %#endif /* not __lint__ */
41958e765fSjtc #endif
42958e765fSjtc 
43958e765fSjtc 
44958e765fSjtc #ifdef RPC_HDR
45958e765fSjtc %/*
46958e765fSjtc % * The following structures are used by version 2 of the rusersd protocol.
47958e765fSjtc % * They were not developed with rpcgen, so they do not appear as RPCL.
48958e765fSjtc % */
49958e765fSjtc %
50958e765fSjtc %#define 	RUSERSVERS_ORIG 1	/* original version */
51958e765fSjtc %#define	RUSERSVERS_IDLE 2
52958e765fSjtc %#define	MAXUSERS 100
53958e765fSjtc %
54958e765fSjtc %/*
55958e765fSjtc % * This is the structure used in version 2 of the rusersd RPC service.
56*988ab2c9Smsaitoh % * It corresponds to the utmp structure for BSD systems.
57958e765fSjtc % */
58958e765fSjtc %struct ru_utmp {
59958e765fSjtc %	char	ut_line[8];		/* tty name */
60958e765fSjtc %	char	ut_name[8];		/* user id */
61958e765fSjtc %	char	ut_host[16];		/* host name, if remote */
62ce147c1cSlukem %	long	ut_time;		/* time on */
63958e765fSjtc %};
64958e765fSjtc %typedef struct ru_utmp rutmp;
65958e765fSjtc %
66958e765fSjtc %struct utmparr {
67958e765fSjtc %	struct utmp **uta_arr;
68958e765fSjtc %	int uta_cnt;
69958e765fSjtc %};
70958e765fSjtc %typedef struct utmparr utmparr;
71958e765fSjtc %
72958e765fSjtc %struct utmpidle {
73958e765fSjtc %	struct ru_utmp ui_utmp;
74958e765fSjtc %	unsigned ui_idle;
75958e765fSjtc %};
76958e765fSjtc %
77958e765fSjtc %struct utmpidlearr {
78958e765fSjtc %	struct utmpidle **uia_arr;
79958e765fSjtc %	int uia_cnt;
80958e765fSjtc %};
81958e765fSjtc %typedef struct utmpidlearr utmpidlearr;
828962a948Smikel %
838962a948Smikel %#include <sys/cdefs.h>
848962a948Smikel %__BEGIN_DECLS
85b65f650cSchristos %bool_t xdr_utmp(XDR *, struct ru_utmp *);
86b65f650cSchristos %bool_t xdr_utmpptr(XDR *, struct ru_utmp **);
87b65f650cSchristos %bool_t xdr_utmparr(XDR *, struct utmparr *);
88b65f650cSchristos %bool_t xdr_utmpidle(XDR *, struct utmpidle *);
89b65f650cSchristos %bool_t xdr_utmpidleptr(XDR *, struct utmpidle **);
90b65f650cSchristos %bool_t xdr_utmpidlearr(XDR *, struct utmpidlearr *);
918962a948Smikel %__END_DECLS
92958e765fSjtc %
93ce147c1cSlukem %#define RUSERSVERS_1 ((u_long)1)
94ce147c1cSlukem %#define RUSERSVERS_2 ((u_long)2)
95958e765fSjtc %#ifndef RUSERSPROG
96ce147c1cSlukem %#define RUSERSPROG ((u_long)100002)
97958e765fSjtc %#endif
98958e765fSjtc %#ifndef RUSERSPROC_NUM
99ce147c1cSlukem %#define RUSERSPROC_NUM ((u_long)1)
100958e765fSjtc %#endif
101958e765fSjtc %#ifndef RUSERSPROC_NAMES
102ce147c1cSlukem %#define RUSERSPROC_NAMES ((u_long)2)
103958e765fSjtc %#endif
104958e765fSjtc %#ifndef RUSERSPROC_ALLNAMES
105ce147c1cSlukem %#define RUSERSPROC_ALLNAMES ((u_long)3)
106958e765fSjtc %#endif
107958e765fSjtc %
108958e765fSjtc #endif	/* RPC_HDR */
109958e765fSjtc 
110958e765fSjtc #ifdef	RPC_XDR
111958e765fSjtc %bool_t
112958e765fSjtc %xdr_utmp(xdrs, objp)
113958e765fSjtc %	XDR *xdrs;
114958e765fSjtc %	struct ru_utmp *objp;
115958e765fSjtc %{
116958e765fSjtc %	char *ptr;
117aa9da9e0Schristos %	u_int size;
118958e765fSjtc %
11957c6bc42Schristos %	/*
12057c6bc42Schristos %	 * We are using a non-malloc allocated array,
12157c6bc42Schristos %	 * so we are not supposed to call xdr_free with it.
12257c6bc42Schristos %	 */
12357c6bc42Schristos %	if (xdrs->x_op == XDR_FREE)
12457c6bc42Schristos %		return (TRUE);
125958e765fSjtc %	ptr  = objp->ut_line;
12616961757Schristos %	size = (u_int)sizeof(objp->ut_line);
12751e08ca2Smycroft %	if (!xdr_bytes(xdrs, &ptr, &size, size))
128958e765fSjtc %		return (FALSE);
129958e765fSjtc %	ptr  = objp->ut_name;
13016961757Schristos %	size = (u_int)sizeof(objp->ut_name);
13151e08ca2Smycroft %	if (!xdr_bytes(xdrs, &ptr, &size, size))
132958e765fSjtc %		return (FALSE);
133958e765fSjtc %	ptr  = objp->ut_host;
13416961757Schristos %	size = (u_int)sizeof(objp->ut_host);
13551e08ca2Smycroft %	if (!xdr_bytes(xdrs, &ptr, &size, size))
136958e765fSjtc %		return (FALSE);
13751e08ca2Smycroft %	if (!xdr_long(xdrs, &objp->ut_time))
138958e765fSjtc %		return (FALSE);
139958e765fSjtc %	return (TRUE);
140958e765fSjtc %}
141958e765fSjtc %
142958e765fSjtc %bool_t
143958e765fSjtc %xdr_utmpptr(xdrs, objpp)
144958e765fSjtc %	XDR *xdrs;
1458962a948Smikel %	struct ru_utmp **objpp;
146958e765fSjtc %{
14751e08ca2Smycroft %
14816961757Schristos %	if (!xdr_reference(xdrs, (char **) objpp, (u_int)sizeof(struct ru_utmp),
14987d4f607Splunky %			   (xdrproc_t)xdr_utmp))
150958e765fSjtc %		return (FALSE);
151958e765fSjtc %	return (TRUE);
152958e765fSjtc %}
153958e765fSjtc %
154958e765fSjtc %bool_t
155958e765fSjtc %xdr_utmparr(xdrs, objp)
156958e765fSjtc %	XDR *xdrs;
157958e765fSjtc %	struct utmparr *objp;
158958e765fSjtc %{
15951e08ca2Smycroft %
1606f4493cdSmrg %	if (!xdr_array(xdrs, (char **)(void *)&objp->uta_arr,
1616f4493cdSmrg %		       (u_int *)&objp->uta_cnt, MAXUSERS,
16287d4f607Splunky %		       (u_int)sizeof(struct utmp *), (xdrproc_t)xdr_utmpptr))
163958e765fSjtc %		return (FALSE);
164958e765fSjtc %	return (TRUE);
165958e765fSjtc %}
166958e765fSjtc %
167958e765fSjtc %bool_t
168958e765fSjtc %xdr_utmpidle(xdrs, objp)
169958e765fSjtc %	XDR *xdrs;
170958e765fSjtc %	struct utmpidle *objp;
171958e765fSjtc %{
17251e08ca2Smycroft %
17351e08ca2Smycroft %	if (!xdr_utmp(xdrs, &objp->ui_utmp))
174958e765fSjtc %		return (FALSE);
17551e08ca2Smycroft %	if (!xdr_u_int(xdrs, &objp->ui_idle))
176958e765fSjtc %		return (FALSE);
177958e765fSjtc %	return (TRUE);
178958e765fSjtc %}
179958e765fSjtc %
180958e765fSjtc %bool_t
181958e765fSjtc %xdr_utmpidleptr(xdrs, objpp)
182958e765fSjtc %	XDR *xdrs;
183958e765fSjtc %	struct utmpidle **objpp;
184958e765fSjtc %{
18551e08ca2Smycroft %
18616961757Schristos %	if (!xdr_reference(xdrs, (char **) objpp,
18787d4f607Splunky %			   (u_int)sizeof(struct utmpidle),
18887d4f607Splunky %			   (xdrproc_t)xdr_utmpidle))
189958e765fSjtc %		return (FALSE);
190958e765fSjtc %	return (TRUE);
191958e765fSjtc %}
192958e765fSjtc %
193958e765fSjtc %bool_t
194958e765fSjtc %xdr_utmpidlearr(xdrs, objp)
195958e765fSjtc %	XDR *xdrs;
196958e765fSjtc %	struct utmpidlearr *objp;
197958e765fSjtc %{
19851e08ca2Smycroft %
1996f4493cdSmrg %	if (!xdr_array(xdrs, (char **)(void *)&objp->uia_arr,
2006f4493cdSmrg %	 	       (u_int *)&objp->uia_cnt, MAXUSERS,
20187d4f607Splunky %		       (u_int)sizeof(struct utmpidle *),
20287d4f607Splunky %		       (xdrproc_t)xdr_utmpidleptr))
203958e765fSjtc %		return (FALSE);
204958e765fSjtc %	return (TRUE);
205958e765fSjtc %}
206958e765fSjtc #endif
207