Compare commits
12 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c87d167ca0 | ||
![]() |
812394b9df | ||
![]() |
ef953698c5 | ||
![]() |
6ff7b56a42 | ||
![]() |
cde92985ae | ||
![]() |
af2d3b48c6 | ||
![]() |
4f37273c60 | ||
![]() |
957c5aefad | ||
![]() |
ff3a5d11a1 | ||
![]() |
73dd70fdf8 | ||
![]() |
119d66d4c1 | ||
![]() |
f8a3bc0509 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
timeoutd
|
||||
*.o
|
28
Makefile
28
Makefile
|
@ -1,22 +1,12 @@
|
|||
CFLAGS = -g -Wall
|
||||
|
||||
timeoutd: timeoutd.c
|
||||
CFLAGS=-fomit-frame-pointer -O2 -s -g -Wall -Wno-unused-result
|
||||
timeoutd: timeoutd.c Makefile
|
||||
#$(CC) $(CFLAGS) -o timeoutd timeoutd.c
|
||||
$(CC) $(CFLAGS) -o timeoutd.o -c timeoutd.c -DTIMEOUTDX11
|
||||
$(CC) $(CFLAGS) -o timeoutd timeoutd.o -lX11 -lXss
|
||||
$(CC) $(CFLAGS) -o timeoutd -L/usr/X11R6/lib timeoutd.o -lXss -lXext -lX11
|
||||
|
||||
clean:
|
||||
-rm -f timeoutd timeoutd.o
|
||||
install:
|
||||
install -o root -g adm -m 2111 timeoutd /usr/sbin
|
||||
install -o root -g adm -m 2111 timeoutd.service /lib/systemd/system
|
||||
install -o man -g man -m 444 timeoutd.8 /usr/share/man/man8
|
||||
install -o man -g man -m 445 timeouts.5 /usr/share/man/man5
|
||||
|
||||
install: timeoutd /etc/timeouts
|
||||
install timeoutd /usr/sbin/timeoutd
|
||||
install timeoutd.8 /usr/share/man/man8
|
||||
install timeouts.5 /usr/share/man/man5
|
||||
|
||||
uninstall:
|
||||
rm /usr/sbin/timeoutd
|
||||
rm /usr/share/man/man8/timeoutd.8
|
||||
rm /usr/share/man/man5/timeouts.5
|
||||
rm /etc/timeouts
|
||||
|
||||
/etc/timeouts:
|
||||
install timeouts /etc
|
||||
|
|
13
README
13
README
|
@ -12,6 +12,10 @@ each tty on your system:
|
|||
To build timeoutd, you should make any changes to the makefile for
|
||||
your preferred compilation options, then simply:
|
||||
|
||||
Note for Ubuntu, you need to install:
|
||||
|
||||
sudo apt-get install libxss-dev libx11-dev
|
||||
|
||||
make
|
||||
|
||||
The next step is to install a timeouts file in /etc specifying
|
||||
|
@ -37,8 +41,11 @@ Otherwise, users who are not allowed to login will be logged off within
|
|||
Another (albeit less certain) way of doing this is to put the following
|
||||
line in /etc/profile near the top of the file:
|
||||
|
||||
/usr/etc/timeoutd `whoami` `basename \`tty\`` || exit
|
||||
/usr/sbin/timeoutd `whoami` `basename \`tty\`` || exit
|
||||
|
||||
|
||||
Please send bugs, comments, suggestions to:
|
||||
Please sends bugs, comments, suggestions to:
|
||||
shanea@bigpond.net.au (Shane Alderton)
|
||||
|
||||
To build the debian package you need to run:
|
||||
|
||||
debuild -uc -us
|
||||
|
|
7
debian/.gitignore
vendored
Normal file
7
debian/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
files
|
||||
timeoutd.debhelper.log
|
||||
timeoutd.postinst.debhelper
|
||||
timeoutd.postrm.debhelper
|
||||
timeoutd.prerm.debhelper
|
||||
timeoutd.substvars
|
||||
timeoutd
|
16
debian/changelog
vendored
16
debian/changelog
vendored
|
@ -1,11 +1,17 @@
|
|||
timeoutd (1.5-10.1ubuntu1~1.gbp45a983) UNRELEASED; urgency=low
|
||||
timeoutd (1.5-10.3) unstable; urgency=low
|
||||
* Non-maintainer upload
|
||||
* Update to support gnome 3 only
|
||||
|
||||
** SNAPSHOT build @45a9836343ec6efa904b51360713c52fb623d6d8 **
|
||||
-- Jason Pell <jason@pellcorp.com> Wed, 20 Mar 2019 09:28:59 +1000
|
||||
|
||||
* UNRELEASED
|
||||
* Fixed local X session handling
|
||||
timeoutd (1.5-10.2) unstable; urgency=low
|
||||
* Non-maintainer upload
|
||||
* Resolve the missing symbol XOpenDisplay by linking with libX11
|
||||
* Update debian/control Standards-Version: 3.9.5
|
||||
* Ignore files generated by building debian package
|
||||
* Update debian/compat to version 5
|
||||
|
||||
-- Shawn Willden <shawn@kahlan.willden.org> Sun, 04 Jan 2009 23:17:57 -0700
|
||||
-- Clark Rawlins <clark@bit63.org> Sun, 14 Dec 2014 09:28:59 -0800
|
||||
|
||||
timeoutd (1.5-10.1) unstable; urgency=low
|
||||
|
||||
|
|
2
debian/compat
vendored
2
debian/compat
vendored
|
@ -1 +1 @@
|
|||
4
|
||||
9
|
||||
|
|
4
debian/control
vendored
4
debian/control
vendored
|
@ -2,12 +2,12 @@ Source: timeoutd
|
|||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: Dennis Stampfer <seppy@debian.org>
|
||||
Standards-Version: 3.6.2
|
||||
Standards-Version: 3.9.5
|
||||
Build-Depends: debhelper (>= 4), libx11-dev, libxss-dev
|
||||
|
||||
Package: timeoutd
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, gxmessage
|
||||
Conflicts: suidmanager (<< 0.50)
|
||||
Description: Flexible user timeout daemon with X11 support
|
||||
timeoutd enforces the time restrictions specified for each or all users.
|
||||
|
|
7
debian/rules
vendored
7
debian/rules
vendored
|
@ -4,6 +4,9 @@
|
|||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
build-arch: build
|
||||
|
||||
build-indep: build
|
||||
|
||||
build:
|
||||
$(MAKE) timeoutd
|
||||
|
@ -20,7 +23,7 @@ clean:
|
|||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_prep
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/<packagename>
|
||||
|
@ -43,7 +46,7 @@ binary-arch: build install
|
|||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
# dh_installmime
|
||||
dh_installinit
|
||||
dh_installsystemd
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
# dh_undocumented
|
||||
|
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
3.0 (git)
|
51
debian/timeoutd.init.d
vendored
51
debian/timeoutd.init.d
vendored
|
@ -1,51 +0,0 @@
|
|||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: timeoutd
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: start and stop the user timeout daemon
|
||||
### END INIT INFO
|
||||
#
|
||||
# Based on skeleton 1.9.1 by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||
|
||||
DAEMON=/usr/sbin/timeoutd
|
||||
NAME=timeoutd
|
||||
DESC="user timeout daemon"
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting $DESC: $NAME"
|
||||
start-stop-daemon --start --oknodo --quiet --exec $DAEMON
|
||||
echo "."
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC: $NAME"
|
||||
start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
|
||||
echo "."
|
||||
;;
|
||||
reload|force-reload)
|
||||
echo -n "Reloading $DESC configuration..."
|
||||
start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON
|
||||
echo "done."
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting $DESC: $NAME"
|
||||
start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
|
||||
sleep 1
|
||||
start-stop-daemon --start --quiet --exec $DAEMON
|
||||
echo "."
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
11
debian/timeoutd.service
vendored
Normal file
11
debian/timeoutd.service
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Timeoutd service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
Type=forking
|
||||
ExecStart=/usr/sbin/timeoutd
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
68
dump_wtmp.c
Normal file
68
dump_wtmp.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
#include <stdio.h>
|
||||
#include <utmp.h>
|
||||
#include <time.h>
|
||||
|
||||
main()
|
||||
{
|
||||
FILE *fp;
|
||||
struct utmp ut;
|
||||
struct tm *tm;
|
||||
char user[9];
|
||||
char host[17];
|
||||
char line[13];
|
||||
|
||||
if ((fp = fopen(UTMP_FILE, "r")) == NULL)
|
||||
{
|
||||
printf("Could not open wtmp file!");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Go to end of file minus one structure */
|
||||
fseek(fp, -1L * sizeof(struct utmp), SEEK_END);
|
||||
|
||||
while (fread(&ut, sizeof(struct utmp), 1, fp) == 1)
|
||||
{
|
||||
tm = localtime(&ut.ut_time);
|
||||
|
||||
/*
|
||||
if (tm->tm_year != now.tm_year || tm->tm_yday != now.tm_yday)
|
||||
break;
|
||||
*/
|
||||
|
||||
printf("%02d:%02d type=", tm->tm_hour,tm->tm_min);
|
||||
switch (ut.ut_type)
|
||||
{
|
||||
#ifndef SUNOS
|
||||
case RUN_LVL: printf("RUN_LVL");
|
||||
break;
|
||||
case BOOT_TIME: printf("BOOT_TIME");
|
||||
break;
|
||||
case NEW_TIME: printf("NEW_TIME");
|
||||
break;
|
||||
case OLD_TIME: printf("OLD_TIME");
|
||||
break;
|
||||
case INIT_PROCESS: printf("INIT_PROCESS");
|
||||
break;
|
||||
case LOGIN_PROCESS: printf("LOGIN_PROCESS");
|
||||
break;
|
||||
case USER_PROCESS: printf("USER_PROCESS");
|
||||
break;
|
||||
case DEAD_PROCESS: printf("DEAD_PROCESS");
|
||||
break;
|
||||
#endif
|
||||
default: printf("UNKNOWN!(type=%d)", ut.ut_type);
|
||||
}
|
||||
strncpy(user, ut.ut_user, 8);
|
||||
user[8] = 0;
|
||||
strncpy(host, ut.ut_host, 16);
|
||||
host[16] = 0;
|
||||
strncpy(line, ut.ut_line, 12);
|
||||
line[12] = 0;
|
||||
printf(" line=%s host=%s user=%s\n", line, host, user);
|
||||
|
||||
|
||||
/* Position the file pointer 2 structures back */
|
||||
if (fseek(fp, -2 * sizeof(struct utmp), SEEK_CUR) < 0) break;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
10
timeoutd.8
10
timeoutd.8
|
@ -54,15 +54,7 @@ to login at that time, or whether they have exceeded their daily time limit.
|
|||
When invoked in this way, by passing a username and tty (without the leading
|
||||
/dev) on the command line,
|
||||
.B timeoutd
|
||||
returns an exit code and may leave an appropriate message.
|
||||
.SH EXIT STATUS
|
||||
When run in daemon mode,
|
||||
.B timeoutd
|
||||
may exit with an exit status of 1, in case of fatal error, or 0, if it has been
|
||||
terminated by another process.
|
||||
.PP
|
||||
When invoked as a normal command, it will exit
|
||||
with one of the following exit codes:
|
||||
returns one of the following exit codes:
|
||||
.IP "0 User is allowed to login
|
||||
.IP "1 Fatal error
|
||||
.IP "5 Incorrect command line format
|
||||
|
|
1845
timeoutd.c
1845
timeoutd.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue