Search
j0ke.net Open Build Service
>
Projects
>
internetx
:
php5
>
php-5.3.13
> php-5.3.10-maillog-httphost.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File php-5.3.10-maillog-httphost.patch of Package php-5.3.13
--- ext/standard/mail.c.orig 2012-02-12 16:23:50.983320424 +0100 +++ ext/standard/mail.c 2012-02-12 16:27:23.749729030 +0100 @@ -221,9 +221,22 @@ } \ return val; \ + zval **hgdata; + char *httphost = NULL; + if (mail_log || PG(mail_x_header)) { + zend_is_auto_global("_SERVER", sizeof("_SERVER") - 1 TSRMLS_CC); + if (PG(http_globals)[TRACK_VARS_SERVER] && + zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_HOST", + sizeof("HTTP_HOST"), (void **) &hgdata) == SUCCESS && + Z_TYPE_PP(hgdata) == IS_STRING && + Z_STRLEN_PP(hgdata) != 0) { + httphost = Z_STRVAL_PP(hgdata); + } + } + if (mail_log && *mail_log) { char *tmp; - int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : ""); + int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- HTTP-Host: %s -- Headers: %s\n", zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C), to, httphost ? httphost : "", hdr ? hdr : ""); php_stream *stream = php_stream_open_wrapper(mail_log, "a", IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR, NULL); if (hdr) { /* find all \r\n instances and replace them with spaces, so a log line is always one line long */ @@ -244,14 +257,14 @@ char *f; 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) { - spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n%s", php_getuid(), f, headers); + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\nX-PHP-HTTP-Host: %s\n%s", php_getuid(), tmp, httphost ? httphost : "", headers); } else { - spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\n", php_getuid(), f); + spprintf(&hdr, 0, "X-PHP-Originating-Script: %ld:%s\nX-PHP-HTTP-Host: %s\n", php_getuid(), tmp, httphost ? httphost : ""); } - efree(f); + //efree(f); } if (!sendmail_path) {