Skip to content

Commit 424c41a

Browse files
author
Derick Rethans
committed
- Added an extra ini setting with which extra commands can be forced to
the sendmail deamon on a per-vhost base. The value in this ini setting will override all extra commands passed as the 5th parameter to mail() and will work in Safe Mode. @- Added an extra ini setting (mail_force_extra_paramaters) which forces @ the addition of the specified parameters to be passed as extra @ parameters to the sendmail binary. These parameters will always replace @ the value of the 5th parameter to mail(), even in safe mode. (Derick)
1 parent 17acc55 commit 424c41a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ext/standard/mail.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ PHP_FUNCTION(mail)
8686
char *subject=NULL, *extra_cmd=NULL;
8787
int to_len, message_len, headers_len;
8888
int subject_len, extra_cmd_len, i;
89+
char *force_extra_parameters = INI_STR("mail_force_extra_parameters");
8990

9091
if (PG(safe_mode) && (ZEND_NUM_ARGS() == 5)) {
9192
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE.");
@@ -137,7 +138,9 @@ PHP_FUNCTION(mail)
137138
}
138139
}
139140

140-
if (extra_cmd) {
141+
if (force_extra_parameters) {
142+
extra_cmd = estrdup(force_extra_parameters);
143+
} else if (extra_cmd) {
141144
extra_cmd = php_escape_shell_cmd(extra_cmd);
142145
}
143146

main/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ PHP_INI_BEGIN()
327327
PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision)
328328
PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL)
329329
PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL)
330+
PHP_INI_ENTRY("mail_force_extra_parameters",NULL, PHP_INI_SYSTEM, NULL)
330331
PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL)
331332

332333
STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals)

0 commit comments

Comments
 (0)