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