From: Jan Rękorajski Date: Fri, 21 Apr 2006 23:40:26 +0000 (+0000) Subject: - orphaned, outdated X-Git-Tag: AC-STABLE~1 X-Git-Url: https://git.pld-linux.org/gitweb.cgi?a=commitdiff_plain;h=d39b973140aa9aed5fc0a63c7eb6ca225a87a7c2;p=packages%2Fautolog.git - orphaned, outdated Changed files: autolog-0.34.debian.diff -> 1.2 --- diff --git a/autolog-0.34.debian.diff b/autolog-0.34.debian.diff deleted file mode 100644 index 7b346ef..0000000 --- a/autolog-0.34.debian.diff +++ /dev/null @@ -1,359 +0,0 @@ -diff -urN autolog-0.34.orig/Makefile autolog-0.34/Makefile ---- autolog-0.34.orig/Makefile Fri Oct 16 20:38:44 1998 -+++ autolog-0.34/Makefile Fri Oct 16 20:39:16 1998 -@@ -3,9 +3,9 @@ - # The -g flag is to include debugging information. It gets - # stripped back out in the install command anyway. - CC = gcc --CFLAGS = -g --MANDIR = /usr/man --BINDIR = /usr/sbin -+CFLAGS = -O2 -g -Wall -+MANDIR = $(DESTDIR)/usr/man -+BINDIR = $(DESTDIR)/usr/sbin - # ********************************************************* - - autolog: autolog.c -@@ -13,8 +13,9 @@ - - install: autolog - install -s autolog $(BINDIR) -- install -m644 autolog.conf.5 $(MANDIR)/man5 -- install -m644 autolog.8 $(MANDIR)/man8 -+ install -p -m644 autolog.conf.5 $(MANDIR)/man5 -+ install -p -m644 autolog.8 $(MANDIR)/man8 -+ install -p -m644 crontab $(DESTDIR)/etc/cron.d/autolog - - clean: -- rm autolog -+ rm -f autolog -diff -urN autolog-0.34.orig/autolog.8 autolog-0.34/autolog.8 ---- autolog-0.34.orig/autolog.8 Fri Oct 16 20:38:44 1998 -+++ autolog-0.34/autolog.8 Fri Oct 16 20:39:16 1998 -@@ -1,4 +1,4 @@ --.TH AUTOLOG 1L "Administrative Utilities" "Linux" \" -*- nroff -*- -+.TH AUTOLOG 8 "Administrative Utilities" "Linux" \" -*- nroff -*- - .SH NAME - autolog \- Log out idle users - .SH SYNOPSIS -@@ -6,55 +6,59 @@ - .br - .SH DESCRIPTION - The program reads the utmp file, entry by entry. The --username for each 'user process' is compared to the entries in the --configuration file (see --.B autoconf(5) --). The first entry to match both the name, the group, -+username for each `user process' is compared to the entries in the -+configuration file -+.IR autolog.conf . -+The first entry to match both the name, the group, - and the tty line of the process will be used to conduct the automatic - logout. - - .SH OPTIONS - .TP --.B -a -+.I -a - (all processes) Print information on ALL utmp entries--not just user processes. - .TP --.B -d -+.I -d - (debug mode) This is helpful in setting up your configuration file. - The program runs in foreground rather than forking and it prints - out verbose messages about what it is doing. - .TP --.B -n -+.I -n - (nokill) Use this to prevent autolog from actually "killing" - anyone. Use -d and -n together when setting up a new - configuration file. - .TP --.B -f config_file_name --Use this to override the default: "/etc/autolog.conf" --.TP --.B -l log_file_name --Use this to override the default: "/var/log/autolog.log". -+.I -f config_file_name -+Use this to override the default: -+.I /etc/autolog.conf -+.TP -+.I -l log_file_name -+Use this to override the default: -+.IR /var/log/autolog.log . - Note that if this file doesn't exist, no logging will happen. - Create the file (with touch) to enable logging. - .TP --.B -t idle_time -+.I -t idle_time - Use this to override the internal default idle time (minutes) - .TP --.B -g grace_period -+.I -g grace_period - Use this to override the internal default grace period (seconds) - .TP --.B -m yes/no -+.I -m yes/no - Use this to override the internal mailing switch. If "yes" - the program will send mail to the users right after killing them. - .TP --.B -c yes/no -+.I -c yes/no - Use this to override the internal "pre-clear" switch. If "yes" - the program will clear the terminal screen before warning the user. - .TP --.B -w yes/no -+.I -w yes/no - Do timeouts based on total session time--not idle time. (hard) - .TP --.B -L yes/no -+.I -L yes/no - If set to "yes" activities will be written to the logfile if - present. -+.SH "SEE ALSO" -+.BR autolog.conf (5) - .SH AUTHOR - Kyle Bateman -diff -urN autolog-0.34.orig/autolog.c autolog-0.34/autolog.c ---- autolog-0.34.orig/autolog.c Fri Oct 16 20:38:44 1998 -+++ autolog-0.34/autolog.c Fri Oct 16 20:39:16 1998 -@@ -18,11 +18,13 @@ - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -+#include - #include - #include - #include - #include - #include -+#include - #include - #include - #include -@@ -80,7 +82,13 @@ - conf_el c_arr[MAXCONF]; - int c_idx = 0; - --main(int argc, char *argv[]) -+void eat_confile(void); -+int check_idle(void); -+void bailout(const char *message, int status) __attribute__ ((noreturn)); -+void mesg(int flag, char *name, char *dev, int stime, int idle, conf_el *ce); -+int killit(pid_t pid); -+ -+int main(int argc, char *argv[]) - { - int i; - for (i = 1; i < argc; i++) -@@ -132,15 +140,15 @@ - eat_confile(); /* read config file */ - if (!debug) /* if not in debug mode, */ - if (fork()) /* the parent process */ -- exit(0); /* exits */ -+ return 0; /* exits */ - - /* the child processes all utmp file entries: */ - while ((utmpp = getutent()) != (struct utmp *) NULL) - check_idle(); -- exit(0); /* done, so bye */ -+ return 0; /* done, so bye */ - } - --set_defs(int i) -+void set_defs(int i) - { - c_arr[i].name = anystrg; - c_arr[i].group = anystrg; -@@ -154,7 +162,7 @@ - c_arr[i].log = g_log; - } - --eat_confile() -+void eat_confile(void) - { - FILE *f; - char *s, iline[LINELEN]; -@@ -169,7 +177,7 @@ - { - while (fgets(iline, LINELEN, f)) - { -- if (*iline == '#' || strlen(iline) <= 1) -+ if (*iline == '#' || !iline[0] || !iline[1]) - continue; - set_defs(c_idx); - s=strtok(iline,delims); -@@ -207,7 +215,7 @@ - printf("Unknown token in file: %s: %s\n",confname,s); - } - } -- while(s=strtok(0,delims)); -+ while((s=strtok(NULL,delims))); - c_idx++; - } - fclose(f); -@@ -226,7 +234,7 @@ - /* versions of the routine should work for you. */ - #define AVOID_REGEX_BUG - #ifdef AVOID_REGEX_BUG /* some strange bug in re_exec */ --pat_match(char *patt, char *strg) -+int pat_match(char *patt, char *strg) - { - struct re_pattern_buffer rpb; - int len, retval = 0; -@@ -249,16 +257,16 @@ - - #else - /* return true if strg matches the regex in pattern */ --pat_match(char *pattern,char *strg) -+int pat_match(char *pattern,char *strg) - { - re_comp(pattern); - return(re_exec(strg)); - } - #endif - --check_idle() /* select utmp entries needing killing */ -+int check_idle(void) /* select utmp entries needing killing */ - { -- char dev[STRLEN], name[STRLEN], prname[STRLEN], *gn = ""; -+ char dev[STRLEN], name[STRLEN], *gn = ""; - struct stat status; - time_t idle, pres_time, start, time(), stime, atime; - struct passwd *passwd_entry; -@@ -272,8 +280,7 @@ - printf("Non-user process: N:%-8s P:%5d Login:%s",utmpp->ut_user,utmpp->ut_pid,ctime(&utmpp->ut_time)); - return(0); /* skip the utmp entry */ - } -- sprintf(prname,"/proc/%d",utmpp->ut_pid); /* make filename to check in /proc */ -- if (stat(prname, &status)) /* is this a current process */ -+ if (kill(utmpp->ut_pid,0)) /* is this a current process? */ - { - if (listall) - printf("Dead process: N:%-8s P:%5d Login:%s",utmpp->ut_user,utmpp->ut_pid,ctime(&utmpp->ut_time)); -@@ -293,7 +300,7 @@ - name[UT_NAMESIZE] = '\0'; /* null terminate user name string */ - - if (debug) -- printf("\nChecking: %-11s on %-12s I:%-4d T:%d Login: %s",name,dev,idle,utmpp->ut_type,ctime(&utmpp->ut_time)); -+ printf("\nChecking: %-11s on %-12s I:%-4ld T:%d Login: %s",name,dev,idle,utmpp->ut_type,ctime(&utmpp->ut_time)); - - /* now try to find the group of this person */ - /* if usernames in utmp are limited to 8 chars, we will may fail on */ -@@ -303,7 +310,7 @@ - if (passwd_entry) - { - strcpy(name,passwd_entry->pw_name); -- if(group_entry = getgrgid( passwd_entry->pw_gid )) -+ if((group_entry = getgrgid( passwd_entry->pw_gid ))) - gn = group_entry->gr_name; - else if (debug) - printf("Can't find group entry for user: %s\n",name); -@@ -317,8 +324,8 @@ - pat_match(c_arr[i].line,utmpp->ut_line)) - { - if (debug) -- printf("Match #%2d: U:%-12s Grp:%-8s Line:%-9s Pid:%-6d Sess:%3d:%02d\n", -- i+1,name,gn,utmpp->ut_line,utmpp->ut_pid,stime/60,stime%60); -+ printf("Match #%2d: U:%-12s Grp:%-8s Line:%-9s Pid:%-6d Sess:%3ld:%02d\n", -+ i+1,name,gn,utmpp->ut_line,utmpp->ut_pid,stime/60,(int)(stime%60)); - if (!c_arr[i].idle) /* if user exempt (idle=0) */ - { - if (debug) -@@ -338,14 +345,14 @@ - if (!c_arr[i].hard) /* if considering idle time */ - { - if (debug) -- printf("Subject to logout Idle time: %4d (%2d allowed)\n",idle,ce->idle); -+ printf("Subject to logout Idle time: %4ld (%2d allowed)\n",idle,ce->idle); - if (idle < ce->idle) /* if user was recently active */ - return(0); /* let it live */ - } - else - { - if (debug) -- printf("Subject to logout Total time: %4d (%2d allowed)\n",stime,ce->idle); -+ printf("Subject to logout Total time: %4ld (%2d allowed)\n",stime,ce->idle); - if (stime < ce->idle) /* if user still under limit */ - return(0); /* let it live */ - } -@@ -378,7 +385,7 @@ - return(0); - } - --mesg(int flag, char *name, char *dev, int stime, int idle, conf_el *ce) -+void mesg(int flag, char *name, char *dev, int stime, int idle, conf_el *ce) - { - char mbuf[LINELEN]; /* message buffer */ - time_t tvec; -@@ -417,10 +424,10 @@ - fprintf(log, "** LOGOFF ** %s %s idle:%d sess:%d %s",name, dev+5, idle, stime, ctime(&tvec)+3); - if (ce->mail) - { -- sprintf(mbuf, "/bin/mail %s", name); -+ sprintf(mbuf, "/usr/sbin/sendmail %s", name); - /* open pipe to mail program for writing */ - if (!(mprog = popen(mbuf, "w")) ) -- bailout("Can't use /bin/mail program", 6); -+ bailout("Can't use /usr/sbin/sendmail program", 6); - fprintf(mprog, "Subject: Excess Idle Time\nLogged off - excess idle time - %s %s\ntty = %s\n",name, ctime(&tvec), dev+5); - fclose(mprog); - } -@@ -431,18 +438,18 @@ - fprintf(log, "** LOGOFF-FAIL ** %s (pid = %d) %s (%d min idle time) %s",name, utmpp->ut_pid, dev+5, idle, ctime(&tvec)+3); - if (ce->mail) - { -- sprintf(mbuf, "/bin/mail root"); -+ sprintf(mbuf, "/usr/sbin/sendmail root"); - if ((mprog = popen(mbuf, "w")) == (FILE *) NULL) -- bailout("Can't use /bin/mail program", 7); -+ bailout("Can't use /usr/sbin/sendmail program", 7); - fprintf(mprog, "Subject: Can't logoff %s\nCan't Log off - %s %s\ntty = %s\n", name, name, ctime(&tvec), dev+5); - fclose(mprog); - } - } -- fclose(log); -- return(0); -+ if (log) -+ fclose(log); - } - --killit(int pid) /* terminate process using SIGHUP, then SIGKILL */ -+int killit(pid_t pid) /* terminate process using SIGHUP, then SIGKILL */ - { - kill(pid, SIGHUP); /* first send "hangup" signal */ - sleep(KWAIT); -@@ -459,8 +466,8 @@ - return(1); /* successful kill with SIGHUP */ - } - --bailout(char *message, int status) /* display error message and exit */ -+void bailout(const char *message, int status) /* display error message and exit */ - { -- fprintf(stderr,"autologout: %s\n", message); -+ fprintf(stderr,"autologout: %s (%m)\n", message); - exit(status); - } -diff -urN autolog-0.34.orig/autolog.conf.5 autolog-0.34/autolog.conf.5 ---- autolog-0.34.orig/autolog.conf.5 Fri Oct 16 20:38:44 1998 -+++ autolog-0.34/autolog.conf.5 Fri Oct 16 20:39:16 1998 -@@ -1,4 +1,4 @@ --.TH autolog.conf 1L "Configuration Files" "Linux" \" -*- nroff -*- -+.TH autolog.conf 5 "Configuration Files" "Linux" \" -*- nroff -*- - .SH NAME - autolog.conf \- Configuration file for the autolog command - .SH DESCRIPTION -@@ -32,7 +32,7 @@ - entry which has all values set from the defaults. This entry will match - any process on any port (name=.+ line=.+ group=.+). Therefore, the default - action is to kill all processes. --.SH ENTRYS -+.SH ENTRIES - .TP - .B name= - A regular expression specifying which username(s) to match. -diff -urN autolog-0.34.orig/crontab autolog-0.34/crontab ---- autolog-0.34.orig/crontab Thu Jan 1 01:00:00 1970 -+++ autolog-0.34/crontab Fri Oct 16 20:39:17 1998 -@@ -0,0 +1 @@ -+*/10 * * * * root test -x /usr/sbin/autolog && /usr/sbin/autolog