cvs: php-src(PHP_4_3) /ext/standard mail.c

From: Date: Wed, 27 Aug 2003 23:53:31 +0000
Subject: cvs: php-src(PHP_4_3) /ext/standard mail.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-23413@lists.php.net to get a copy of this message
iliaa Wed Aug 27 19:53:31 2003 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/standard mail.c Log: MFH: mail.c r1.74 Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.66.2.5 php-src/ext/standard/mail.c:1.66.2.6 --- php-src/ext/standard/mail.c:1.66.2.5 Wed May 7 16:32:28 2003 +++ php-src/ext/standard/mail.c Wed Aug 27 19:53:31 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mail.c,v 1.66.2.5 2003/05/07 20:32:28 pollita Exp $ */ +/* $Id: mail.c,v 1.66.2.6 2003/08/27 23:53:31 iliaa Exp $ */ #include <stdlib.h> #include <ctype.h> @@ -195,6 +195,13 @@ #ifdef PHP_WIN32 sendmail = popen(sendmail_cmd, "wb"); #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; + } + /* 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 * sure we don't catch any older errno value. */ @@ -207,7 +214,7 @@ if (sendmail) { #ifndef PHP_WIN32 if (EACCES == errno) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); pclose(sendmail); return 0; } @@ -236,7 +243,7 @@ return 1; } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); return 0; }

« previous php.cvs (#23413) next »