[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Sun Jun 21 15:30:23 2009 UTC Modified files: /php-src/ext/standard mail.c Log: MFB: Fixed bug #48620 (X-PHP-Originating-Script assumes no trailing CRLF in existing headers) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.106&r2=1.107&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.106 php-src/ext/standard/mail.c:1.107 --- php-src/ext/standard/mail.c:1.106 Wed Apr 15 14:25:20 2009 +++ php-src/ext/standard/mail.c Sun Jun 21 15:30:23 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.106 2009/04/15 14:25:20 iliaa Exp $ */ +/* $Id: mail.c,v 1.107 2009/06/21 15:30:23 iliaa Exp $ */ #include #include @@ -235,7 +235,7 @@ php_basename(tmp, strlen(tmp), NULL, 0, &f, &f_len TSRMLS_CC); if (headers != NULL) { - spprintf(&hdr, 0, "%s\r\nX-PHP-Originating-Script: %ld:%s\n", headers, php_getuid(), f); + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\r\n%s", php_getuid(), f, headers); } else { spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(), f); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Wed Apr 15 14:25:20 2009 UTC Modified files: /php-src/ext/standard mail.c Log: MFB: Fixed bug #47969 (ezmlm_hash() returns different values depend on OS) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.105&r2=1.106&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.105 php-src/ext/standard/mail.c:1.106 --- php-src/ext/standard/mail.c:1.105 Tue Mar 10 23:39:40 2009 +++ php-src/ext/standard/mail.c Wed Apr 15 14:25:20 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.105 2009/03/10 23:39:40 helly Exp $ */ +/* $Id: mail.c,v 1.106 2009/04/15 14:25:20 iliaa Exp $ */ #include #include @@ -75,7 +75,7 @@ PHP_FUNCTION(ezmlm_hash) { char *str = NULL; - unsigned long h = 5381L; + unsigned int h = 5381; int j, str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &str, &str_len, UG(ascii_conv)) == FAILURE) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
tony2001Fri Jan 9 16:33:57 2009 UTC Modified files: /php-src/ext/standard mail.c Log: fix ZTS build http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.101&r2=1.102&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.101 php-src/ext/standard/mail.c:1.102 --- php-src/ext/standard/mail.c:1.101 Fri Jan 9 15:00:36 2009 +++ php-src/ext/standard/mail.c Fri Jan 9 16:33:57 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.101 2009/01/09 15:00:36 iliaa Exp $ */ +/* $Id: mail.c,v 1.102 2009/01/09 16:33:57 tony2001 Exp $ */ #include #include @@ -227,7 +227,7 @@ char *f; size_t f_len; - php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len); + php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC); if (headers != NULL) { spprintf(&hdr, 0, "%s\r\nX-PHP-Originating-Script: %ld:%s\n", headers, php_getuid(), f); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
mkoppanen Fri Oct 3 13:31:21 2008 UTC Modified files: /php-src/ext/standard mail.c Log: Adds signal handling around popen/pclose in mail.c. Related information on bugs #8992 and #14032 Original patch by D. Parthey http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.97&r2=1.98&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.97 php-src/ext/standard/mail.c:1.98 --- php-src/ext/standard/mail.c:1.97Mon Dec 31 07:12:16 2007 +++ php-src/ext/standard/mail.c Fri Oct 3 13:31:21 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.97 2007/12/31 07:12:16 sebastian Exp $ */ +/* $Id: mail.c,v 1.98 2008/10/03 13:31:21 mkoppanen Exp $ */ #include #include @@ -31,6 +31,12 @@ #include #endif +#if PHP_SIGCHILD +#if HAVE_SIGNAL_H +#include +#endif +#endif + #include "php_mail.h" #include "php_ini.h" #include "exec.h" @@ -187,6 +193,9 @@ int ret; char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif if (!sendmail_path) { #if (defined PHP_WIN32 || defined NETWARE) @@ -211,6 +220,16 @@ sendmail_cmd = sendmail_path; } +#if PHP_SIGCHILD + /* Set signal handler of SIGCHLD to default to prevent other signal handlers +* from being called and reaping the return code when our child exits. +* The original handler needs to be restored after pclose() */ + sig_handler = (void *)signal(SIGCHLD, SIG_DFL); + if (sig_handler == SIG_ERR) { + sig_handler = NULL; + } +#endif + #ifdef PHP_WIN32 sendmail = popen(sendmail_cmd, "wb"); #else @@ -229,6 +248,13 @@ if (EACCES == errno) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); pclose(sendmail); +#if PHP_SIGCHILD + /* Restore handler in case of error on Windows + Not sure if this applicable on Win but just in case. */ + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } #endif @@ -240,6 +266,12 @@ fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + #ifdef PHP_WIN32 if (ret == -1) #else @@ -258,6 +290,11 @@ } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
dmitry Wed Nov 7 08:32:17 2007 UTC Modified files: /php-src/ext/standard mail.c Log: Fixed compilation http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.95&r2=1.96&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.95 php-src/ext/standard/mail.c:1.96 --- php-src/ext/standard/mail.c:1.95Tue Nov 6 17:58:41 2007 +++ php-src/ext/standard/mail.c Wed Nov 7 08:32:17 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.95 2007/11/06 17:58:41 jani Exp $ */ +/* $Id: mail.c,v 1.96 2007/11/07 08:32:17 dmitry Exp $ */ #include #include @@ -92,6 +92,7 @@ int subject_len, extra_cmd_len, i; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); char *to_r, *subject_r; + char *p, *e; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss", &to, &to_len, &subject, &subject_len, &message, &message_len, &headers, &headers_len, &extra_cmd, &extra_cmd_len) == FAILURE -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
janiTue Nov 6 17:58:41 2007 UTC Modified files: /php-src/ext/standard mail.c Log: Ws + cs + missing fix for MOPB-33-2007:PHP mail() Message ASCIIZ Byte Truncation http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.94&r2=1.95&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.94 php-src/ext/standard/mail.c:1.95 --- php-src/ext/standard/mail.c:1.94Wed Jul 11 17:39:04 2007 +++ php-src/ext/standard/mail.c Tue Nov 6 17:58:41 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.94 2007/07/11 17:39:04 johannes Exp $ */ +/* $Id: mail.c,v 1.95 2007/11/06 17:58:41 jani Exp $ */ #include #include @@ -44,14 +44,21 @@ #define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ #endif -#define SKIP_LONG_HEADER_SEP(str, pos) \ +#define SKIP_LONG_HEADER_SEP(str, pos) \ if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) {\ - pos += 2; \ - while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \ - pos++; \ - } \ - continue; \ - } \ + pos += 2; \ + while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \ + pos++; \ + } \ + continue; \ + } \ + +#define MAIL_ASCIIZ_CHECK(str, len)\ + p = str; \ + e = p + len; \ + while ((p = memchr(p, '\0', (e - p {\ + *p = ' '; \ + } \ /* {{{ proto int ezmlm_hash(string addr) U Calculate EZMLM list hash value. */ @@ -60,7 +67,7 @@ char *str = NULL; unsigned long h = 5381L; int j, str_len; - + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &str, &str_len, UG(ascii_conv)) == FAILURE) { return; } @@ -68,9 +75,9 @@ for (j = 0; j < str_len; j++) { h = (h + (h << 5)) ^ (unsigned long) (unsigned char) tolower(str[j]); } - + h = (h % 53); - + RETURN_LONG((int) h); } /* }}} */ @@ -86,16 +93,23 @@ char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); char *to_r, *subject_r; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss", - &to, &to_len, - &subject, &subject_len, - &message, &message_len, - &headers, &headers_len, - &extra_cmd, &extra_cmd_len - ) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
[PHP-CVS] cvs: php-src /ext/standard mail.c
stasTue Jul 10 20:23:26 2007 UTC Modified files: /php-src/ext/standard mail.c Log: Escape mail.force_extra_parameters value http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.92&r2=1.93&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.92 php-src/ext/standard/mail.c:1.93 --- php-src/ext/standard/mail.c:1.92Tue May 29 20:11:23 2007 +++ php-src/ext/standard/mail.c Tue Jul 10 20:23:26 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.92 2007/05/29 20:11:23 iliaa Exp $ */ +/* $Id: mail.c,v 1.93 2007/07/10 20:23:26 stas Exp $ */ #include #include @@ -139,7 +139,7 @@ } if (force_extra_parameters) { - extra_cmd = estrdup(force_extra_parameters); + extra_cmd = php_escape_shell_cmd(force_extra_parameters); } else if (extra_cmd) { extra_cmd = php_escape_shell_cmd(extra_cmd); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
andrei Tue Dec 19 22:54:24 2006 UTC Modified files: /php-src/ext/standard mail.c Log: Unicode support in ezmlm_hash(). # 50% done, ladies and gents! http://www.php.net/~scoates/unicode http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.89&r2=1.90&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.89 php-src/ext/standard/mail.c:1.90 --- php-src/ext/standard/mail.c:1.89Sun Feb 19 18:19:33 2006 +++ php-src/ext/standard/mail.c Tue Dec 19 22:54:24 2006 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.89 2006/02/19 18:19:33 iliaa Exp $ */ +/* $Id: mail.c,v 1.90 2006/12/19 22:54:24 andrei Exp $ */ #include #include @@ -54,7 +54,7 @@ continue; \ } \ -/* {{{ proto int ezmlm_hash(string addr) +/* {{{ proto int ezmlm_hash(string addr) U Calculate EZMLM list hash value. */ PHP_FUNCTION(ezmlm_hash) { @@ -62,8 +62,7 @@ unsigned long h = 5381L; int j, str_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", - &str, &str_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s&", &str, &str_len, UG(ascii_conv)) == FAILURE) { return; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
hyanantha Thu Jul 28 05:41:34 2005 EDT Modified files: /php-src/ext/standard mail.c Log: defined EX_OK and EX_TEMPFAIL in ext/standard/mail.c for NETWARE rather than including a sysexits.h. -Kamesh http://cvs.php.net/diff.php/php-src/ext/standard/mail.c?r1=1.84&r2=1.85&ty=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.84 php-src/ext/standard/mail.c:1.85 --- php-src/ext/standard/mail.c:1.84Sat Sep 25 10:48:44 2004 +++ php-src/ext/standard/mail.c Thu Jul 28 05:41:34 2005 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.84 2004/09/25 14:48:44 hyanantha Exp $ */ +/* $Id: mail.c,v 1.85 2005/07/28 09:41:34 hyanantha Exp $ */ #include #include @@ -42,7 +42,8 @@ #endif #ifdef NETWARE -#include "netware/sysexits.h" /* For exit status codes like EX_OK */ +#define EX_OK 0 /* successful termination */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ #endif #define SKIP_LONG_HEADER_SEP(str, pos) \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
hyanantha Sat Sep 25 10:48:45 2004 EDT Modified files: /php-src/ext/standard mail.c Log: removing unwanted header files getting included http://cvs.php.net/diff.php/php-src/ext/standard/mail.c?r1=1.83&r2=1.84&ty=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.83 php-src/ext/standard/mail.c:1.84 --- php-src/ext/standard/mail.c:1.83Tue Aug 3 02:25:25 2004 +++ php-src/ext/standard/mail.c Sat Sep 25 10:48:44 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.83 2004/08/03 06:25:25 tony2001 Exp $ */ +/* $Id: mail.c,v 1.84 2004/09/25 14:48:44 hyanantha Exp $ */ #include #include @@ -42,7 +42,6 @@ #endif #ifdef NETWARE -#include "netware/pipe.h"/* For popen(), pclose() */ #include "netware/sysexits.h" /* For exit status codes like EX_OK */ #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard mail.c
On Tue, 3 Aug 2004, Antony Dovgal wrote: > tony2001 Tue Aug 3 02:25:25 2004 EDT > > Modified files: > /php-src/ext/standard mail.c > Log: > fix typo in mail.c: mail_force_extra_parameters -> mail.force_extra_parameters Close the bugreport too please. Derick -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
tony2001Tue Aug 3 02:25:25 2004 EDT Modified files: /php-src/ext/standard mail.c Log: fix typo in mail.c: mail_force_extra_parameters -> mail.force_extra_parameters http://cvs.php.net/diff.php/php-src/ext/standard/mail.c?r1=1.82&r2=1.83&ty=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.82 php-src/ext/standard/mail.c:1.83 --- php-src/ext/standard/mail.c:1.82Thu Jan 8 20:35:44 2004 +++ php-src/ext/standard/mail.c Tue Aug 3 02:25:25 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.82 2004/01/09 01:35:44 iliaa Exp $ */ +/* $Id: mail.c,v 1.83 2004/08/03 06:25:25 tony2001 Exp $ */ #include #include @@ -86,7 +86,7 @@ char *subject=NULL, *extra_cmd=NULL; int to_len, message_len, headers_len; int subject_len, extra_cmd_len, i; - char *force_extra_parameters = INI_STR("mail_force_extra_parameters"); + char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); char *to_r, *subject_r; if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Thu Jan 8 20:35:45 2004 EDT Modified files: /php-src/ext/standard mail.c Log: Fixed bug #26847 (memory leak in mail() when to/subject contain only spaces) Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.81 php-src/ext/standard/mail.c:1.82 --- php-src/ext/standard/mail.c:1.81Thu Jan 8 03:17:33 2004 +++ php-src/ext/standard/mail.c Thu Jan 8 20:35:44 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.81 2004/01/08 08:17:33 andi Exp $ */ +/* $Id: mail.c,v 1.82 2004/01/09 01:35:44 iliaa Exp $ */ #include #include @@ -160,10 +160,10 @@ if (extra_cmd) { efree (extra_cmd); } - if (to_len > 0) { + if (to_r != to) { efree(to_r); } - if (subject_len > 0) { + if (subject_r != subject) { efree(subject_r); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Sun Nov 30 14:56:30 2003 EDT Modified files: /php-src/ext/standard mail.c Log: MFB: Fix for possible uninitialized usage of subject_r. Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.79 php-src/ext/standard/mail.c:1.80 --- php-src/ext/standard/mail.c:1.79Mon Oct 20 10:22:01 2003 +++ php-src/ext/standard/mail.c Sun Nov 30 14:56:30 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.79 2003/10/20 14:22:01 iliaa Exp $ */ +/* $Id: mail.c,v 1.80 2003/11/30 19:56:30 iliaa Exp $ */ #include #include @@ -141,6 +141,8 @@ subject_r[i] = ' '; } } + } else { + subject_r = subject; } if (force_extra_parameters) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Mon Oct 20 10:22:01 2003 EDT Modified files: /php-src/ext/standard mail.c Log: Fixed bug #25923 (mail() modifies the to & subject arguments). Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.78 php-src/ext/standard/mail.c:1.79 --- php-src/ext/standard/mail.c:1.78Mon Oct 13 00:15:09 2003 +++ php-src/ext/standard/mail.c Mon Oct 20 10:22:01 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.78 2003/10/13 04:15:09 iliaa Exp $ */ +/* $Id: mail.c,v 1.79 2003/10/20 14:22:01 iliaa Exp $ */ #include #include @@ -87,6 +87,7 @@ int to_len, message_len, headers_len; int subject_len, extra_cmd_len, i; char *force_extra_parameters = INI_STR("mail_force_extra_parameters"); + char *to_r, *subject_r; if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE."); @@ -104,36 +105,40 @@ } if (to_len > 0) { + to_r = estrndup(to, to_len); for (; to_len; to_len--) { - if (!isspace((unsigned char) to[to_len - 1])) { + if (!isspace((unsigned char) to_r[to_len - 1])) { break; } - to[to_len - 1] = '\0'; + to_r[to_len - 1] = '\0'; } - for (i = 0; to[i]; i++) { - if (iscntrl((unsigned char) to[i])) { + for (i = 0; to_r[i]; i++) { + if (iscntrl((unsigned char) to_r[i])) { /* According to RFC 822, section 3.1.1 long headers may be separated into * parts using CRLF followed at least one linear-white-space character ('\t' or ' '). * To prevent these separators from being replaced with a space, we use the * SKIP_LONG_HEADER_SEP to skip over them. */ - SKIP_LONG_HEADER_SEP(to, i); - to[i] = ' '; + SKIP_LONG_HEADER_SEP(to_r, i); + to_r[i] = ' '; } } - } + } else { + to_r = to; + } if (subject_len > 0) { + subject_r = estrndup(subject, subject_len); for (; subject_len; subject_len--) { - if (!isspace((unsigned char) subject[subject_len - 1])) { + if (!isspace((unsigned char) subject_r[subject_len - 1])) { break; } - subject[subject_len - 1] = '\0'; + subject_r[subject_len - 1] = '\0'; } - for(i = 0; subject[i]; i++) { - if (iscntrl((unsigned char) subject[i])) { - SKIP_LONG_HEADER_SEP(subject, i); - subject[i] = ' '; + for(i = 0; subject_r[i]; i++) { + if (iscntrl((unsigned char) subject_r[i])) { + SKIP_LONG_HEADER_SEP(subject_r, i); + subject_r[i] = ' '; } } } @@ -144,7 +149,7 @@ extra_cmd = php_escape_shell_cmd(extra_cmd); } - if (php_mail(to, subject, message, headers, extra_cmd TSRMLS_CC)) { + if (php_mail(to_r, subject_r, message, headers, extra_cmd TSRMLS_CC)) { RETVAL_TRUE; } else { RETVAL_FALSE; @@ -152,6 +157,12 @@ if (extra_cmd) { efree (extra_cmd); + } + if (to_len > 0) { + efree(to_r); + } + if (subject_len > 0) { + efree(subject_r); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Mon Oct 13 00:15:11 2003 EDT Modified files: /php-src/ext/standard mail.c Log: Remove sendmail patch check. Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.77 php-src/ext/standard/mail.c:1.78 --- php-src/ext/standard/mail.c:1.77Thu Sep 11 00:46:10 2003 +++ php-src/ext/standard/mail.c Mon Oct 13 00:15:09 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.77 2003/09/11 04:46:10 iliaa Exp $ */ +/* $Id: mail.c,v 1.78 2003/10/13 04:15:09 iliaa Exp $ */ #include #include @@ -198,31 +198,6 @@ #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. */ - { - char *s=NULL, *p; - - if ((s = strchr(sendmail_path, ' '))) { - p = estrndup(sendmail_path, s - sendmail_path); - } else { - p = sendmail_path; - } - if (VCWD_ACCESS(p, 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 (extra_cmd != NULL) { - efree(sendmail_cmd); - } - if (s) { - efree(p); - } - return 0; - } - if (s) { - efree(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 * sure we don't catch any older errno value. */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Thu Sep 11 00:46:12 2003 EDT Modified files: /php-src/ext/standard mail.c Log: Cleanup r1.76 patch Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.76 php-src/ext/standard/mail.c:1.77 --- php-src/ext/standard/mail.c:1.76Mon Sep 8 16:15:35 2003 +++ php-src/ext/standard/mail.c Thu Sep 11 00:46:10 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.76 2003/09/08 20:15:35 iliaa Exp $ */ +/* $Id: mail.c,v 1.77 2003/09/11 04:46:10 iliaa Exp $ */ #include #include @@ -201,21 +201,25 @@ /* make sure that sendmail_path contains a valid executable, failure to do * would make PHP abruptly exit without a useful error message. */ { - char *s=NULL, p; + char *s=NULL, *p; if ((s = strchr(sendmail_path, ' '))) { - p = *s; - *s = '\0'; + p = estrndup(sendmail_path, s - sendmail_path); + } else { + p = sendmail_path; } - if (access(sendmail_path, X_OK)) { + if (VCWD_ACCESS(p, 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 (extra_cmd != NULL) { + efree(sendmail_cmd); + } if (s) { - *s = p; + efree(p); } return 0; } if (s) { - *s = p; + efree(p); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Mon Sep 8 16:15:36 2003 EDT Modified files: /php-src/ext/standard mail.c Log: Re-enable sendmail binary check, now with parameter detection. Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.75 php-src/ext/standard/mail.c:1.76 --- php-src/ext/standard/mail.c:1.75Mon Sep 1 04:20:17 2003 +++ php-src/ext/standard/mail.c Mon Sep 8 16:15:35 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.75 2003/09/01 08:20:17 stas Exp $ */ +/* $Id: mail.c,v 1.76 2003/09/08 20:15:35 iliaa Exp $ */ #include #include @@ -200,11 +200,24 @@ #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 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
stasMon Sep 1 04:20:18 2003 EDT Modified files: /php-src/ext/standard mail.c Log: The sendmail_path executable check breaks setups that use parameters for sendmail - including the default setup - so I'm disabling it for now. Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.74 php-src/ext/standard/mail.c:1.75 --- php-src/ext/standard/mail.c:1.74Wed Aug 27 19:53:15 2003 +++ php-src/ext/standard/mail.c Mon Sep 1 04:20:17 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.74 2003/08/27 23:53:15 iliaa Exp $ */ +/* $Id: mail.c,v 1.75 2003/09/01 08:20:17 stas Exp $ */ #include #include @@ -200,10 +200,11 @@ #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)) { +/* 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 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
iliaa Wed Aug 27 19:53:16 2003 EDT Modified files: /php-src/ext/standard mail.c Log: Prevent abrupt script execution when sendmail_path contains invalid executable. Add more detail to the warnings regarding execution of sendmail binary. Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.73 php-src/ext/standard/mail.c:1.74 --- php-src/ext/standard/mail.c:1.73Tue Jun 10 16:03:38 2003 +++ php-src/ext/standard/mail.c Wed Aug 27 19:53:15 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.73 2003/06/10 20:03:38 imajes Exp $ */ +/* $Id: mail.c,v 1.74 2003/08/27 23:53:15 iliaa Exp $ */ #include #include @@ -198,6 +198,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. */ @@ -210,7 +217,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; } @@ -239,7 +246,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; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php