From 3ab6538433fdbed6903e1c5f5b63054e0d056666 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 8 Feb 2023 08:23:31 +0100 Subject: [PATCH] tools: Return a better error message if sendmail is not usable. * tools/send-mail.c: Include unistd.h (run_sendmail): Check for bad sendmail. -- GnuPG-bug-id: 6321 --- tools/send-mail.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/send-mail.c b/tools/send-mail.c index 6492c43c1..d348f28cb 100644 --- a/tools/send-mail.c +++ b/tools/send-mail.c @@ -22,6 +22,7 @@ #include #include #include +#include /* for X_OK */ #include "../common/util.h" #include "../common/exectool.h" @@ -36,6 +37,12 @@ run_sendmail (estream_t data) const char pgmname[] = NAME_OF_SENDMAIL; const char *argv[3]; + if (!*pgmname || gnupg_access (pgmname, X_OK)) + { + log_error ("sendmail tool '%s' is not correctly installed\n", pgmname); + return gpg_error (GPG_ERR_ENOENT); + } + argv[0] = "-oi"; argv[1] = "-t"; argv[2] = NULL;