(snip)

> I have no issue in resending a new version of the patch with better
> error reporting, will do so in the following days.
>
> Robert

I've attached a second version of the patch, feel free to consider any
of them for inclusion.

Thanks,

Robert


-- 
http://robert.muntea.nu/
changeset:   52:cce5dec86998
tag:         tip
user:        Robert Munteanu <[email protected]>
date:        Fri Aug 12 15:33:12 2016 +0300
summary:     Validate that mail_sendfile exists and is executable

diff -r 5ebc6aae4d7c -r cce5dec86998 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"
@@ -107,6 +108,21 @@
     const char *dest = spam ? cfg->spam : cfg->non_spam;
     pid_t pid;
     int status;
+    const char *err_msg;
+
+    if (access(cfg->binary, F_OK) == -1)
+    {
+    err_msg = t_strdup_printf("Unable to read antispam_mail_sendfile file '%s'", cfg->binary);
+    mail_storage_set_error(storage, MAIL_ERROR_TEMP, err_msg);
+    return -1;
+    }
+
+    if (access(cfg->binary, X_OK) == -1)
+    {
+    err_msg = t_strdup_printf("Missing execute permissions on antispam_mail_sendfile file '%s'", cfg->binary);
+    mail_storage_set_error(storage, MAIL_ERROR_TEMP, err_msg);
+    return -1;
+    }
 
     pid = fork();
 

Reply via email to