aboutsummaryrefslogtreecommitdiff
path: root/mail/milter-regex/files
diff options
context:
space:
mode:
authorCheng-Lung Sung <clsung@FreeBSD.org>2006-11-02 06:52:54 +0000
committerCheng-Lung Sung <clsung@FreeBSD.org>2006-11-02 06:52:54 +0000
commit9c99ed6527b15918c2fe1ba284d54351e832fd9f (patch)
tree0925341faebbf19c2c6baff70289499ce7a9f9fa /mail/milter-regex/files
parent0f1a94621483f2038c48f0ab6b732189f71541dd (diff)
Notes
Diffstat (limited to 'mail/milter-regex/files')
-rw-r--r--mail/milter-regex/files/milterregex.sh.in42
-rw-r--r--mail/milter-regex/files/patch-milter-regex.825
-rw-r--r--mail/milter-regex/files/patch-milter-regex.c85
3 files changed, 152 insertions, 0 deletions
diff --git a/mail/milter-regex/files/milterregex.sh.in b/mail/milter-regex/files/milterregex.sh.in
new file mode 100644
index 000000000000..f869e5cabc5f
--- /dev/null
+++ b/mail/milter-regex/files/milterregex.sh.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Start or stop milterregex
+
+# PROVIDE: milterregex
+# REQUIRE: DAEMON
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move milterregex to /etc/rc.d/milterregex
+
+prefix=%%PREFIX%%
+spooldir=%%SPOOLDIR%%
+
+# Define these milterregex_* variables in one of these files:
+# /etc/rc.conf
+# /etc/rc.conf.local
+# /etc/rc.conf.d/milterregex
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+[ -z "$milterregex_enable" ] && milterregex_enable="NO" # Enable milter-regex
+#milterregex_program="${prefix}/libexec/milter-regex" # Location of milter-regex
+[ -z "$milterregex_flags" ] && milterregex_flags="" # Flags to milter-regex program
+
+. /etc/rc.subr
+
+name="milterregex"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/milter-regex"
+pidfile="${spooldir}/milter-regex.pid"
+required_files="${prefix}/etc/milter-regex.conf"
+stop_postcmd="milterregex_poststop"
+
+milterregex_poststop() {
+ /bin/rm -f ${pidfile}
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/milter-regex/files/patch-milter-regex.8 b/mail/milter-regex/files/patch-milter-regex.8
new file mode 100644
index 000000000000..f89426009556
--- /dev/null
+++ b/mail/milter-regex/files/patch-milter-regex.8
@@ -0,0 +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 .
diff --git a/mail/milter-regex/files/patch-milter-regex.c b/mail/milter-regex/files/patch-milter-regex.c
new file mode 100644
index 000000000000..f953d92c6bd0
--- /dev/null
+++ b/mail/milter-regex/files/patch-milter-regex.c
@@ -0,0 +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");