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[] = "$NetBSD: rnusers.x,v 1.4 1997/04/17 17:29:24 christos 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 % 71 %struct utmpidle { 72 % struct ru_utmp ui_utmp; 73 % unsigned ui_idle; 74 %}; 75 % 76 %struct utmpidlearr { 77 % struct utmpidle **uia_arr; 78 % int uia_cnt; 79 %}; 80 %typedef struct utmpidlearr utmpidlearr; 81 % 82 %#include <sys/cdefs.h> 83 %__BEGIN_DECLS 84 %bool_t xdr_utmp __P((XDR *, struct ru_utmp *)); 85 %bool_t xdr_utmpptr __P((XDR *, struct ru_utmp **)); 86 %bool_t xdr_utmparr __P((XDR *, struct utmparr *)); 87 %bool_t xdr_utmpidle __P((XDR *, struct utmpidle *)); 88 %bool_t xdr_utmpidleptr __P((XDR *, struct utmpidle **)); 89 %bool_t xdr_utmpidlearr __P((XDR *, struct utmpidlearr *)); 90 %__END_DECLS 91 % 92 %#define RUSERSVERS_1 ((u_long)1) 93 %#define RUSERSVERS_2 ((u_long)2) 94 %#ifndef RUSERSPROG 95 %#define RUSERSPROG ((u_long)100002) 96 %#endif 97 %#ifndef RUSERSPROC_NUM 98 %#define RUSERSPROC_NUM ((u_long)1) 99 %#endif 100 %#ifndef RUSERSPROC_NAMES 101 %#define RUSERSPROC_NAMES ((u_long)2) 102 %#endif 103 %#ifndef RUSERSPROC_ALLNAMES 104 %#define RUSERSPROC_ALLNAMES ((u_long)3) 105 %#endif 106 % 107 #endif /* RPC_HDR */ 108 109 #ifdef RPC_XDR 110 %bool_t 111 %xdr_utmp(xdrs, objp) 112 % XDR *xdrs; 113 % struct ru_utmp *objp; 114 %{ 115 % char *ptr; 116 % int size; 117 % 118 % 119 % /* 120 % * We are using a non-malloc allocated array, 121 % * so we are not supposed to call xdr_free with it. 122 % */ 123 % if (xdrs->x_op == XDR_FREE) 124 % return (TRUE); 125 % ptr = objp->ut_line; 126 % size = sizeof(objp->ut_line); 127 % if (!xdr_bytes(xdrs, &ptr, &size, size)) { 128 % return (FALSE); 129 % } 130 % ptr = objp->ut_name; 131 % size = sizeof(objp->ut_name); 132 % if (!xdr_bytes(xdrs, &ptr, &size, size)) { 133 % return (FALSE); 134 % } 135 % ptr = objp->ut_host; 136 % size = sizeof(objp->ut_host); 137 % if (!xdr_bytes(xdrs, &ptr, &size, size)) { 138 % return (FALSE); 139 % } 140 % if (!xdr_long(xdrs, &objp->ut_time)) { 141 % return (FALSE); 142 % } 143 % return (TRUE); 144 %} 145 % 146 %bool_t 147 %xdr_utmpptr(xdrs, objpp) 148 % XDR *xdrs; 149 % struct ru_utmp **objpp; 150 %{ 151 % if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp), 152 % xdr_utmp)) { 153 % return (FALSE); 154 % } 155 % return (TRUE); 156 %} 157 % 158 %bool_t 159 %xdr_utmparr(xdrs, objp) 160 % XDR *xdrs; 161 % struct utmparr *objp; 162 %{ 163 % if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt, 164 % MAXUSERS, sizeof(struct utmp *), xdr_utmpptr)) { 165 % return (FALSE); 166 % } 167 % return (TRUE); 168 %} 169 % 170 %bool_t 171 %xdr_utmpidle(xdrs, objp) 172 % XDR *xdrs; 173 % struct utmpidle *objp; 174 %{ 175 % if (!xdr_utmp(xdrs, &objp->ui_utmp)) { 176 % return (FALSE); 177 % } 178 % if (!xdr_u_int(xdrs, &objp->ui_idle)) { 179 % return (FALSE); 180 % } 181 % return (TRUE); 182 %} 183 % 184 %bool_t 185 %xdr_utmpidleptr(xdrs, objpp) 186 % XDR *xdrs; 187 % struct utmpidle **objpp; 188 %{ 189 % if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle), 190 % xdr_utmpidle)) { 191 % return (FALSE); 192 % } 193 % return (TRUE); 194 %} 195 % 196 %bool_t 197 %xdr_utmpidlearr(xdrs, objp) 198 % XDR *xdrs; 199 % struct utmpidlearr *objp; 200 %{ 201 % if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt, 202 % MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) { 203 % return (FALSE); 204 % } 205 % return (TRUE); 206 %} 207 #endif 208