]> git.pld-linux.org Git - packages/php4.git/blame - php4-mail.patch
- rel 42; no pcre_info anymore
[packages/php4.git] / php4-mail.patch
CommitLineData
728d8e76
AM
1diff -ur php-5.2.0.org/ext/standard/mail.c php-5.2.0/ext/standard/mail.c
2--- php-5.2.0.org/ext/standard/mail.c 2006-01-01 13:50:15.000000000 +0100
3+++ php-5.2.0/ext/standard/mail.c 2006-12-01 14:20:27.881416250 +0100
392b90a4
AF
4@@ -21,6 +21,8 @@
5 #include <stdlib.h>
6 #include <ctype.h>
7 #include <stdio.h>
8+#include <syslog.h>
9+#include <string.h>
10 #include "php.h"
9c3c186d 11 #include "ext/standard/info.h"
cf2eaf54
JB
12
13@@ -36,6 +38,9 @@
9c3c186d
AM
14 #include "safe_mode.h"
15 #include "exec.h"
16
17+#include "zend_operators.h"
9c3c186d
AM
18+#include "zend_globals.h"
19+
20 #if HAVE_SENDMAIL
21 #ifdef PHP_WIN32
22 #include "win32/sendmail.h"
728d8e76 23@@ -104,6 +109,18 @@
959097f5
ER
24 return;
25 }
26
728d8e76 27+ /* search for To: and Subject: headers which should be specified in proper mail() parameters, not in additional headers */
959097f5
ER
28+ if (headers != NULL) {
29+ if (strncasecmp(headers, "to:", sizeof("to:") - 1) == 0 || strcasestr(headers, "\nto:")) {
728d8e76
AM
30+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "To: headers aren't allowed in the additional_headers parameter. Use $to parameter for that. Mail not sent.");
31+ RETURN_FALSE;
32+ }
33+ if (strncasecmp(headers, "subject:", sizeof("subject:") - 1) == 0 || strcasestr(headers, "\nsubject:")) {
34+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject: headers aren't allowed in the additional_headers parameter. Use $subject parameter for that. Mail not sent.");
959097f5
ER
35+ RETURN_FALSE;
36+ }
37+ }
38+
39 if (to_len > 0) {
40 to_r = estrndup(to, to_len);
41 for (; to_len; to_len--) {
728d8e76 42@@ -228,8 +245,42 @@
cf2eaf54
JB
43 return 0;
44 }
45 #endif
392b90a4
AF
46- fprintf(sendmail, "To: %s\n", to);
47- fprintf(sendmail, "Subject: %s\n", subject);
7a3dec77 48+ TSRMLS_FETCH();
49+
392b90a4
AF
50+ if ((to != NULL) && (strlen(to)!=0)) {
51+ fprintf(sendmail, "To: %s\n", to);
52+ }
53+ if ((subject != NULL) && (strlen(subject)!=0)) {
54+ fprintf(sendmail, "Subject: %s\n", subject);
55+ }
9c3c186d 56+
9c3c186d
AM
57+ if (PG(http_globals)[TRACK_VARS_SERVER]) {
58+ zval **remote_addr, **server_name, **server_port,
ae210aa2 59+ **script_name, **http_user_agent;
9c3c186d
AM
60+
61+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr)==SUCCESS) {
62+ convert_to_string_ex(remote_addr);
63+ fprintf(sendmail, "HTTP-Posting-Client: %s\n", Z_STRVAL_PP(remote_addr));
64+ }
65+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_NAME", sizeof("SERVER_NAME"), (void **) &server_name)==SUCCESS) {
66+ convert_to_string_ex(server_name);
693e4c99 67+ fprintf(sendmail, "HTTP-Posting-URI: %s", Z_STRVAL_PP(server_name));
9c3c186d
AM
68+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_PORT", sizeof("SERVER_PORT"), (void **) &server_port)==SUCCESS) {
69+ convert_to_string_ex(server_port);
70+ fprintf(sendmail, ":%s", Z_STRVAL_PP(server_port));
71+ }
2bd83307 72+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &script_name)==SUCCESS) {
ae210aa2
AM
73+ convert_to_string_ex(script_name);
74+ fprintf(sendmail, "%s", Z_STRVAL_PP(script_name));
9c3c186d
AM
75+ }
76+ fprintf(sendmail, "\n");
77+ }
78+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &http_user_agent)==SUCCESS) {
79+ convert_to_string_ex(http_user_agent);
80+ fprintf(sendmail, "HTTP-Posting-User-Agent: %s\n", Z_STRVAL_PP(http_user_agent));
81+ }
82+ }
83+
392b90a4
AF
84 if (headers != NULL) {
85 fprintf(sendmail, "%s\n", headers);
86 }
This page took 0.081243 seconds and 4 git commands to generate.