com php-src: Fix #72575: using --allow-to-run-as-root should ignore missing user directive: sapi/fpm/fpm/fpm_conf.c
| From: | JulienPauli | Date: | Tue, 12 Jul 2016 08:36:17 +0000 |
| Subject: | com php-src: Fix #72575: using --allow-to-run-as-root should ignore missing user directive: sapi/fpm/fpm/fpm_conf.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92949@lists.php.net to get a copy of this message | ||
Commit: fb49f137ecdec2c6273ee8acf6a34ce98f503eab
Author: gooh <gooh@php.net> Mon, 11 Jul 2016 14:28:04 +0200
Committer: Julien Pauli <jpauli@php.net> Tue, 12 Jul 2016 10:36:17 +0200
Parents: d2d17e14eed8930fd31698de80e0d9ac77d4ea62
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fb49f137ecdec2c6273ee8acf6a34ce98f503eab
Log:
Fix #72575: using --allow-to-run-as-root should ignore missing user
directive
Trying to start PHP-FPM with the --allow-to-run-as-root flag will not
work when the user directive is not given in the FPM worker pool
configuration. Parsing the config will fail. Consequently, FPM cannot
start.
The check is in place to prevent FPM from getting started with root
privileges by accident. Prior to #61295 the check would also prevent
any non-root user to start PHP-FPM without a user directive present.
This patch adds an additional check to the config parser, checking for
the --allow-to-run-as-root flag to be present. If so, parsing will no
longer abort for root users even if the user directive is missing.
I will also update the PHP docs since they still state the user
directive is a mandatory setting which it is not since #61295.
Bugs:
https://bugs.php.net/72575
https://bugs.php.net/61295
Changed paths:
M sapi/fpm/fpm/fpm_conf.c
Diff:
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index d812452..a4d28a6 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -763,8 +763,8 @@ static int fpm_conf_process_all_pools() /* {{{ */
}
}
- /* alert if user is not set only if we are not root*/
- if (!wp->config->user && !geteuid()) {
+ /* alert if user is not set; only if we are root and fpm is not running with
--allow-to-run-as-root */
+ if (!wp->config->user && !geteuid() && !fpm_globals.run_as_root) {
zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name);
return -1;
}