--- sac-1.9b5.orig/wcat.c +++ sac-1.9b5/wcat.c @@ -274,17 +274,17 @@ fprintf(stderr,"wcat: Invalid time. Format: hours[:minutes[:seconds]]\n"); break; case 4: - fprintf(stderr,"usage: wcat [-w wtmp|-] [-adX[3|4]] [-s start] [-e end] [-b H[:M[:S]]]\n [--help] [--version]\n"); - fprintf(stderr," -w wtmp|- Read alternate wtmp file.\n"); - fprintf(stderr," -X[3] Read tacacs 3.x wtmp format.\n"); - fprintf(stderr," -X4 Read tacacs 4.0 wtmp format.\n"); - fprintf(stderr," -d Output time in MMM DD HH:MM:SS date format.\n"); - fprintf(stderr," -a Print contents of ut_addr (if it exists) instead of ut_host.\n"); - fprintf(stderr," -s start Display accounting info from `start'.\n"); - fprintf(stderr," -e end Display accounting info up to `end'.\n"); - fprintf(stderr," -b H:M:S Show accounting info from the last few hours/minutes/seconds.\n"); - fprintf(stderr," --help Print this help message.\n"); - fprintf(stderr," --version Print the version of rawtmp.\n"); + fprintf(stdout,"usage: wcat [-w wtmp|-] [-adX[3|4]] [-s start] [-e end] [-b H[:M[:S]]]\n [--help] [--version]\n"); + fprintf(stdout," -w wtmp|- Read alternate wtmp file.\n"); + fprintf(stdout," -X[3] Read tacacs 3.x wtmp format.\n"); + fprintf(stdout," -X4 Read tacacs 4.0 wtmp format.\n"); + fprintf(stdout," -d Output time in MMM DD HH:MM:SS date format.\n"); + fprintf(stdout," -a Print contents of ut_addr (if it exists) instead of ut_host.\n"); + fprintf(stdout," -s start Display accounting info from `start'.\n"); + fprintf(stdout," -e end Display accounting info up to `end'.\n"); + fprintf(stdout," -b H:M:S Show accounting info from the last few hours/minutes/seconds.\n"); + fprintf(stdout," --help Print this help message.\n"); + fprintf(stdout," --version Print the version of rawtmp.\n"); break; case 5: { --- sac-1.9b5.orig/gronk.c +++ sac-1.9b5/gronk.c @@ -634,7 +634,7 @@ if (lp->port == port) break; if (st) { - struct user *p; + struct sac_user *p; for(p=usr;p;p=p->nxt) if (!strncmp(su->u.ut_line,p->line,UT_LINESIZE) && (hosttoo? !strncmp(su->u.ut_host,p->host,UT_HOSTSIZE) : TRUE)) goto found_one; --- sac-1.9b5.orig/sac.h +++ sac-1.9b5/sac.h @@ -145,12 +145,12 @@ struct hosts *nxt; }; -struct user { +struct sac_user { char user[UT_NAMESIZE+1]; char line[UT_LINESIZE+1]; char host[UT_HOSTSIZE+1]; time_t in; - struct user *nxt; + struct sac_user *nxt; }; enum filetype { @@ -196,7 +196,7 @@ EXTERN struct simuse *simuse INIT(NULL); EXTERN struct tty *ttys INIT(NULL); EXTERN struct hosts *hosts INIT(NULL); -EXTERN struct user *usr INIT(NULL); +EXTERN struct sac_user *usr INIT(NULL); #ifdef MAIN char *month[13] = { --- sac-1.9b5.orig/Makefile +++ sac-1.9b5/Makefile @@ -14,12 +14,12 @@ # For Intel platforms (use -m386 w/ AMD CPU's for better speed): #CFLAGS=-Wall -O2 -fomit-frame-pointer -m486 # For everything else: -#CFLAGS=-Wall -O2 +CFLAGS=-Wall -O2 # For debugging -CFLAGS=-ggdb +#CFLAGS=-ggdb # Comment this if doing debugging. -#LDFLAGS=-s +LDFLAGS=-s # Define acording to your architechure. Only SOLARIS, BSD and LINUX are valid # thus far. Most OS's should work with one of them. --- sac-1.9b5.orig/proto.h +++ sac-1.9b5/proto.h @@ -14,10 +14,10 @@ void do_reboot(time_t t); void changetime(time_t t, char *line); void cleanup(void); -void release(struct user *u, time_t t, struct sactmp *su, int usext, int siminc); +void release(struct sac_user *u, time_t t, struct sactmp *su, int usext, int siminc); void addlogin(struct login **login, struct login **last, time_t in, time_t out, char *name, char *tty, char *host); void apply_hours(time_t in, time_t out,time_t start, time_t h[24]); -void user_apply_hours(struct user *u, time_t out, struct day *d); +void user_apply_hours(struct sac_user *u, time_t out, struct day *d); void tty_apply_hours(time_t in, time_t out, struct day *d, struct tty *t); char *getwrd(char *s); struct usr *adduser(struct usr **up, char *s); --- sac-1.9b5.orig/sac.c +++ sac-1.9b5/sac.c @@ -671,7 +671,7 @@ void saclogin(struct sactmp su) { - struct user *q; + struct sac_user *q; struct day *d; struct usr *u = NULL, *up; int l; @@ -683,7 +683,7 @@ saclogout(su,FALSE); /* printf ("Logging in %s [%s] <%ld>...\n",u.ut_user,u.ut_line,u.ut_time); */ - q = bmalloc(sizeof(struct user)); + q = bmalloc(sizeof(struct sac_user)); strncpy(q->line,su.u.ut_line,UT_LINESIZE); strncpy(q->user,su.u.ut_user,UT_NAMESIZE); strncpy(q->host,su.u.ut_host,UT_HOSTSIZE); @@ -744,7 +744,7 @@ void saclogout(struct sactmp su, int usext) { - struct user *p, *q; + struct sac_user *p, *q; struct usr *u = NULL, *up; struct day *d; @@ -841,7 +841,7 @@ */ void do_reboot(time_t t) { - struct user *p; + struct sac_user *p; struct day *d; struct usr *u; @@ -884,7 +884,7 @@ void changetime(time_t t, char *line) { static time_t old = 0; - struct user *p; + struct sac_user *p; signed long dif; if (!strcmp("|",line)) { @@ -913,7 +913,7 @@ { time_t t = time(0); struct day *lastday; - struct user *p; + struct sac_user *p; struct usr *u; /* Ooops, the -t option can't just ignore time that isn't in our days list @@ -954,11 +954,11 @@ * out >= start && out <= stop || * in < start && out > stop */ -void release(struct user *u, time_t t, struct sactmp *su, int usext, int siminc) +void release(struct sac_user *u, time_t t, struct sactmp *su, int usext, int siminc) { struct day *p; struct usr *up; - struct user *q; + struct sac_user *q; struct tty *tp; struct simuse *s; int i; @@ -1250,7 +1250,7 @@ } } -void user_apply_hours(struct user *u, time_t out, struct day *d) +void user_apply_hours(struct sac_user *u, time_t out, struct day *d) { int i; time_t b, e; @@ -1410,7 +1410,6 @@ if (!strncmp(t->line,l,UT_LINESIZE)) return t; return NULL; } - void addtty(char *s) { struct ttys *t; @@ -1913,7 +1912,10 @@ for(i=0;i<24;i++) sp->h[i] += s->h[i]; if (s->login == NULL) continue; if (sp->login == NULL) sp->login = s->login; - else sp->lastlogin->nxt = s->login; + else { + if (sp->lastlogin == NULL) sp->login = s->login; + else sp->lastlogin->nxt = s->login; + } sp->lastlogin = s->lastlogin; } } --- sac-1.9b5.orig/debian/sac-1.8b8.lsm +++ sac-1.9b5/debian/sac-1.8b8.lsm @@ -0,0 +1,18 @@ +Begin3 +Title: sac +Version: 1.8 beta 8 +Entered-date: 06/18/99 +Description: << THIS IS BETA SOFTWARE, USE AT YOUR OWN RISK >> + Performs login accounting, just like the ac program but with + total, per day, per user and per tty. Also performs average + usage, hourly profiling, login listing, login clipping and raw + wtmp reporting. Tons of other options. + Supports Tacacs 3.x - 4.x and most Radius accounting files. +Keywords: login accounting wtmp ac tacacs radius cistron +Author: ice@mama.indstate.edu (Steve Baker) +Maintained-by: ice@mama.indstate.edu (Steve Baker) +Primary-site: mama.indstate.edu /linux/sac + 73220 sac-1.8b8.tgz +Platforms: Linux +Copying-policy: Open Source +End --- sac-1.9b5.orig/debian/substvars +++ sac-1.9b5/debian/substvars @@ -0,0 +1 @@ +shlibs:Depends=libc6 (>= 2.7-1) --- sac-1.9b5.orig/debian/dirs +++ sac-1.9b5/debian/dirs @@ -0,0 +1,2 @@ +usr/share/man/man1 +usr/share/man/man8 --- sac-1.9b5.orig/debian/sac.manpages +++ sac-1.9b5/debian/sac.manpages @@ -0,0 +1,4 @@ +debian/wcat.1 +rawtmp.1 +sac.8 +writetmp.8 --- sac-1.9b5.orig/debian/rules +++ sac-1.9b5/debian/rules @@ -0,0 +1,70 @@ +#!/usr/bin/make -f + +p=sac + +build: build-arch + dh_testdir + touch build + +build-arch: + dh_testdir + $(MAKE) "CFLAGS=-Wall -O2 -fomit-frame-pointer" + touch build-arch + +clean: + dh_testdir + -rm -f build build-arch + -$(MAKE) clean + dh_clean + +binary-indep: build + dh_testdir + dh_testroot +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. +# + +install: install-arch install-indep + +install-indep: + +install-arch: + dh_testdir + dh_testroot + dh_clean -k -s + dh_installdirs -s + make install BINDIR=debian/sac/usr/bin MANDIR=debian/sac/usr/share/man + dh_install -s + + +binary-arch: build-arch install-arch + dh_testdir -a + dh_testroot -a + dh_installdocs -a debian/README.Debian debian/*.lsm README THANKS TODO debian/notes + dh_installexamples -a scripts/* + dh_installdebconf -a + dh_installman -a + dh_installchangelogs -a CHANGES + dh_link -a + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +checkroot: + dh_testdir + dh_testroot + +.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch checkroot --- sac-1.9b5.orig/debian/debhelper.log +++ sac-1.9b5/debian/debhelper.log @@ -0,0 +1,11 @@ +dh_installdirs +dh_installdebconf +dh_installdocs +dh_installexamples +dh_installchangelogs +dh_installmanpages +dh_strip +dh_fixperms +dh_compress +dh_installdeb +dh_gencontrol --- sac-1.9b5.orig/debian/copyright +++ sac-1.9b5/debian/copyright @@ -0,0 +1,26 @@ +Downloaded from: +ftp://mama.indstate.edu/linux/sac/ + +Packaged for Debian by "Edward Brocklesby " + +This program is Copyrighted by Steve Baker + +The source contains the following copyright: +============================================ + + This is Sac, which stands for System ACcounting or maybe Steve's AC... =) + + It's absolutely free, use it, abuse it, talk dirty to it... _I don't care_. + + This program is freely distributable free-ware with no limitations on +copying or redistribution. If it breaks, well it's probably my fault, but +I won't admit to it! + + Feel free to improve it if you can... Wtmp documentation I have really is +lacking and so I am definitely not handling some certain cases, especially +with respect to time warps. A nice graphical front end for showing pretty +graphs of usage would be nice. Seems some people need pictures to +understand data... I blame TV! + + You can for the time being contact me via e-mail at ice@mama.indstate.edu. +I'll try and help you add in new features or whatever else you need. --- sac-1.9b5.orig/debian/README.Debian +++ sac-1.9b5/debian/README.Debian @@ -0,0 +1,13 @@ +Information on the Debian package changes: + +The previous maintainer Edward Brocklesby modified +it to compile and install cleanly on debian (see the changelog), I (Javier) +have made some slight changes to the latest upstream to get it to compile +and upload to Debian's woody the latest version available. + +TODO things: + +- A new package to provide the cgi scipts and install cleanly in /usr/lib/cgi-bin might be interesting, currently this is in the /usr/share/doc/sac/examples dir + + +-- Javier Fernández-Sanguino Peña --- sac-1.9b5.orig/debian/control +++ sac-1.9b5/debian/control @@ -0,0 +1,14 @@ +Source: sac +Section: admin +Priority: optional +Maintainer: Javier Fernandez-Sanguino Pen~a +Build-Depends: debhelper +Standards-Version: 3.5.6.1 + +Package: sac +Architecture: any +Depends: ${shlibs:Depends} +Description: Login accounting + Performs login accounting, just like the ac program but with + totals, per day and per users. Also performs average usage + and hourly profiling. Tons of other options. --- sac-1.9b5.orig/debian/changelog +++ sac-1.9b5/debian/changelog @@ -0,0 +1,176 @@ +sac (1.9b5-3) unstable; urgency=low + + * Fix "sac ftbfs on armel and armhf. struct user conflicts with system + header": add patch from Peter Green (renames struct user to sac_user). + (Closes: #651581) + Thanks to Gregor Herrmann for preparing a fix for this bug. + + -- Javier Fernandez-Sanguino Pen~a Sun, 25 Dec 2011 19:27:17 +0100 + +sac (1.9b5-2) unstable; urgency=low + + * Fix bashishm in example script (pretty) but at the same time make it + bash-specific since the 'while read' loop does not read information from + stdin in dash as in bash (it doesn't chomp whitespaces) (Closes: #489655) + * Use DEBHELPER compatibility version 5 and adapt debian/rules accordingly + + -- Javier Fernandez-Sanguino Pen~a Mon, 07 Jul 2008 19:54:29 +0200 + +sac (1.9b5-1) unstable; urgency=low + + * New upstream release, already fixes the typo in manpage (Closes: #284548) + + -- Javier Fernandez-Sanguino Pen~a Tue, 7 Dec 2004 11:49:30 +0100 + +sac (1.9b3-3) unstable; urgency=low + + * Provided manpage for wcat. + * Changed wcat behaviour so it outputs usage to stdout instead of + stderr (for help2man to work) + * Compilation in sid fixes lintian errors. + * Changed ispat from char to int, preliminary fix which should remove + the warnings due to signedness until Steve Baker confirms this + issue (Closes: #176380) + + -- Javier Fernandez-Sanguino Pen~a Sat, 18 Jan 2003 10:57:29 +0100 + +sac (1.9b3-2) unstable; urgency=low + + * Applied a patch provided by Steve Baker (Closes: #139116) + + -- Javier Fernandez-Sanguino Pen~a Tue, 26 Nov 2002 22:52:33 +0100 + +sac (1.9b3-1) unstable; urgency=low + + * New upstream version. + * Applied a patch that seems to fix bug #139116, will not close it + until I get confirmation from the upstream maintainer. + + -- Javier Fernandez-Sanguino Pen~a Mon, 25 Nov 2002 22:09:14 +0100 + +sac (1.9b1-2) unstable; urgency=low + + * Added Build-Depends for debhelper + * Updated Standards-Version + + -- Javier Fernandez-Sanguino Pen~a Tue, 14 May 2002 10:10:13 +0200 + +sac (1.9b1-1) unstable; urgency=low + + * New upstream version. + * Now the Y2k bug is fixed (Closes: #64321) + * New maintainer (Closes: #68069) + * Moved to new standard and dh_ (now lintian clean) + + -- Javier Fernandez-Sanguino Pen~a Fri, 20 Oct 2000 10:07:21 +0200 + +sac (1.8b8-1) unstable; urgency=low + + * New upstream version. + * Makefile: Removed -m486 + * Makefile: /usr/man -> /usr/share/man + * debian/control: New standards-versoim 3.0.0.0 + + -- Edward Brocklesby Mon, 5 Jul 1999 12:08:13 -0700 + +sac (1.8b6-2) unstable; urgency=low + + * New maintainer. + + -- Edward Brocklesby Mon, 5 Jul 1999 11:21:17 -0700 + +sac (1.8b6-1) unstable; urgency=low + + * + * new upstream release; Fix: + #23069: Issuing 'sac -r' seg faults and dumps core. + #18537: sac: segfault with sac -c. + #17143: sac - return type of main in not int. + #18536: sac: minor formatting problem. + #15520: sac: Broken stats. + + -- Vincent Renardias Mon, 4 Jan 1999 18:39:26 +0100 + +sac (1.7-1) frozen unstable; urgency=low + + * new upstream release; Fix: + #15520: Broken stats. + #18526: minor formatting problem. + #18527: segfault with sac -c. + + -- Vincent Renardias Mon, 13 Apr 1998 23:09:38 +0200 + +sac (1.6-1) unstable; urgency=low + + * Renamed upstream changelog (Bug #9662). + * Updated .lsm file. + + -- Vincent Renardias Sun, 9 Nov 1997 17:35:00 +0100 + +sac (1.6-0) unstable; urgency=low + + * compiled for libc6 + * new upstream release + * non-maintainer release + + -- Craig Sanders Sun, 9 Nov 1997 12:17:34 +1100 + +sac (1.5-2) unstable; urgency=low + + * Correct bug wrt radiusd (Corrects bug #7466). + + -- Vincent Renardias Wed, 19 Feb 1997 01:25:11 +0100 + +sac (1.5-1) unstable; urgency=low + + * Upstream upgrade. + * Reworked 'debian/rules'. + + -- Vincent Renardias Tue, 18 Feb 1997 02:02:38 +0100 + +sac (1.4-2) unstable; urgency=low + + * Changed Makefile to allow compilation on non-intel machines. + (Fixes bug #7192) + + -- Vincent Renardias Sun, 9 Feb 1997 23:16:14 +0100 + +sac (1.4-1) unstable; urgency=low + + * Upstream upgrade. + * Changed default wtmp file from /etc/wtmp to /var/log/wtmp + + -- Vincent Renardias Tue, 12 Nov 1996 00:59:39 +0100 + +sac (1.3.1-4) unstable; urgency=low + + * Changed libraries dependencies. + * Changed compile options. + * Cosmetic debian/* file changes. + + -- Vincent Renardias Sat, 2 Nov 1996 01:35:17 +0100 + +sac (1.3.1-3) unstable; urgency=low + + * Maintainer changed + * Gzip'ed man pages / striped executables + * Changed libraries dependencies + + -- Vincent Renardias Sat, 19 Oct 1996 02:56:15 +0200 + +sac (1.3.1-2) unstable; urgency=low + + * Two machine dependencies cleared up + + -- Christoph Lameter Fri, 20 Sep 1996 14:51:46 +0800 + +sac (1.3.1-1) unstable; urgency=low + + * Initial Release + + -- Christoph Lameter Fri, 20 Sep 1996 14:51:46 +0800 + +Local variables: +mode: debian-changelog +End: + --- sac-1.9b5.orig/debian/compat +++ sac-1.9b5/debian/compat @@ -0,0 +1 @@ +5 --- sac-1.9b5.orig/debian/wcat.1 +++ sac-1.9b5/debian/wcat.1 @@ -0,0 +1,75 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.29. +.TH WCAT "1" "January 2003" "wcat v1.0 (c) 2001 by Steve Baker" "User Commands" +.SH NAME +wcat \- printout wtmp entries +.SH SYNOPSIS +wcat [-w wtmp|-] [-adX[3|4]] [-s start] [-e end] [-b H[:M[:S]]] +[--help] [--version] +.br +.SH SYNOPSIS +.P +.B Wcat +provides an easy way to recover trimmed information from wtmp binary +files. This tool can be useful for scripts that need only partial information +from them. +.P +Notice that +.B wcat +output is +.B binary +wtmp entries so if this information is printed out to a terminal or screen +it might mess it up. A better use of wcat would be: +.B wcat | rawtmp -w - +.br +.SH OPTIONS +.TP +\fB\-w\fR wtmp|- +Read alternate wtmp file. +.TP +\fB\-X[3]\fR +Read tacacs 3.x wtmp format. +.TP +\fB\-X4\fR +Read tacacs 4.0 wtmp format. +.TP +\fB\-d\fR +Output time in MMM DD HH:MM:SS date format. +.TP +\fB\-a\fR +Print contents of ut_addr (if it exists) instead of ut_host. +.TP +\fB\-s\fR start +Display accounting info from `start'. +.TP +\fB\-e\fR end +Display accounting info up to `end'. +.TP +\fB\-b\fR H:M:S +Show accounting info from the last few hours/minutes/seconds. +.TP +\fB\-\-help\fR +Print this help message. +.TP +\fB\-\-version\fR +Print the version of rawtmp. +.br +.SH "SEE ALSO" +.BR sac (8), +.BR ac (1), +.BR last (1), +.BR rawtmp (1), +.BR wtmp (5), +.BR netdate (8L) +.SH FILES +/var/log/wtmp login database +.br +/usr/adm/radacct/.../detail Radius accounting logs +.SH AUTHOR +.P +The upstream author of +.B wcat +is Steve Baker (ice@mama.indstate.edu) +.P +This manpage was written by Javier Fernandez-Sanguino based on +.B help2man +for the Debian GNU/Linux distribution (but can be used by others). --- sac-1.9b5.orig/debian/notes +++ sac-1.9b5/debian/notes @@ -0,0 +1,13 @@ +I got this from sunsite.unc.edu:/pub/Linux/system/Admin/login. + +We use this tool for statistics of our modem pools: + +Example our command sac: + +sac $* -T ttyD1 ttyD2 ttyD3 ttyD4 ttyD5 ttyD6 ttyD7 ttyD8 ttyD9 ttyD10 \ +ttyD11 ttyD12 ttyD13 ttyD14 ttyD15 ttyD16 ttyS0 ttyS1 + +reports on all the usage on our digiboard pool ttyDx and our regular serial +ports. + +Edward Brocklesby --- sac-1.9b5.orig/scripts/pretty +++ sac-1.9b5/scripts/pretty @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Use: pretty [] # @@ -14,7 +14,7 @@ do read line echo " $line" - logins=$[$logins-1] + logins=$(($logins-1)) done echo "------------------------------------------------------------------------------" done