Hello,
Murray S. Kucherawy wrote:
I'm fine with either the comment method or prepending the job ID (plus a
delimiter like "/") to the authserv-id so that the existing header removal
code will still work.
Here is a patch for dkim-milter 2.4.3, with both changes :
* being able to select any syslog facility other than LOG_MAIL
Enable this with "SyslogFacility", configuration option.
* prepending the job ID plus a "/". Enable this with
"AuthservIDWithJobID" configuration option. This change is protected
by a _FFR_AUTHSERV_JOBID compile time option.
Please, let me know if this is OK for you.
Regards,
José-Marcio
diff -ur dkim-filter.org/dkim-config.h dkim-filter/dkim-config.h
--- dkim-filter.org/dkim-config.h 2007-12-14 00:07:22.000000000 +0100
+++ dkim-filter/dkim-config.h 2008-01-19 17:56:40.000000000 +0100
@@ -15,6 +15,9 @@
struct configdef dkimf_config[] =
{
{ "AlwaysSignHeaders", CONFIG_TYPE_STRING, FALSE },
+#ifdef _FFR_AUTHSERV_JOBID
+ { "AuthservIDWithJobID", CONFIG_TYPE_BOOLEAN, FALSE },
+#endif /* _FFR_AUTHSERV_JOBID */
{ "AutoRestart", CONFIG_TYPE_BOOLEAN, FALSE },
{ "Background", CONFIG_TYPE_BOOLEAN, FALSE },
{ "BodyLengths", CONFIG_TYPE_BOOLEAN, FALSE },
@@ -79,6 +82,7 @@
{ "SubDomains", CONFIG_TYPE_BOOLEAN, FALSE },
{ "Syslog", CONFIG_TYPE_BOOLEAN, FALSE },
{ "SyslogSuccess", CONFIG_TYPE_BOOLEAN, FALSE },
+ { "SyslogFacility", CONFIG_TYPE_STRING, FALSE },
{ "UMask", CONFIG_TYPE_INTEGER, FALSE },
{ "UserID", CONFIG_TYPE_STRING, FALSE },
{ "UseSSPDeny", CONFIG_TYPE_BOOLEAN, FALSE },
diff -ur dkim-filter.org/dkim-filter.c dkim-filter/dkim-filter.c
--- dkim-filter.org/dkim-filter.c 2008-01-14 23:51:29.000000000 +0100
+++ dkim-filter/dkim-filter.c 2008-01-19 23:08:55.000000000 +0100
@@ -394,6 +394,9 @@
#ifdef _FFR_STATS
char *statspath; /* path for stats DB */
#endif /* _FFR_STATS */
+#ifdef _FFR_AUTHSERV_JOBID
+bool authservidwithjobid;
+#endif /* _FFR_AUTHSERV_JOBID */
/* Other useful definitions */
#define CRLF "\r\n" /* CRLF */
@@ -3144,17 +3147,24 @@
}
/* hostname match? */
- if (remar != NULL)
{
- if (dkimf_hostlist(ares->ares_host,
- remar))
- hostmatch = TRUE;
- }
- else
- {
- if (strcasecmp(hostname,
- ares->ares_host) == 0)
- hostmatch = TRUE;
+ char *hptr = ares->ares_host;
+
+#ifdef _FFR_AUTHSERV_JOBID
+ hptr = strchr(ares->ares_host, '/');
+ if (hptr == NULL)
+ hptr = ares->ares_host + 1;
+#endif /* _FFR_AUTHSERV_JOBID */
+ if (remar != NULL)
+ {
+ if (dkimf_hostlist(hptr, remar))
+ hostmatch = TRUE;
+ }
+ else
+ {
+ if (strcasecmp(hostname, hptr) == 0)
+ hostmatch = TRUE;
+ }
}
/* delete if we found both */
@@ -3699,16 +3709,32 @@
(void) dkim_sig_getidentity(dfc->mctx_dkim, NULL,
val, sizeof val);
- snprintf(header, sizeof header,
- "%s%s; %s=%s%s%s%s header.i=%s",
- cc->cctx_noleadspc ? " " : "",
- hostname,
- method,
- authresult,
- comment[0] == '\0' ? "" : " (",
- comment[0] == '\0' ? "" : comment,
- comment[0] == '\0' ? "" : ")",
- val);
+#ifdef _FFR_AUTHSERV_JOBID
+ if (authservidwithjobid)
+ snprintf(header, sizeof header,
+ "%s%s%s%s; %s=%s%s%s%s header.i=%s",
+ cc->cctx_noleadspc ? " " : "",
+ dfc->mctx_jobid != NULL ? dfc->mctx_jobid : "",
+ dfc->mctx_jobid != NULL ? "/" : "",
+ hostname,
+ method,
+ authresult,
+ comment[0] == '\0' ? "" : " (",
+ comment[0] == '\0' ? "" : comment,
+ comment[0] == '\0' ? "" : ")",
+ val);
+ else
+#endif /* _FFR_AUTHSERV_JOBID */
+ snprintf(header, sizeof header,
+ "%s%s; %s=%s%s%s%s header.i=%s",
+ cc->cctx_noleadspc ? " " : "",
+ hostname,
+ method,
+ authresult,
+ comment[0] == '\0' ? "" : " (",
+ comment[0] == '\0' ? "" : comment,
+ comment[0] == '\0' ? "" : ")",
+ val);
if (dfc->mctx_addheader &&
dkimf_insheader(ctx, 1, AUTHRESULTSHDR,
@@ -4358,6 +4384,9 @@
maxhdrsz = DEFMAXHDRSZ;
sigmin = 0;
sigmintype = SIGMIN_BYTES;
+#ifdef _FFR_AUTHSERV_JOBID
+ authservidwithjobid = FALSE;
+#endif /* _FFR_AUTHSERV_JOBID */
if (DKIM_DEBUG('t'))
{
thread_count = 0;
@@ -4966,6 +4995,11 @@
(void) config_get(cfg, "MaximumHeaders", &maxhdrsz,
sizeof maxhdrsz);
+
+#ifdef _FFR_AUTHSERV_JOBID
+ (void) config_get(cfg, "AuthservIDWithJobID", &authservidwithjobid,
+ sizeof authservidwithjobid);
+#endif /* _FFR_AUTHSERV_JOBID */
}
#ifndef SMFIF_QUARANTINE
@@ -5586,11 +5620,11 @@
/* activate logging */
if (dolog)
{
-#ifdef LOG_MAIL
- openlog(progname, LOG_PID, LOG_MAIL);
-#else /* LOG_MAIL */
- openlog(progname, LOG_PID);
-#endif /* LOG_MAIL */
+ char *log_facility = NULL;
+
+ (void) config_get(cfg, "SyslogFacility", &log_facility,
+ sizeof log_facility);
+ dkimf_init_syslog(log_facility);
}
dkimf_setmaxfd();
diff -ur dkim-filter.org/dkim-filter.conf.sample dkim-filter/dkim-filter.conf.sample
--- dkim-filter.org/dkim-filter.conf.sample 2007-12-14 08:22:19.000000000 +0100
+++ dkim-filter/dkim-filter.conf.sample 2008-01-19 23:26:41.000000000 +0100
@@ -12,6 +12,14 @@
# AlwaysSignHeaders header1:header2:...
+## AuthservIDWithJobID { yes | no }
+## default "no"
+##
+## Indicate whether or not to include the JobID in the field Authsender-id
+## of Authorization-Results header
+
+# AuthservIDWithJobID no
+
## AutoRestart { yes | no }
## default "no"
##
@@ -304,6 +312,17 @@
# Syslog No
+## SyslogFacility facility
+## default "mail"
+##
+## Valid values are :
+## auth cron daemon kern lpr mail news security syslog user uucp
+## local0 local1 local2 local3 local4 local5 local6 local7
+##
+## syslog facility to be used
+
+# SyslogFacility mail
+
## SyslogSuccess { yes | no }
## default "no"
##
diff -ur dkim-filter.org/util.c dkim-filter/util.c
--- dkim-filter.org/util.c 2007-10-31 19:34:11.000000000 +0100
+++ dkim-filter/util.c 2008-01-18 11:20:00.000000000 +0100
@@ -1420,3 +1420,69 @@
close(s);
return EADDRINUSE;
}
+
+/*
+** DKIMF_INIT_SYSLOG -- init syslog subsystem
+**
+** Parameters:
+** facility -- syslog facility name
+**
+** Return value:
+** None
+*/
+typedef struct
+{
+ char *name;
+ int code;
+} log_code_T;
+
+static log_code_T log_facilities[] = {
+ {"auth", LOG_AUTH},
+ {"cron", LOG_CRON},
+ {"daemon", LOG_DAEMON},
+ {"kern", LOG_KERN},
+ {"lpr", LOG_LPR},
+ {"mail", LOG_MAIL},
+ {"news", LOG_NEWS},
+ {"security", LOG_AUTH}, /* DEPRECATED */
+ {"syslog", LOG_SYSLOG},
+ {"user", LOG_USER},
+ {"uucp", LOG_UUCP},
+ {"local0", LOG_LOCAL0},
+ {"local1", LOG_LOCAL1},
+ {"local2", LOG_LOCAL2},
+ {"local3", LOG_LOCAL3},
+ {"local4", LOG_LOCAL4},
+ {"local5", LOG_LOCAL5},
+ {"local6", LOG_LOCAL6},
+ {"local7", LOG_LOCAL7},
+ {NULL, -1}
+};
+
+void
+dkimf_init_syslog(char *facility)
+{
+#ifdef LOG_MAIL
+ int code = LOG_MAIL;
+
+ log_code_T *p = NULL;
+
+ code = LOG_MAIL;
+ if (facility != NULL)
+ {
+ for (p = log_facilities; p != NULL; p++)
+ {
+ if (strcasecmp(p->name, facility) == 0)
+ {
+ code = p->code;
+ break;
+ }
+ }
+ }
+
+ openlog(progname, LOG_PID, code);
+#else /* LOG_MAIL */
+ openlog(progname, LOG_PID);
+#endif /* LOG_MAIL */
+}
+
diff -ur dkim-filter.org/util.h dkim-filter/util.h
--- dkim-filter.org/util.h 2007-10-07 14:34:58.000000000 +0200
+++ dkim-filter/util.h 2008-01-17 22:54:45.000000000 +0100
@@ -78,4 +78,5 @@
extern int dkimf_dstring_len __P((struct dkimf_dstring *));
extern void dkimf_dstring_blank __P((struct dkimf_dstring *));
+extern void dkimf_init_syslog(char *facility);
#endif /* _UTIL_H_ */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dkim-milter-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dkim-milter-discuss