Hello community,
here is the log from the commit of package autolog
checked in at Tue Dec 19 16:58:32 CET 2006.
--------
--- autolog/autolog.changes 2006-05-26 20:35:53.000000000 +0200
+++ /mounts/work_src_done/STABLE/autolog/autolog.changes 2006-12-19 15:43:41.000000000 +0100
@@ -1,0 +2,8 @@
+Tue Dec 19 15:39:53 CET 2006 - anicka@suse.de
+
+- update to 0.40 (taken from Debian)
+- fix many compiler warnings
+- change a path to mail program
+- add init script
+
+-------------------------------------------------------------------
Old:
----
autolog-0.35.patch
autolog-0.35.tgz
New:
----
autolog
autolog-0.40.diff
autolog-0.40.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ autolog.spec ++++++
--- /var/tmp/diff_new_pack.XaPZfb/_old 2006-12-19 16:57:11.000000000 +0100
+++ /var/tmp/diff_new_pack.XaPZfb/_new 2006-12-19 16:57:11.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package autolog (Version 0.35)
+# spec file for package autolog (Version 0.40)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,14 +11,15 @@
# norootforbuild
Name: autolog
-License: GPL
+License: GNU General Public License (GPL)
Group: System/Daemons
Autoreqprov: on
-Version: 0.35
-Release: 734
+Version: 0.40
+Release: 1
Summary: Auto Logout
-Source: autolog-%{version}.tgz
-Patch: autolog-%{version}.patch
+Source: autolog-%{version}.tar.bz2
+Source1: autolog
+Patch: autolog-%{version}.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -31,7 +32,7 @@
Kyle Bateman
%prep
-%setup
+%setup -q
%patch
%build
@@ -39,9 +40,10 @@
make CC=gcc CFLAGS="$RPM_OPT_FLAGS"
%install
-mkdir -p $RPM_BUILD_ROOT/{etc,usr/share/man/{man5,man8},usr/sbin}
-make install MANDIR=$RPM_BUILD_ROOT/%{_mandir} BINDIR=$RPM_BUILD_ROOT/usr/sbin
-install -m 644 autolog.conf $RPM_BUILD_ROOT/etc
+mkdir -p $RPM_BUILD_ROOT/{etc,usr/share/man/{man5,man8},usr/sbin,etc/init.d,/var/log}
+make install MANDIR=$RPM_BUILD_ROOT/%{_mandir} BINDIR=$RPM_BUILD_ROOT/%{_sbindir} LOGDIR=$RPM_BUILD_ROOT/var/log CONFIGDIR=$RPM_BUILD_ROOT/etc
+install -m 744 %{S:1} $RPM_BUILD_ROOT/etc/init.d
+ln -sf ../../etc/init.d/autolog $RPM_BUILD_ROOT/%{_sbindir}/rcautolog
%clean
rm -rf "$RPM_BUILD_ROOT"
@@ -52,10 +54,18 @@
%doc README
%config /etc/autolog.conf
/usr/sbin/autolog
+%{_sbindir}/rcautolog
%doc /usr/share/man/man5/autolog.conf.5.gz
%doc /usr/share/man/man8/autolog.8.gz
+/var/log/autolog.log
+/etc/init.d/autolog
%changelog -n autolog
+* Tue Dec 19 2006 - anicka@suse.de
+- update to 0.40 (taken from Debian)
+- fix many compiler warnings
+- change a path to mail program
+- add init script
* Fri May 26 2006 - schwab@suse.de
- Don't strip binaries.
* Wed Jan 25 2006 - mls@suse.de
++++++ autolog-0.40.diff ++++++
--- Makefile
+++ Makefile
@@ -8,16 +8,17 @@
BINDIR = /usr/sbin/
LOGDIR = /var/log/
INIDIR = /sbin/init.d/
+CONFIGDIR = /etc
# *********************************************************
autolog: autolog.c
$(CC) $(CFLAGS) -o autolog autolog.c
install: autolog
- install -m744 -o 0 -g 0 autolog $(BINDIR)
- install -m744 -o 0 -g 0 autolog.init $(INIDIR)/autolog
- install -m644 -o 0 -g 0 autolog.conf /etc
- install -m644 -o 0 -g 0 autolog.log $(LOGDIR)
+ install -m744 autolog $(BINDIR)
+ #install -m744 autolog.init $(INIDIR)/autolog
+ install -m644 autolog.conf $(CONFIGDIR)
+ install -m644 autolog.log $(LOGDIR)
install -m644 autolog.conf.5.gz $(MANDIR)/man5
install -m644 autolog.8.gz $(MANDIR)/man8
--- autolog.c
+++ autolog.c
@@ -62,6 +62,9 @@
#include
#include
#include
+#include
+#include
+#include
#define D_IDLE 30 /* maximum idle time (minutes) */
#define D_GRACE 120 /* grace time (sec) for user reply */
@@ -114,7 +117,7 @@
int listall = 0;
char *confname = "/etc/autolog.conf";
char *logfname = "/var/log/autolog.log";
-char *datfname = "/tmp/autolog.data";
+char *datfname = "/var/lib/autolog/autolog.data";
int g_idle = D_IDLE;
int g_grace = D_GRACE;
int g_hard = D_HARD;
@@ -158,7 +161,24 @@
char *ps_cmd;
-main(int argc, char *argv[])
+int check_idle();
+void eat_confile();
+void bailout();
+int killit(int);
+int mesg(int, char*, char*, int, int, conf_el *);
+int log_msg(char *message);
+int load_users();
+void show_results();
+int check_utmp();
+int kill_lost_PIDs();
+int save_users();
+int kill_PIDs(char *u_name);
+void kill_HUP(int pid);
+void kill_KILL(int pid);
+int kill_Res(int pid);
+void lower_sleep(int sleep_left);
+
+int main(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++){
@@ -202,9 +222,10 @@
load_users();
if (debug){
printf("\n");
- printf("Aus der Datei eingelesen:\n");
+ printf("From the datafile:\n");
printf("=========================\n");
show_results();
+ printf("Done reading datafile\n");
}
/* now sit in an infinite loop and work */
@@ -234,7 +255,7 @@
chck_pid = pres_time+10*60;
if (debug)
- printf("next check for processes after %10d.\n",chck_pid);
+ printf("next check for processes after %10d.\n",(int)chck_pid);
}
if (debug)
@@ -247,6 +268,7 @@
(sleeptime < sleep_max) ); /* or users are to be kicked off */
save_users();
log_msg("Stopped service");
+ return 0;
}
/***************************************************************
@@ -255,7 +277,7 @@
* - earliest start-time of all logins. *
***************************************************************/
-check_utmp(){ /* select utmp entries needing killing */
+int check_utmp(){ /* select utmp entries needing killing */
char dev[STRLEN], name[STRLEN], prname[STRLEN];
char *msg;
@@ -275,11 +297,11 @@
if (listall)
printf("%s N:%-8s P:%5d Login:%s",
msg,utmpp->ut_user,utmpp->ut_pid,ctime(&utmpp->ut_time));
- return(0);
+ return(1);
}
if (stat(dev, &status)){ /* if can't get status for port */
bailout("Can't get status of user's terminal", 1);
- return(0);
+ return(1);
}
/*.. Find out everything about current time, sleep time and session time. ...*/
@@ -294,7 +316,7 @@
if (listall)
printf("Checking: %-11s on %-12s I:%4d T:%d Login: %s",
- name,dev,idle,utmpp->ut_type,ctime(&utmpp->ut_time));
+ name,dev,(int)idle,utmpp->ut_type,ctime(&utmpp->ut_time));
strcpy(userlst[0].Name, name);
strcpy(userlst[0].Device,utmpp->ut_line);
@@ -328,9 +350,10 @@
userlst[userpos].SessStrt = utmpp->ut_time;
}
}
+ return 0;
}
-show_results(){
+void show_results(){
int userpos=0; /* position of user found, 0 => not found */
printf("\nfound: %2d\n\n",userfill);
@@ -345,14 +368,14 @@
}
}
-save_users(){
+int save_users(){
int userpos=0; /* position of user found, 0 => not found */
FILE* f;
if (!(f=fopen(datfname,"w+"))) {
bailout("Can't create data-file.", 6);
- return;
+ return 1;
}
fprintf(f,"%d\n",userfill);
@@ -365,15 +388,16 @@
userlst[userpos].Ban_Ends,userlst[userpos].WarnEnds);
}
fclose(f);
+ return 0;
}
-load_users(){
+int load_users(){
int userpos=0; /* position of user found, 0 => not found */
FILE* f;
/*.. if no table exists, no problem, just return. ...........................*/
- if (!(f=fopen(datfname,"r"))) { return; }
+ if (!(f=fopen(datfname,"r"))) { return 1; }
/*.. check, how many lines with data will follow. ...........................*/
fscanf(f,"%d",&userfill);
@@ -394,13 +418,14 @@
&userlst[userpos].Ban_Ends, &userlst[userpos].WarnEnds);
}
fclose(f);
+ return 0;
}
/*---------------------------------------------------------------------------*/
/*=== The following functions cope with the config-file. ===*/
/*---------------------------------------------------------------------------*/
-set_defs(int i){
+void set_defs(int i){
c_arr[i].name = anystrg;
c_arr[i].group = anystrg;
c_arr[i].line = anystrg;
@@ -414,7 +439,7 @@
c_arr[i].log = g_log;
}
-eat_confile()
+void eat_confile()
{
FILE *f;
char *s, iline[LINELEN];
@@ -507,7 +532,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;
@@ -541,13 +566,13 @@
/*=== This function checks whether we have to kill a session. ===*/
/*---------------------------------------------------------------------------*/
-check_idle(userdata* akt_usr)
+int check_idle(userdata* akt_usr)
{
char ddev[STRLEN],*gn = "";
- char dev[STRLEN], name[STRLEN], prname[STRLEN];
+ char dev[STRLEN], name[STRLEN];
int idle;
struct stat status;
- time_t start, stime;
+ time_t stime;
struct passwd *passwd_entry;
struct group *group_entry;
conf_el *ce;
@@ -568,7 +593,7 @@
/*.. If user has logged out, check his Session time and so. .................*/
if (debug)
- printf("now: %d = %s",pres_time,ctime(&pres_time));
+ printf("now: %d = %s",(int)pres_time,ctime(&pres_time));
if (listall)
printf("\nChecking: %-11s on %-12s I:%-4d\n",name,dev,idle);
@@ -652,7 +677,7 @@
/*.. Make sure, daemon doesn't sleep too long from now. .....................*/
if (debug) printf("idle-state: %3d / %d:\n",idle, ce->idle );
- if (debug) printf("sess-state: %3d / %d:\n",stime/60,ce->idle );
+ if (debug) printf("sess-state: %3d / %d:\n",(int)(stime/60),ce->idle );
time_left=60*ce->idle - stime;
if (debug)
@@ -663,7 +688,7 @@
if (debug)
printf("Subject to logout Total time: %4d (%2d allowed)\n",
- stime/60,ce->idle);
+ (int)(stime/60),ce->idle);
}
if (stat(ddev, &status)){
bailout("Can't get status of user's terminal", 2);
@@ -727,7 +752,6 @@
/* this version assumes that ps -au returns one header-line and then */
/* lines with usernames, pids and some other stuff */
{ char prname[LINELEN], iline[LINELEN];
- char *s;
char *ps_name, *ps_pid;
struct stat status;
@@ -810,11 +834,11 @@
return(ok);
}
-kill_HUP(int pid){ /* terminate process using SIGHUP, first. */
+void kill_HUP(int pid){ /* terminate process using SIGHUP, first. */
kill(pid, SIGHUP); /* first send "hangup" signal */
}
-kill_KILL(int pid){ /* terminate process using SIGKILL, later.*/
+void kill_KILL(int pid){ /* terminate process using SIGKILL, later.*/
kill(pid, SIGKILL); /* then send sure "kill" signal. */
}
@@ -828,7 +852,7 @@
/*=== The following functions spread the messages to everywhere. ===*/
/*---------------------------------------------------------------------------*/
-mesg(int flag, char *name, char *dev, int stime, int idle, conf_el *ce)
+int mesg(int flag, char *name, char *dev, int stime, int idle, conf_el *ce)
{
char mbuf[LINELEN]; /* message buffer */
char *hint;
@@ -921,10 +945,10 @@
}
fclose(fp);
if (ce->mail){
- sprintf(mbuf, "/bin/mail -s \"++WARNING - LOG-OFF ++\" %s", name);
+ sprintf(mbuf, "/usr/usr/bin/mail -s \"++WARNING - LOG-OFF ++\" %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/bin/mail program", 6);
return(0);
}
if (ce->hard){
@@ -946,10 +970,10 @@
if (flag == LOGOFF){
hint="** LOGOFF **";
if (ce->mail){
- sprintf(mbuf, "/bin/mail -s \"Logged off, you were idle\" %s", name);
+ sprintf(mbuf, "/usr/bin/mail -s \"Logged off, you were idle\" %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/bin/mail program", 6);
return(0);
}
fprintf(mprog, "Subject: Excess Idle Time\n\n");
@@ -962,9 +986,9 @@
if (flag == NOLOGOFF){
hint="** LOGOFF FAILED **";
if (ce->mail){
- sprintf(mbuf, "/bin/mail -s \"Couldn't log out [%s] \" root",name);
+ sprintf(mbuf, "/usr/bin/mail -s \"Couldn't log out [%s] \" root",name);
if ((mprog = popen(mbuf, "w")) == (FILE *) NULL){
- bailout("Can't use /bin/mail program", 7);
+ bailout("Can't use /usr/bin/mail program", 7);
return(0);
}
fprintf(mprog, "Subject: Can't logoff %s\n", name);
@@ -982,7 +1006,7 @@
return(0);
}
-log_msg(char *message) { /* This function adds something to a logfile. ......*/
+int log_msg(char *message) { /* This function adds something to a logfile. ......*/
FILE *log = 0;
struct stat status;
char str_time[30];
@@ -995,19 +1019,18 @@
fprintf(log, "%s - %s\n",str_time,message);
fclose(log);
- return(0);
}
+ return(0);
}
-bailout(char *message, int status){ /* Handle error message. */
+void bailout(char *message, int status){ /* Handle error message. */
char msg[100]; /* Try to log the message. */
- sprintf(msg, "%-20s %s %-5s idle:%3d sess:%3d",
- "** ERROR **" , message);
+ sprintf(msg, "** ERROR ** %s", message);
log_msg(msg);
}
/*.. reduce time to sleep for the next time the daemon falls asleep. ........*/
-lower_sleep(int sleep_left){
+void lower_sleep(int sleep_left){
if ( 0 not found */
@@ -1032,7 +1054,7 @@
/*.. have ps tell us all current users, uids and pids. ......................*/
if (!(ps = popen(ps_cmd, "r")) ){
bailout("Can't use ps program", 6);
- return;
+ return 1;
}
fgets(iline, LINELEN, ps); /* get header-line */
@@ -1046,6 +1068,7 @@
if (stat(prname, &status)){
userpos=-1; /* => process will be killed. */
if (do_bite) kill(pid, SIGKILL); /* send the "kill" signal */
+ uid = status.st_uid;
sprintf(mbuf,"Dead , killed: %-10s %5d : %5d",ps_name,uid,pid);
log_msg(mbuf);
}
@@ -1075,4 +1098,5 @@
}
}
fclose(ps);
+ return 0;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org