[Logcheck-commits] martin f. krafft: If nail is not installed and MAILASATTACH is set, fall back to regular method (closes: #479278).

Martin F. Krafft madduck at alioth.debian.org
Thu May 15 12:54:42 UTC 2008


Module: logcheck
Branch: master
Commit: 94d1ff2ea4ccd7ff246bd062107815530431b1c9
URL:    http://git.debian.org/?p=logcheck/logcheck.git/?a=commit;h=94d1ff2ea4ccd7ff246bd062107815530431b1c9

Author: martin f. krafft <madduck at madduck.net>
Date:   Thu May 15 13:54:38 2008 +0100

If nail is not installed and MAILASATTACH is set, fall back to regular method (closes: #479278).

---

 debian/changelog |    3 +++
 src/logcheck     |   12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9eeab3b..7f3f30d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -113,6 +113,9 @@ logcheck (1.2.64) unstable; urgency=low
   * Set permissions on /var/lib/logcheck to 0770 to prevent disclosure of
     information (closes: #481347).
 
+  * If nail is not installed and MAILASATTACH is set, fall back to regular
+    method (closes: #479278).
+
  -- martin f. krafft <madduck at debian.org>  Wed, 30 Apr 2008 12:01:31 +0400
 
 logcheck (1.2.63) unstable; urgency=low
diff --git a/src/logcheck b/src/logcheck
index e325231..ee94707 100755
--- a/src/logcheck
+++ b/src/logcheck
@@ -297,10 +297,16 @@ sendreport() {
     else
 	debug "Sending report: '$subject' to $SENDMAILTO"
         if [ $MAILASATTACH -eq 1 ]; then
-          echo -e "Report at the attachment" | nail -s "$subject" -a "$TMPDIR/report" "$SENDMAILTO"
-        else
-          cat $TMPDIR/report | mail -s "$subject" "$SENDMAILTO"
+          debug "Sending report as attachment"
+          if command -v nail >/dev/null; then
+            echo -e "Report attached" | nail -s "$subject" -a "$TMPDIR/report" "$SENDMAILTO"
+            return $?
+          else
+            echo >> $TMPDIR/report
+            echo Could not send report as attachment, nail not installed >> $TMPDIR/report
+          fi
         fi
+        cat $TMPDIR/report | mail -s "$subject" "$SENDMAILTO"
     fi
 }
 




More information about the Logcheck-commits mailing list