1*8785398fSHiroki Sato /*- 2*8785398fSHiroki Sato * Copyright (c) 2010, Oracle America, Inc. 375b63130SGarrett Wollman * 4*8785398fSHiroki Sato * Redistribution and use in source and binary forms, with or without 5*8785398fSHiroki Sato * modification, are permitted provided that the following conditions are 6*8785398fSHiroki Sato * met: 775b63130SGarrett Wollman * 8*8785398fSHiroki Sato * * Redistributions of source code must retain the above copyright 9*8785398fSHiroki Sato * notice, this list of conditions and the following disclaimer. 10*8785398fSHiroki Sato * * Redistributions in binary form must reproduce the above 11*8785398fSHiroki Sato * copyright notice, this list of conditions and the following 12*8785398fSHiroki Sato * disclaimer in the documentation and/or other materials 13*8785398fSHiroki Sato * provided with the distribution. 14*8785398fSHiroki Sato * * Neither the name of the "Oracle America, Inc." nor the names of its 15*8785398fSHiroki Sato * contributors may be used to endorse or promote products derived 16*8785398fSHiroki Sato * from this software without specific prior written permission. 1775b63130SGarrett Wollman * 18*8785398fSHiroki Sato * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19*8785398fSHiroki Sato * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20*8785398fSHiroki Sato * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21*8785398fSHiroki Sato * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22*8785398fSHiroki Sato * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 23*8785398fSHiroki Sato * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24*8785398fSHiroki Sato * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 25*8785398fSHiroki Sato * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*8785398fSHiroki Sato * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27*8785398fSHiroki Sato * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28*8785398fSHiroki Sato * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29*8785398fSHiroki Sato * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3075b63130SGarrett Wollman */ 3175b63130SGarrett Wollman 3275b63130SGarrett Wollman /* 3375b63130SGarrett Wollman * Find out about remote users 3475b63130SGarrett Wollman */ 3575b63130SGarrett Wollman 3675b63130SGarrett Wollman const MAXUSERS = 100; 3775b63130SGarrett Wollman const MAXUTLEN = 256; 3875b63130SGarrett Wollman 3975b63130SGarrett Wollman struct utmp { 4075b63130SGarrett Wollman string ut_line<MAXUTLEN>; 4175b63130SGarrett Wollman string ut_name<MAXUTLEN>; 4275b63130SGarrett Wollman string ut_host<MAXUTLEN>; 4375b63130SGarrett Wollman int ut_time; 4475b63130SGarrett Wollman }; 4575b63130SGarrett Wollman 4675b63130SGarrett Wollman 4775b63130SGarrett Wollman struct utmpidle { 4875b63130SGarrett Wollman utmp ui_utmp; 4975b63130SGarrett Wollman unsigned int ui_idle; 5075b63130SGarrett Wollman }; 5175b63130SGarrett Wollman 5275b63130SGarrett Wollman typedef utmp utmparr<MAXUSERS>; 5375b63130SGarrett Wollman 5475b63130SGarrett Wollman typedef utmpidle utmpidlearr<MAXUSERS>; 5575b63130SGarrett Wollman 569bd1654aSBill Paul const RUSERS_MAXUSERLEN = 32; 579bd1654aSBill Paul const RUSERS_MAXLINELEN = 32; 589bd1654aSBill Paul const RUSERS_MAXHOSTLEN = 257; 599bd1654aSBill Paul 609bd1654aSBill Paul struct rusers_utmp { 619bd1654aSBill Paul string ut_user<RUSERS_MAXUSERLEN>; /* aka ut_name */ 629bd1654aSBill Paul string ut_line<RUSERS_MAXLINELEN>; /* device */ 639bd1654aSBill Paul string ut_host<RUSERS_MAXHOSTLEN>; /* host user logged on from */ 649bd1654aSBill Paul int ut_type; /* type of entry */ 659bd1654aSBill Paul int ut_time; /* time entry was made */ 669bd1654aSBill Paul unsigned int ut_idle; /* minutes idle */ 679bd1654aSBill Paul }; 689bd1654aSBill Paul 699bd1654aSBill Paul typedef rusers_utmp utmp_array<>; 709bd1654aSBill Paul 7175b63130SGarrett Wollman program RUSERSPROG { 7275b63130SGarrett Wollman /* 7375b63130SGarrett Wollman * Old version does not include idle information 7475b63130SGarrett Wollman */ 7575b63130SGarrett Wollman version RUSERSVERS_ORIG { 7675b63130SGarrett Wollman int 7775b63130SGarrett Wollman RUSERSPROC_NUM(void) = 1; 7875b63130SGarrett Wollman 7975b63130SGarrett Wollman utmparr 8075b63130SGarrett Wollman RUSERSPROC_NAMES(void) = 2; 8175b63130SGarrett Wollman 8275b63130SGarrett Wollman utmparr 8375b63130SGarrett Wollman RUSERSPROC_ALLNAMES(void) = 3; 8475b63130SGarrett Wollman } = 1; 8575b63130SGarrett Wollman 8675b63130SGarrett Wollman /* 8775b63130SGarrett Wollman * Includes idle information 8875b63130SGarrett Wollman */ 8975b63130SGarrett Wollman version RUSERSVERS_IDLE { 9075b63130SGarrett Wollman int 9175b63130SGarrett Wollman RUSERSPROC_NUM(void) = 1; 9275b63130SGarrett Wollman 9375b63130SGarrett Wollman utmpidlearr 9475b63130SGarrett Wollman RUSERSPROC_NAMES(void) = 2; 9575b63130SGarrett Wollman 9675b63130SGarrett Wollman utmpidlearr 9775b63130SGarrett Wollman RUSERSPROC_ALLNAMES(void) = 3; 9875b63130SGarrett Wollman } = 2; 999bd1654aSBill Paul 1009bd1654aSBill Paul /* 1019bd1654aSBill Paul * Version 3 rusers procedures (from Solaris). 1029bd1654aSBill Paul * (Thanks a lot Sun.) 1039bd1654aSBill Paul */ 1049bd1654aSBill Paul version RUSERSVERS_3 { 1059bd1654aSBill Paul int 1069bd1654aSBill Paul RUSERSPROC_NUM(void) = 1; 1079bd1654aSBill Paul 1089bd1654aSBill Paul utmp_array 1099bd1654aSBill Paul RUSERSPROC_NAMES(void) = 2; 1109bd1654aSBill Paul 1119bd1654aSBill Paul utmp_array 1129bd1654aSBill Paul RUSERSPROC_ALLNAMES(void) = 3; 1139bd1654aSBill Paul } = 3; 1149bd1654aSBill Paul 11575b63130SGarrett Wollman } = 100002; 11675b63130SGarrett Wollman 117