From e0f6ce36ea1ca376164894111feb48e8d00657bf Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 13 Nov 2014 13:30:07 +0100 Subject: [PATCH] CLI/Webserver Setup: Fix argument sanity checks refs #6120 --- .../setup/application/clicommands/ConfigCommand.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/setup/application/clicommands/ConfigCommand.php b/modules/setup/application/clicommands/ConfigCommand.php index 1a328d01d..d97ee8a15 100644 --- a/modules/setup/application/clicommands/ConfigCommand.php +++ b/modules/setup/application/clicommands/ConfigCommand.php @@ -100,11 +100,15 @@ class ConfigCommand extends Command } catch (ProgrammingError $e) { $this->fail($this->translate('Unknown type') . ': ' . $type); } - if (($path = $this->params->get('path', '/icingaweb')) === null) { - $this->fail($this->translate('argument --path is mandatory.')); + $path = $this->params->get('path', '/icingaweb'); + if (! is_string($path) || strlen(trim($path)) === 0) { + $this->fail($this->translate('The argument --path expects a URL path')); } - if (($documentRoot = $this->params->get('documentRoot', $webserver->getDocumentRoot())) === null) { - $this->fail($this->translate('argument --publicPath is mandatory.')); + $documentRoot = $this->params->get('documentRoot', $webserver->getDocumentRoot()); + if (! is_string($documentRoot) || strlen(trim($documentRoot)) === 0) { + $this->fail($this->translate( + 'The argument --documentRoot expects a directory from which the webserver will serve files' + )); } $webserver->setWebPath($path); $webserver->setDocumentRoot($documentRoot);