diff options
-rw-r--r-- | mail/milter-regex/Makefile | 2 | ||||
-rw-r--r-- | mail/milter-regex/files/patch-milter-regex.8 | 50 | ||||
-rw-r--r-- | mail/milter-regex/files/patch-milter-regex.c | 170 | ||||
-rw-r--r-- | mail/milter-regex/files/patch-quiet | 51 |
4 files changed, 111 insertions, 162 deletions
diff --git a/mail/milter-regex/Makefile b/mail/milter-regex/Makefile index e05d481b787e..f4f4ef684049 100644 --- a/mail/milter-regex/Makefile +++ b/mail/milter-regex/Makefile @@ -8,7 +8,7 @@ PORTNAME= milter-regex PORTVERSION= 1.6 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= mail MASTER_SITES= http://www.benzedrine.cx/ diff --git a/mail/milter-regex/files/patch-milter-regex.8 b/mail/milter-regex/files/patch-milter-regex.8 index f89426009556..fc071533b1db 100644 --- a/mail/milter-regex/files/patch-milter-regex.8 +++ b/mail/milter-regex/files/patch-milter-regex.8 @@ -1,25 +1,25 @@ -*** milter-regex.8.orig Sat Mar 13 12:21:23 2004 ---- milter-regex.8 Wed Sep 6 16:15:59 2006 -*************** -*** 37,42 **** ---- 37,43 ---- - .Nm - .Op Fl d - .Op Fl c Ar config -+ .Op Fl r Ar pid-file - .Op Fl p Ar pipe - .Op Fl u Ar user - .Sh DESCRIPTION -*************** -*** 54,60 **** ---- 54,63 ---- - output on stdout. - .It Fl c Ar config - Use the specified configuration file instead of the default, - /etc/milter-regex.conf. -+ .It Fl r Ar pid-file -+ Use the specified pid file to write to. Default is: -+ /var/spool/milter-regex/milter-regex.pid - .It Fl p Ar pipe - Use the specified pipe to interface - .Xr sendmail 8 . +--- milter-regex.8.orig Sat Mar 13 18:21:23 2004 ++++ milter-regex.8 Tue Feb 20 17:31:46 2007 +@@ -37,6 +37,7 @@ + .Nm + .Op Fl d + .Op Fl c Ar config ++.Op Fl r Ar pid-file + .Op Fl p Ar pipe + .Op Fl u Ar user + .Sh DESCRIPTION +@@ -52,9 +53,14 @@ + .It Fl d + Don't detach from controlling terminal and produce verbose debug + output on stdout. ++.It Fl q ++Don't send to syslog messages with priority higher than LOG_NOTICE. + .It Fl c Ar config + Use the specified configuration file instead of the default, + /etc/milter-regex.conf. ++.It Fl r Ar pid-file ++Use the specified pid file to write to. Default is: ++/var/spool/milter-regex/milter-regex.pid + .It Fl p Ar pipe + Use the specified pipe to interface + .Xr sendmail 8 . diff --git a/mail/milter-regex/files/patch-milter-regex.c b/mail/milter-regex/files/patch-milter-regex.c index f953d92c6bd0..48cf16e6238f 100644 --- a/mail/milter-regex/files/patch-milter-regex.c +++ b/mail/milter-regex/files/patch-milter-regex.c @@ -1,85 +1,85 @@ -*** milter-regex.c.orig Sun Mar 6 06:42:53 2005 ---- milter-regex.c Wed Sep 6 16:00:00 2006 -*************** -*** 86,93 **** - static void usage(const char *); - static void msg(int, struct context *, const char *, ...); - - #define USER "_milter-regex" - #define OCONN "unix:/var/spool/milter-regex/sock" - #define RCODE_REJECT "554" - #define RCODE_TEMPFAIL "451" - #define XCODE_REJECT "5.7.1" ---- 86,94 ---- - static void usage(const char *); - static void msg(int, struct context *, const char *, ...); - - #define USER "_milter-regex" - #define OCONN "unix:/var/spool/milter-regex/sock" -+ #define OPID "/var/spool/milter-regex/milter-regex.pid" - #define RCODE_REJECT "554" - #define RCODE_TEMPFAIL "451" - #define XCODE_REJECT "5.7.1" -*************** -*** 556,565 **** ---- 557,570 ---- - { - int ch; - const char *oconn = OCONN; -+ const char *pid_file_name = OPID; - const char *user = USER; - sfsistat r = MI_FAILURE; - const char *ofile = NULL; - -+ pid_t pid; -+ FILE *pid_fd = NULL; -+ - tzset(); - openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON); - -*************** -*** 577,582 **** ---- 582,590 ---- - case 'u': - user = optarg; - break; -+ case 'r': -+ pid_file_name = optarg; -+ break; - default: - usage(argv[0]); - } -*************** -*** 638,646 **** - fprintf(stderr, "daemon: %s\n", strerror(errno)); - goto done; - } -- umask(0177); - - msg(LOG_INFO, NULL, "started: %s", rcsid); - r = smfi_main(); - if (r != MI_SUCCESS) - msg(LOG_ERR, NULL, "smfi_main: terminating due to error"); ---- 646,667 ---- - fprintf(stderr, "daemon: %s\n", strerror(errno)); - goto done; - } - - msg(LOG_INFO, NULL, "started: %s", rcsid); -+ -+ umask(0006); -+ -+ if((pid_fd = fopen(pid_file_name, "w")) == NULL) { -+ msg(LOG_ERR, NULL, "can't open file: %s", pid_file_name); -+ goto done; -+ } else { -+ pid = getpid(); -+ fprintf(pid_fd, "%d", (int) pid); -+ fclose(pid_fd); -+ } -+ -+ umask(0177); -+ - r = smfi_main(); - if (r != MI_SUCCESS) - msg(LOG_ERR, NULL, "smfi_main: terminating due to error"); +--- milter-regex.c.orig Sun Mar 6 12:42:53 2005 ++++ milter-regex.c Tue Feb 20 17:33:46 2007 +@@ -57,6 +57,7 @@ + + static const char *rule_file_name = "/etc/milter-regex.conf"; + static int debug = 0; ++static int quiet = 0; + + struct context { + struct ruleset *rs; +@@ -88,6 +89,7 @@ + + #define USER "_milter-regex" + #define OCONN "unix:/var/spool/milter-regex/sock" ++#define OPID "/var/spool/milter-regex/milter-regex.pid" + #define RCODE_REJECT "554" + #define RCODE_TEMPFAIL "451" + #define XCODE_REJECT "5.7.1" +@@ -520,6 +522,9 @@ + va_list ap; + char msg[8192]; + ++ if (LOG_PRI(priority) > LOG_INFO && quiet) ++ return; ++ + va_start(ap, fmt); + if (context != NULL) + snprintf(msg, sizeof(msg), "%s: ", context->host_addr); +@@ -556,14 +561,18 @@ + { + int ch; + const char *oconn = OCONN; ++ const char *pid_file_name = OPID; + const char *user = USER; + sfsistat r = MI_FAILURE; + const char *ofile = NULL; + ++ pid_t pid; ++ FILE *pid_fd = NULL; ++ + tzset(); + openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON); + +- while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) { ++ while ((ch = getopt(argc, argv, "c:dpqr:u:")) != -1) { + switch (ch) { + case 'c': + rule_file_name = optarg; +@@ -574,6 +583,12 @@ + case 'p': + oconn = optarg; + break; ++ case 'q': ++ quiet = 1; ++ break; ++ case 'r': ++ pid_file_name = optarg; ++ break; + case 'u': + user = optarg; + break; +@@ -638,9 +653,22 @@ + fprintf(stderr, "daemon: %s\n", strerror(errno)); + goto done; + } +- umask(0177); + + msg(LOG_INFO, NULL, "started: %s", rcsid); ++ ++ umask(0006); ++ ++ if((pid_fd = fopen(pid_file_name, "w")) == NULL) { ++ msg(LOG_ERR, NULL, "can't open file: %s", pid_file_name); ++ goto done; ++ } else { ++ pid = getpid(); ++ fprintf(pid_fd, "%d", (int) pid); ++ fclose(pid_fd); ++ } ++ ++ umask(0177); ++ + r = smfi_main(); + if (r != MI_SUCCESS) + msg(LOG_ERR, NULL, "smfi_main: terminating due to error"); diff --git a/mail/milter-regex/files/patch-quiet b/mail/milter-regex/files/patch-quiet deleted file mode 100644 index 5b09559ebea6..000000000000 --- a/mail/milter-regex/files/patch-quiet +++ /dev/null @@ -1,51 +0,0 @@ ---- milter-regex.8.orig Thu Dec 21 17:15:05 2006 -+++ milter-regex.8 Thu Dec 21 17:22:46 2006 -@@ -52,6 +52,8 @@ - .It Fl d - Don't detach from controlling terminal and produce verbose debug - output on stdout. -+.It Fl q -+Don't send to syslog messages with priority higher than LOG_NOTICE. - .It Fl c Ar config - Use the specified configuration file instead of the default, - /etc/milter-regex.conf. ---- milter-regex.c.orig Thu Dec 21 17:13:26 2006 -+++ milter-regex.c Thu Dec 21 17:23:28 2006 -@@ -57,6 +57,7 @@ - - static const char *rule_file_name = "/etc/milter-regex.conf"; - static int debug = 0; -+static int quiet = 0; - - struct context { - struct ruleset *rs; -@@ -520,6 +521,9 @@ - va_list ap; - char msg[8192]; - -+ if (LOG_PRI(priority) > LOG_INFO && quiet) -+ return; -+ - va_start(ap, fmt); - if (context != NULL) - snprintf(msg, sizeof(msg), "%s: ", context->host_addr); -@@ -563,13 +567,16 @@ - tzset(); - openlog("milter-regex", LOG_PID | LOG_NDELAY, LOG_DAEMON); - -- while ((ch = getopt(argc, argv, "c:dp:u:")) != -1) { -+ while ((ch = getopt(argc, argv, "c:dqp:u:")) != -1) { - switch (ch) { - case 'c': - rule_file_name = optarg; - break; - case 'd': - debug = 1; -+ break; -+ case 'q': -+ quiet = 1; - break; - case 'p': - oconn = optarg; - - |