Hi,

Hopefully this is the right channel for such a patch. I have a minor
enhancement to submit for the antispam plugin

  http://hg.dovecot.org/dovecot-antispam-plugin

It adds minimal error checking for the sendmail_binary, otherwise the
reported error in case of a missing binary or one with missing
permissions is generic and not useful.

Thanks,

Robert

-- 
http://robert.muntea.nu/
# HG changeset patch
# User Robert Munteanu <rob...@lmn.ro>
# Date 1471005192 -10800
#      Fri Aug 12 15:33:12 2016 +0300
# Node ID 21a6999ba3d0ce670f790ce314d106bb9e23e337
# Parent  5ebc6aae4d7ce9ad4c53c1efe5b7f280e967d8a9
Validate that mail_sendfile exists and is executable

This prevents more cryptic errors from being raised to the users.

diff -r 5ebc6aae4d7c -r 21a6999ba3d0 src/mailtrain.c
--- a/src/mailtrain.c	Mon Apr 29 14:59:26 2013 +0200
+++ b/src/mailtrain.c	Fri Aug 12 15:33:12 2016 +0300
@@ -26,6 +26,7 @@
 #include "str.h"
 #include "istream.h"
 #include "ostream.h"
+#include "unistd.h"
 
 #include "aux.h"
 #include "backends.h"
@@ -108,6 +109,18 @@
     pid_t pid;
     int status;
 
+    if (access(cfg->binary, F_OK) == -1)
+    {
+    mail_storage_set_error(storage, MAIL_ERROR_TEMP, "mail_sendmail file does not exist");
+    return -1;
+    }
+
+    if (access(cfg->binary, X_OK) == -1)
+    {
+    mail_storage_set_error(storage, MAIL_ERROR_TEMP, "missing execute permissions on mail_sendmail");
+    return -1;
+    }
+
     pid = fork();
 
     if (pid == -1)

Reply via email to