]> git.pld-linux.org Git - packages/php.git/blame - php-mail.patch
- added identification of email source
[packages/php.git] / php-mail.patch
CommitLineData
804cfcec
AM
1diff -urN php-4.2.3.org/ext/standard/mail.c php-4.2.3/ext/standard/mail.c
2--- php-4.2.3.org/ext/standard/mail.c Tue Oct 29 21:35:04 2002
3+++ php-4.2.3/ext/standard/mail.c Tue Oct 29 21:33:03 2002
5316c927
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"
804cfcec 11 #include "ext/standard/info.h"
5316c927 12 #if !defined(PHP_WIN32)
804cfcec
AM
13@@ -37,6 +39,10 @@
14 #include "safe_mode.h"
15 #include "exec.h"
16
17+#include "zend_operators.h"
18+
19+#include "zend_globals.h"
20+
21 #if HAVE_SENDMAIL
22 #ifdef PHP_WIN32
23 #include "win32/sendmail.h"
24@@ -166,8 +172,42 @@
25 efree (sendmail_cmd);
5316c927
AF
26
27 if (sendmail) {
28- fprintf(sendmail, "To: %s\n", to);
29- fprintf(sendmail, "Subject: %s\n", subject);
30+ if ((to != NULL) && (strlen(to)!=0)) {
31+ fprintf(sendmail, "To: %s\n", to);
32+ }
33+ if ((subject != NULL) && (strlen(subject)!=0)) {
34+ fprintf(sendmail, "Subject: %s\n", subject);
35+ }
804cfcec
AM
36+
37+ TSRMLS_FETCH();
38+
39+ if (PG(http_globals)[TRACK_VARS_SERVER]) {
40+ zval **remote_addr, **server_name, **server_port,
41+ **request_uri, **http_user_agent;
42+
43+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr)==SUCCESS) {
44+ convert_to_string_ex(remote_addr);
45+ fprintf(sendmail, "HTTP-Posting-Client: %s\n", Z_STRVAL_PP(remote_addr));
46+ }
47+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_NAME", sizeof("SERVER_NAME"), (void **) &server_name)==SUCCESS) {
48+ convert_to_string_ex(server_name);
49+ fprintf(sendmail, "HTTP-Posting-URI: %s", Z_STRVAL_PP(server_name));
50+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SERVER_PORT", sizeof("SERVER_PORT"), (void **) &server_port)==SUCCESS) {
51+ convert_to_string_ex(server_port);
52+ fprintf(sendmail, ":%s", Z_STRVAL_PP(server_port));
53+ }
54+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &request_uri)==SUCCESS) {
55+ convert_to_string_ex(request_uri);
56+ fprintf(sendmail, "%s", Z_STRVAL_PP(request_uri));
57+ }
58+ fprintf(sendmail, "\n");
59+ }
60+ if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &http_user_agent)==SUCCESS) {
61+ convert_to_string_ex(http_user_agent);
62+ fprintf(sendmail, "HTTP-Posting-User-Agent: %s\n", Z_STRVAL_PP(http_user_agent));
63+ }
64+ }
65+
5316c927
AF
66 if (headers != NULL) {
67 fprintf(sendmail, "%s\n", headers);
68 }
This page took 0.037882 seconds and 4 git commands to generate.