rnusers.x revision 1.13
1/* $OpenBSD: rnusers.x,v 1.13 2009/10/27 23:59:30 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#endif 38 39 40#ifdef RPC_HDR 41%/* 42% * The following structures are used by version 2 of the rusersd protocol. 43% * They were not developed with rpcgen, so they do not appear as RPCL. 44% */ 45% 46%#define RUSERSVERS_ORIG 1 /* original version */ 47%#define RUSERSVERS_IDLE 2 48%#define MAXUSERS 100 49% 50%/* 51% * This is the structure used in version 2 of the rusersd RPC service. 52% * It corresponds to the utmp structure for BSD sytems. 53% */ 54% 55%#define RNUSERS_MAXUSERLEN 8 56%#define RNUSERS_MAXLINELEN 8 57%#define RNUSERS_MAXHOSTLEN 16 58% 59%struct ru_utmp { 60% char *ut_line; /* tty name */ 61% char *ut_name; /* user id */ 62% char *ut_host; /* host name, if remote */ 63% int ut_time; /* time on */ 64%}; 65%typedef struct ru_utmp rutmp; 66% 67%struct utmparr { 68% struct ru_utmp **uta_arr; 69% int uta_cnt; 70%}; 71%typedef struct utmparr utmparr; 72%int xdr_utmparr(XDR *, struct utmparr *); 73% 74%struct utmpidle { 75% struct ru_utmp ui_utmp; 76% unsigned ui_idle; 77%}; 78% 79%struct utmpidlearr { 80% struct utmpidle **uia_arr; 81% int uia_cnt; 82%}; 83%typedef struct utmpidlearr utmpidlearr; 84%int xdr_utmpidlearr(XDR *, struct utmpidlearr *); 85% 86%#define RUSERSVERS_1 ((u_long)1) 87%#define RUSERSVERS_2 ((u_long)2) 88%#ifndef RUSERSPROG 89%#define RUSERSPROG ((u_long)100002) 90%#endif 91%#ifndef RUSERSPROC_NUM 92%#define RUSERSPROC_NUM ((u_long)1) 93%#endif 94%#ifndef RUSERSPROC_NAMES 95%#define RUSERSPROC_NAMES ((u_long)2) 96%#endif 97%#ifndef RUSERSPROC_ALLNAMES 98%#define RUSERSPROC_ALLNAMES ((u_long)3) 99%#endif 100% 101#endif /* RPC_HDR */ 102 103#ifdef RPC_XDR 104%bool_t xdr_utmp(XDR *, struct ru_utmp *); 105%bool_t xdr_utmpptr(XDR *, struct ru_utmp **); 106%bool_t xdr_utmparr(XDR *, struct utmparr *); 107%bool_t xdr_utmpidle(XDR *, struct utmpidle *); 108%bool_t xdr_utmpidleptr(XDR *, struct utmpidle **); 109% 110%bool_t 111%xdr_utmp(XDR *xdrs, struct ru_utmp *objp) 112%{ 113% int size; 114% 115% size = RNUSERS_MAXLINELEN; 116% if (!xdr_bytes(xdrs, &objp->ut_line, &size, RNUSERS_MAXLINELEN)) 117% return (FALSE); 118% size = RNUSERS_MAXUSERLEN; 119% if (!xdr_bytes(xdrs, &objp->ut_name, &size, RNUSERS_MAXUSERLEN)) 120% return (FALSE); 121% size = RNUSERS_MAXHOSTLEN; 122% if (!xdr_bytes(xdrs, &objp->ut_host, &size, RNUSERS_MAXHOSTLEN)) 123% return (FALSE); 124% if (!xdr_int(xdrs, &objp->ut_time)) 125% return (FALSE); 126% return (TRUE); 127%} 128% 129%bool_t 130%xdr_utmpptr(XDR *xdrs, struct ru_utmp **objpp) 131%{ 132% if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct ru_utmp), 133% xdr_utmp)) 134% return (FALSE); 135% return (TRUE); 136%} 137% 138%bool_t 139%xdr_utmparr(XDR *xdrs, struct utmparr *objp) 140%{ 141% if (!xdr_array(xdrs, (char **)&objp->uta_arr, (u_int *)&objp->uta_cnt, 142% MAXUSERS, sizeof(struct ru_utmp *), xdr_utmpptr)) 143% return (FALSE); 144% return (TRUE); 145%} 146% 147%bool_t 148%xdr_utmpidle(XDR *xdrs, struct utmpidle *objp) 149%{ 150% if (!xdr_utmp(xdrs, &objp->ui_utmp)) 151% return (FALSE); 152% if (!xdr_u_int(xdrs, &objp->ui_idle)) 153% return (FALSE); 154% return (TRUE); 155%} 156% 157%bool_t 158%xdr_utmpidleptr(XDR *xdrs, struct utmpidle **objpp) 159%{ 160% if (!xdr_reference(xdrs, (char **) objpp, sizeof (struct utmpidle), 161% xdr_utmpidle)) 162% return (FALSE); 163% return (TRUE); 164%} 165% 166%bool_t 167%xdr_utmpidlearr(XDR *xdrs, struct utmpidlearr *objp) 168%{ 169% if (!xdr_array(xdrs, (char **)&objp->uia_arr, (u_int *)&objp->uia_cnt, 170% MAXUSERS, sizeof(struct utmpidle *), xdr_utmpidleptr)) 171% return (FALSE); 172% return (TRUE); 173%} 174#endif 175