From e60d220d5c559e4ad6d74b4c9fe6fca1b8c86d91 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 8 Sep 2003 20:15:43 +0000 Subject: [PATCH] MFH: Re-enable sendmail binary check, now with parameter detection. --- ext/standard/mail.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 1d5805e930..93635941c0 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -197,11 +197,24 @@ PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char #else /* make sure that sendmail_path contains a valid executable, failure to do * would make PHP abruptly exit without a useful error message. */ -/* if (access(sendmail_path, X_OK)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); - return 0; + { + char *s=NULL, p; + + if ((s = strchr(sendmail_path, ' '))) { + p = *s; + *s = '\0'; + } + if (access(sendmail_path, X_OK)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); + if (s) { + *s = p; + } + return 0; + } + if (s) { + *s = p; + } } -*/ /* Since popen() doesn't indicate if the internal fork() doesn't work * (e.g. the shell can't be executed) we explicitely set it to 0 to be -- 2.40.0