mirror of
https://github.com/donl/rmilter.git
synced 2026-06-30 06:12:17 -06:00
commit
3da8d4a1db
6 changed files with 53 additions and 4 deletions
|
|
@ -14,6 +14,10 @@ IF(NOT RMILTER_USER)
|
|||
SET(RMILTER_GROUP "nobody")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT SYSTEMDDIR)
|
||||
SET(SYSTEMDDIR ${CMAKE_INSTALL_PREFIX}/lib/systemd/system)
|
||||
ENDIF(NOT SYSTEMDDIR)
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
|
||||
|
||||
############################# OPTIONS SECTION #############################################
|
||||
|
|
@ -420,3 +424,7 @@ TARGET_LINK_LIBRARIES(rmilter ${RMILTER_REQUIRED_LIBRARIES})
|
|||
# Binaries
|
||||
INSTALL(TARGETS rmilter RUNTIME DESTINATION sbin)
|
||||
INSTALL(FILES "doc/rmilter.8" DESTINATION ${MANDIR}/man8)
|
||||
|
||||
# systemd unit
|
||||
|
||||
INSTALL(FILES "rmilter.service" DESTINATION ${SYSTEMDDIR})
|
||||
|
|
|
|||
7
debian/changelog
vendored
7
debian/changelog
vendored
|
|
@ -1,3 +1,10 @@
|
|||
rmilter (1.6.2) UNRELEASED; urgency=low
|
||||
|
||||
* New version.
|
||||
* systemd support.
|
||||
|
||||
-- Mikhail Gusarov <dottedmag@debian.org> Sun, 30 Mar 2014 11:16:47 +0200
|
||||
|
||||
rmilter (1.6.1) unstable; urgency=medium
|
||||
|
||||
* Initial upload (Closes: #741161)
|
||||
|
|
|
|||
2
debian/control
vendored
2
debian/control
vendored
|
|
@ -2,7 +2,7 @@ Source: rmilter
|
|||
Section: mail
|
||||
Priority: extra
|
||||
Maintainer: Mikhail Gusarov <dottedmag@debian.org>
|
||||
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cmake, libpcre3-dev, libssl-dev (>= 1.0), libopendkim-dev, libmilter-dev, libspf2-dev, bison, flex
|
||||
Build-Depends: debhelper (>= 9), dpkg-dev (>= 1.16.1~), cmake, libpcre3-dev, libssl-dev (>= 1.0), libopendkim-dev, libmilter-dev, libspf2-dev, bison, flex, dh-systemd
|
||||
Standards-Version: 3.9.5
|
||||
Homepage: https://github.com/vstakhov/rmilter
|
||||
Vcs-Git: git://github.com/vstakhov/rmilter.git
|
||||
|
|
|
|||
5
debian/rules
vendored
5
debian/rules
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
dh $@ --with systemd
|
||||
|
||||
export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
|
||||
|
||||
|
|
@ -8,3 +8,6 @@ override_dh_auto_configure:
|
|||
dh_auto_configure -- -DENABLE_SPF=ON \
|
||||
-DENABLE_DKIM=ON \
|
||||
-DMANDIR=/usr/share/man
|
||||
|
||||
override_dh_systemd_start:
|
||||
dh_systemd_start --restart-after-upgrade
|
||||
|
|
|
|||
16
rmilter.service
Normal file
16
rmilter.service
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=another sendmail filter
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
|
||||
# Replace Pre/Post with RuntimeDirectory once it is available
|
||||
PermissionsStartOnly=true
|
||||
ExecStartPre=/bin/mkdir -p -m750 /run/rmilter
|
||||
ExecStartPre=/bin/chown _rmilter:adm /run/rmilter
|
||||
ExecStartPre=/bin/chmod g+s /run/rmilter
|
||||
ExecStartPre=/bin/rm -f /run/rmilter/rmilter.sock
|
||||
|
||||
User=_rmilter
|
||||
ExecStart=/usr/sbin/rmilter -d -c /etc/rmilter.conf
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
19
src/main.c
19
src/main.c
|
|
@ -31,6 +31,7 @@
|
|||
/* config options here... */
|
||||
|
||||
struct config_file *cfg;
|
||||
bool daemonize;
|
||||
extern struct smfiDesc smfilter;
|
||||
|
||||
pthread_cond_t cfg_cond = PTHREAD_COND_INITIALIZER;
|
||||
|
|
@ -48,7 +49,8 @@ static void
|
|||
usage (void)
|
||||
{
|
||||
printf ("Rapid Milter Version " MVERSION "\n"
|
||||
"Usage: rmilter [-h] -c <config_file>\n"
|
||||
"Usage: rmilter [-h] [-d] -c <config_file>\n"
|
||||
"-d - daemonize\n"
|
||||
"-h - this help message\n"
|
||||
"-c - path to config file\n");
|
||||
exit (0);
|
||||
|
|
@ -164,7 +166,7 @@ main(int argc, char *argv[])
|
|||
int c, r;
|
||||
extern int yynerrs;
|
||||
extern FILE *yyin;
|
||||
const char *args = "c:h";
|
||||
const char *args = "c:hd";
|
||||
char *cfg_file = NULL;
|
||||
FILE *f;
|
||||
pthread_t reload_thr;
|
||||
|
|
@ -182,6 +184,9 @@ main(int argc, char *argv[])
|
|||
cfg_file = strdup (optarg);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
daemonize = 1;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage ();
|
||||
|
|
@ -269,6 +274,16 @@ main(int argc, char *argv[])
|
|||
msg_warn ("main: cannot start reload thread, ignoring error");
|
||||
}
|
||||
|
||||
if (smfi_opensocket(0) == MI_FAILURE) {
|
||||
msg_err("Unable to open listening socket");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
if (daemonize && daemon (0, 0) == -1) {
|
||||
msg_err("Unable to daemonize");
|
||||
exit(EX_UNAVAILABLE);
|
||||
}
|
||||
|
||||
r = smfi_main();
|
||||
|
||||
if (cfg_file != NULL) free (cfg_file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue