This Patch changes the File- and Directory-Creation-Mode from "0644" and "0744" (when Logfile is written to disk and not "current") to more secure "0600". If you wish to change these settings, you can simply change these by editing the "CURRENT_MODE" and "PREVIOUS_MODE" to your needs. Author: Michael Diekmann Web: www.undef.de/GQmail/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- ./multilog.c.orig 2001-07-12 18:49:49.000000000 +0200 +++ ./multilog.c 2007-06-12 14:27:12.000000000 +0200 @@ -24,6 +24,9 @@ #define FATAL "multilog: fatal: " #define WARNING "multilog: warning: " +#define CURRENT_MODE 0600 +#define PREVIOUS_MODE 0600 + void pause3(const char *s1,const char *s2,const char *s3) { strerr_warn4(WARNING,s1,s2,s3,&strerr_sys); @@ -219,10 +222,10 @@ pause3("unable to create ",d->dir,"/current, pausing: "); coe(d->fdcurrent); d->bytes = 0; - while (fchmod(d->fdcurrent,0644) == -1) + while (fchmod(d->fdcurrent,CURRENT_MODE) == -1) pause3("unable to set mode of ",d->dir,"/current, pausing: "); - while (chmod("previous",0744) == -1) + while (chmod("previous",PREVIOUS_MODE) == -1) pause3("unable to set mode of ",d->dir,"/previous, pausing: "); if (!d->processor) @@ -249,7 +252,7 @@ pause3("unable to create ",d->dir,"/processed, pausing: "); while (fsync(fd) == -1) pause3("unable to write ",d->dir,"/processed to disk, pausing: "); - while (fchmod(fd,0744) == -1) + while (fchmod(fd,PREVIOUS_MODE) == -1) pause3("unable to set mode of ",d->dir,"/processed, pausing: "); close(fd); @@ -329,7 +332,7 @@ fd = open_append("current"); if (fd == -1) strerr_die4sys(111,FATAL,"unable to append to ",d->dir,"/current: "); - if (fchmod(fd,0644) == -1) + if (fchmod(fd,CURRENT_MODE) == -1) strerr_die4sys(111,FATAL,"unable to set mode of ",d->dir,"/current: "); coe(fd); d->fdcurrent = fd; @@ -366,7 +369,7 @@ fd = open_append("current"); if (fd == -1) strerr_die4sys(111,FATAL,"unable to write to ",d->dir,"/current: "); - if (fchmod(fd,0644) == -1) + if (fchmod(fd,CURRENT_MODE) == -1) strerr_die4sys(111,FATAL,"unable to set mode of ",d->dir,"/current: "); coe(fd); d->fdcurrent = fd; @@ -426,7 +429,7 @@ buffer_flush(&c[j].ss); while (fsync(c[j].fdcurrent) == -1) pause3("unable to write ",c[j].dir,"/current to disk, pausing: "); - while (fchmod(c[j].fdcurrent,0744) == -1) + while (fchmod(c[j].fdcurrent,PREVIOUS_MODE) == -1) pause3("unable to set mode of ",c[j].dir,"/current, pausing: "); } } @@ -570,7 +573,7 @@ for (j = 0;j < cnum;++j) if (c[j].flagselected) buffer_put(&c[j].ss,line,linelen); - + if (linelen == 1000) for (;;) { if (buffer_GETC(&ssin,&ch) <= 0) {