|
version 1.1.1.1, 2012/02/21 23:48:02
|
version 1.1.1.2.2.1, 2013/07/22 01:44:16
|
|
Line 42
|
Line 42
|
| #include "php_mail.h" |
#include "php_mail.h" |
| #include "php_ini.h" |
#include "php_ini.h" |
| #include "php_string.h" |
#include "php_string.h" |
| #include "safe_mode.h" |
|
| #include "exec.h" |
#include "exec.h" |
| |
|
| #ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
|
Line 70
|
Line 69
|
| *p = ' '; \ |
*p = ' '; \ |
| } \ |
} \ |
| |
|
| extern long php_getuid(void); | extern long php_getuid(TSRMLS_D); |
| |
|
| /* {{{ proto int ezmlm_hash(string addr) |
/* {{{ proto int ezmlm_hash(string addr) |
| Calculate EZMLM list hash value. */ |
Calculate EZMLM list hash value. */ |
|
Line 106 PHP_FUNCTION(mail)
|
Line 105 PHP_FUNCTION(mail)
|
| char *to_r, *subject_r; |
char *to_r, *subject_r; |
| char *p, *e; |
char *p, *e; |
| |
|
| if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) { | 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_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE"); | |
| RETURN_FALSE; | |
| } | |
| |
| 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 | |
| ) { | |
| return; |
return; |
| } |
} |
| |
|
|
Line 240 PHPAPI int php_mail(char *to, char *subject, char *mes
|
Line 232 PHPAPI int php_mail(char *to, char *subject, char *mes
|
| efree(tmp); |
efree(tmp); |
| } |
} |
| if (PG(mail_x_header)) { |
if (PG(mail_x_header)) { |
| char *tmp = zend_get_executed_filename(TSRMLS_C); | const char *tmp = zend_get_executed_filename(TSRMLS_C); |
| char *f; |
char *f; |
| size_t f_len; |
size_t f_len; |
| |
|
| php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC); |
php_basename(tmp, strlen(tmp), NULL, 0,&f, &f_len TSRMLS_CC); |
| |
|
| if (headers != NULL) { |
if (headers != NULL) { |
| spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(), f, headers); | spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(TSRMLS_C), f, headers); |
| } else { |
} else { |
| spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(), f); | spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(TSRMLS_C), f); |
| } |
} |
| efree(f); |
efree(f); |
| } |
} |
|
Line 288 PHPAPI int php_mail(char *to, char *subject, char *mes
|
Line 280 PHPAPI int php_mail(char *to, char *subject, char *mes
|
| #endif |
#endif |
| |
|
| #ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
| sendmail = popen(sendmail_cmd, "wb"); | sendmail = popen_ex(sendmail_cmd, "wb", NULL, NULL TSRMLS_CC); |
| #else |
#else |
| /* Since popen() doesn't indicate if the internal fork() doesn't work |
/* 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 |
* (e.g. the shell can't be executed) we explicitely set it to 0 to be |