Setidle Program
notes at ucf-cs.UUCP
notes at ucf-cs.UUCP
Thu Jul 25 13:17:19 AEST 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 at csnet.relay.CSNET
csnet: goldfarb at ucf.CSNET
BITNET: goldfarb at ucf2vm.BITNET
More information about the Comp.sources.unix
mailing list