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