slackbuilds_ponce/network/opendmarc/patches/ticket159.patch
Mario Preksavec fe01e850a8 network/opendmarc: Added (DMARC milter and library).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2019-05-17 23:20:52 +07:00

77 lines
2.1 KiB
Diff

diff --git a/configure.ac b/configure.ac
index 255c449..27d7cd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -492,6 +492,7 @@ AC_OUTPUT([ Makefile
reports/opendmarc-expire.8
reports/opendmarc-import
reports/opendmarc-import.8
+ reports/opendmarc-importstats
reports/opendmarc-importstats.8
reports/opendmarc-params
reports/opendmarc-params.8
diff --git a/reports/opendmarc-importstats b/reports/opendmarc-importstats
deleted file mode 100755
index 839a871..0000000
--- a/reports/opendmarc-importstats
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-##
-## Copyright (c) 2012, The Trusted Domain Project. All rights reserved.
-##
-## opendmarc-importstats -- import opendmarc output to MySQL
-##
-## This is intended to be used via a crontab. If import is successful,
-## this code exits quietly so there's no output. If it fails, it does
-## "ls -l" on the temporary file, so that cron generates mail to whever
-## ran the job.
-
-## setup
-statsdb="/var/tmp/dmarc.dat"
-# OPENDMARC_PASSWORD="password"; export OPENDMARC_PASSWORD
-
-if [ -s $statsdb ]
-then
- mv $statsdb ${statsdb}.OLD.$$
-
- if opendmarc-import < ${statsdb}.OLD.$$
- then
- rm ${statsdb}.OLD.$$
- else
- ls -l ${statsdb}.OLD.$$
- fi
-fi
diff --git a/reports/opendmarc-importstats.in b/reports/opendmarc-importstats.in
new file mode 100755
index 0000000..3a28ee3
--- /dev/null
+++ b/reports/opendmarc-importstats.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+##
+## Copyright (c) 2012, The Trusted Domain Project. All rights reserved.
+##
+## opendmarc-importstats -- import opendmarc output to MySQL
+##
+## This is intended to be used via a crontab. If import is successful,
+## this code exits quietly so there's no output. If it fails, it does
+## "ls -l" on the temporary file, so that cron generates mail to whever
+## ran the job.
+
+## setup
+statsdb="`grep ^HistoryFile @sysconfdir@/opendmarc.conf | sed 's/^HistoryFile\s\+//'`"
+[ -z "$statsdb" ] && exit 0
+# OPENDMARC_PASSWORD="password"; export OPENDMARC_PASSWORD
+
+if [ -s "$statsdb" ]
+then
+ mv "$statsdb" "${statsdb}.OLD.$$"
+
+ if opendmarc-import < "${statsdb}.OLD.$$"
+ then
+ rm "${statsdb}.OLD.$$"
+ else
+ ls -l "${statsdb}.OLD.$$"
+ fi
+fi