From fb49f137ecdec2c6273ee8acf6a34ce98f503eab Mon Sep 17 00:00:00 2001 From: gooh Date: Mon, 11 Jul 2016 14:28:04 +0200 Subject: 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. --- sapi/fpm/fpm/fpm_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sapi') diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index d812452e43..a4d28a6478 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; } -- cgit v1.2.1