Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ucf-cs.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!tektronix!uw-beaver!cornell!vax135!petsd!peora!ucf-cs!notes From: notes@ucf-cs.UUCP Newsgroups: net.sources Subject: Re: Setidle Program Message-ID: <2078@ucf-cs.UUCP> Date: Wed, 24-Jul-85 23:17:19 EDT Article-I.D.: ucf-cs.2078 Posted: Wed Jul 24 23:17:19 1985 Date-Received: Sun, 28-Jul-85 04:47:47 EDT Sender: notes@ucf-cs.UUCP Organization: Univ. of Central Florida, Orlando Lines: 82 Nf-ID: #R:dadla:-32900:ucf-cs:69600001:000:2256 Nf-From: ucf-cs!goldfarb Jul 24 12:37:00 1985 >This is a program which allows a user to set and maintain a specified idle >time on his tty. The default (giving no parameters) sets the idle time to >zero every 10 minutes. It is useful for those who need to maintain control >on their idle time without being present at their terminals. So who needs to do that? Generally, users who want to circumvent an automatic logout program. I have such a program here and I have a set of users who sometimes rambunctiously attempt to circumvent such controls by using programs like this one. So in retaliation, I offer the following diff representing a 4.2bsd kernel change to disallow this kind of thing. The file is ufs_syscalls.c. (We use RCS, so line numbers may differ from yours.) *** /tmp/,RCSt1001235 Wed Jul 24 12:29:27 1985 --- /tmp/,RCSt2001235 Wed Jul 24 12:29:30 1985 *************** *** 20,25 /* * $Log: ufs_syscalls.c,v $ * Revision 1.1 84/09/25 10:01:00 root * Initial revision * --- 20,29 ----- /* * $Log: ufs_syscalls.c,v $ + * Revision 1.2 84/09/25 11:54:59 root + * Fixed to disallow utimes() calls to modify char special device + * times for non-super-user. + * * Revision 1.1 84/09/25 10:01:00 root * Initial revision * *************** *** 651,656 if ((ip = owner(1)) == NULL) return; u.u_error = copyin((caddr_t)uap->tptr, (caddr_t)tv, sizeof (tv)); if (u.u_error == 0) { ip->i_flag |= IACC|IUPD|ICHG; --- 655,665 ----- if ((ip = owner(1)) == NULL) return; + /* no utimes on char spec. devices except superuser */ + if ((ip->i_ic.ic_mode & IFCHR) && !suser()) { + u.u_error = EACCES; + goto utbad; + } u.u_error = copyin((caddr_t)uap->tptr, (caddr_t)tv, sizeof (tv)); if (u.u_error == 0) { ip->i_flag |= IACC|IUPD|ICHG; *************** *** 656,661 ip->i_flag |= IACC|IUPD|ICHG; iupdat(ip, &tv[0], &tv[1], 0); } iput(ip); } --- 665,671 ----- ip->i_flag |= IACC|IUPD|ICHG; iupdat(ip, &tv[0], &tv[1], 0); } + utbad: iput(ip); } ---------------- Ben Goldfarb University of Central Florida uucp: {decvax,akgua}!ucf-cs!goldfarb ARPA: goldfarb.ucf-cs@csnet.relay.CSNET csnet: goldfarb@ucf.CSNET BITNET: goldfarb@ucf2vm.BITNET