rnusers.x revision 1.10
1/* $OpenBSD: rnusers.x,v 1.10 2003/06/26 23:19:53 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.10 2003/06/26 23:19:53 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(XDR *, struct 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(XDR *, struct 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(XDR *xdrs, struct ru_utmp *objp) 111%{ 112% int size; 113% 114% size = RNUSERS_MAXLINELEN; 115% if (!xdr_bytes(xdrs, &objp->ut_line, &size, RNUSERS_MAXLINELEN)) 116% return (FALSE); 117% size = RNUSERS_MAXUSERLEN; 118% if (!xdr_bytes(xdrs, &objp->ut_name, &size, RNUSERS_MAXUSERLEN)) 119% return (FALSE); 120% size = RNUSERS_MAXHOSTLEN; 121% if (!xdr_bytes(xdrs, &objp->ut_host, &size, RNUSERS_MAXHOSTLEN)) 122% return (FALSE); 123% if (!xdr_int(xdrs, &objp->ut_time)) 124% return (FALSE); 125% return (TRUE); 126%} 127% 128%bool_t 129%xdr_utmpptr(XDR *xdrs, struct ru_utmp **objpp) 130%{ 131% if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp), 132% xdr_utmp)) 133% return (FALSE); 134% return (TRUE); 135%} 136% 137%bool_t 138%xdr_utmparr(XDR *xdrs, struct utmparr *objp) 139%{ 140% if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt, 141% MAXUSERS, sizeof(struct ru_utmp *), xdr_utmpptr)) 142% return (FALSE); 143% return (TRUE); 144%} 145% 146%bool_t 147%xdr_utmpidle(XDR *xdrs, struct utmpidle *objp) 148%{ 149% if (!xdr_utmp(xdrs, &objp->ui_utmp)) 150% return (FALSE); 151% if (!xdr_u_int(xdrs, &objp->ui_idle)) 152% return (FALSE); 153% return (TRUE); 154%} 155% 156%bool_t 157%xdr_utmpidleptr(XDR *xdrs, struct utmpidle **objpp) 158%{ 159% if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle), 160% xdr_utmpidle)) 161% return (FALSE); 162% return (TRUE); 163%} 164% 165%bool_t 166%xdr_utmpidlearr(XDR *xdrs, struct utmpidlearr *objp) 167%{ 168% if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt, 169% MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) 170% return (FALSE); 171% return (TRUE); 172%} 173#endif 174