Hi,

    If no one objects I'ld like to commit the following patch
    which raises an extra warning message when using mail() on
    unix systems and the shell required for popen() can't be
    executed (tested on linux/freebsd).

    - Markus

-- 
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
Index: ext/mbstring/mbstring.c
===================================================================
RCS file: /repository/php4/ext/mbstring/mbstring.c,v
retrieving revision 1.48
diff -u -r1.48 mbstring.c
--- ext/mbstring/mbstring.c     28 Feb 2002 08:26:20 -0000      1.48
+++ ext/mbstring/mbstring.c     16 Mar 2002 02:08:18 -0000
@@ -2796,7 +2796,7 @@
                extra_cmd = Z_STRVAL_PP(argv[4]);
        }
 
-       if (!err && php_mail(to, subject, message, headers, extra_cmd)){
+       if (!err && php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)){
                RETVAL_TRUE;
        } else {
                RETVAL_FALSE;
Index: ext/standard/basic_functions.c
===================================================================
RCS file: /repository/php4/ext/standard/basic_functions.c,v
retrieving revision 1.447
diff -u -r1.447 basic_functions.c
--- ext/standard/basic_functions.c      1 Mar 2002 03:05:49 -0000       1.447
+++ ext/standard/basic_functions.c      16 Mar 2002 02:08:20 -0000
@@ -1512,7 +1512,7 @@
                        {
 #if HAVE_SENDMAIL
                                if (!php_mail
-                                       (opt, "PHP error_log message", message, 
headers, NULL)) {
+                                       (opt, "PHP error_log message", message, 
+headers, NULL TSRMLS_CC)) {
                                        return FAILURE;
                                }
 #else
Index: ext/standard/mail.c
===================================================================
RCS file: /repository/php4/ext/standard/mail.c,v
retrieving revision 1.48
diff -u -r1.48 mail.c
--- ext/standard/mail.c 28 Feb 2002 08:26:46 -0000      1.48
+++ ext/standard/mail.c 16 Mar 2002 02:08:20 -0000
@@ -96,7 +96,7 @@
        if(extra_cmd)
                extra_cmd = php_escape_shell_arg(extra_cmd);
        
-       if (php_mail(to, subject, message, headers, extra_cmd)) {
+       if (php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)) {
                RETVAL_TRUE;
        } else {
                RETVAL_FALSE;
@@ -108,7 +108,7 @@
 
 /* {{{ php_mail
  */
-PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char 
*extra_cmd)
+PHPAPI int php_mail(char *to, char *subject, char *message, char *headers, char 
+*extra_cmd TSRMLS_DC)
 {
 #ifdef PHP_WIN32
        int tsm_err;
@@ -148,6 +148,13 @@
                efree (sendmail_cmd);
 
        if (sendmail) {
+#ifndef PHP_WIN32
+               if (EACCES == errno) {
+                       php_error(E_WARNING, "%s() permission denied; unable to 
+execute shell to run mail delivery binary",
+                                         get_active_function_name(TSRMLS_C));
+                       return 0;
+               }
+#endif
                fprintf(sendmail, "To: %s\n", to);
                fprintf(sendmail, "Subject: %s\n", subject);
                if (headers != NULL) {
Index: ext/standard/php_mail.h
===================================================================
RCS file: /repository/php4/ext/standard/php_mail.h,v
retrieving revision 1.12
diff -u -r1.12 php_mail.h
--- ext/standard/php_mail.h     28 Feb 2002 08:26:47 -0000      1.12
+++ ext/standard/php_mail.h     16 Mar 2002 02:08:20 -0000
@@ -26,7 +26,7 @@
 PHP_FUNCTION(mail);
 PHP_FUNCTION(ezmlm_hash);
 PHP_MINFO_FUNCTION(mail);
-PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, 
char *extra_cmd);
+PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, 
+char *extra_cmd TSRMLS_DC);
 
 #endif
 

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to