--On Dienstag, 22. Juni 2004 14:09 +0200 Ana <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
hello! I've postfix+courier-imap 3.0 on a Solaris 9 machine. I'd like courier-imap log in another file different from syslog, but I'm not able. I've modified logger.c to this:
# ifdef LOG_MAIL { "mail", LOG_LOCAL3 }, # endif and in my syslog.conf
local3.* /var/log/courier.log
but it doesn't work. Any idea?
No, but you probably just got the wrong line...
The following patch allows to set the facility via the config-file for each courier-daemon individually:
# cat logger-facility-0.45.4.patch # set facility via LOG_FACILITY --- ../courier-0.45.4.orig/tcpd/logger.c Sun Aug 19 00:20:53 2001 +++ tcpd/logger.c Sat Apr 10 18:44:44 2004 @@ -14,7 +14,10 @@ #include "unistd.h" #endif #if HAVE_SYSLOG_H +#include <stdlib.h> +#define SYSLOG_NAMES #include <syslog.h> +#undef SYSLOG_NAMES #endif
static const char rcsid[]="$Id: logger.c,v 1.3 2001/08/16 01:38:43 mrsam Exp $";
@@ -22,11 +25,31 @@
int main(int argc, char **argv)
{
char buf[512];
-char *p;
-int c;
+char *p, *f_name;
+int c, i;
+int f_val=LOG_MAIL; // default
if (argc < 2) return (1);
+/*
+** PATCH: adjust logging output via env LOG_FACILITY, may be set to:
+** auth,authpriv,cron,daemon,ftp,kern,lpr,mail,news,sysslog,user,uucp
+** local0,local1,local2,local3,local4,local5,local6,local7
+*/
+#if HAVE_SYSLOG_H
+ if( (f_name=getenv("LOG_FACILITY")) != NULL && *f_name )
+ {
+ for (i=0; facilitynames[i].c_name; i++)
+ {
+ if (!strcmp(f_name, facilitynames[i].c_name))
+ {
+ f_val = facilitynames[i].c_val;
+ break;
+ }
+ }
+ }
+#endif
+
#if TESTMODE#else
@@ -38,7 +61,8 @@
| LOG_NOWAIT
#endif- , LOG_MAIL);
+ , f_val);
+
close(1);
close(2);
open("/dev/null", O_WRONLY);-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
