Skip to content
Snippets Groups Projects
Commit c12ba186 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Remove any non-printable characters from the logging.processname

parent cd3654bc
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,8 @@ class ErrorLogLoggingHandler implements LoggingHandlerInterface
*/
public function __construct(Configuration $config)
{
$this->processname = $config->getString('logging.processname', 'SimpleSAMLphp');
// Remove any non-printable characters before storing
$this->processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp'));
}
......
......@@ -55,7 +55,9 @@ class FileLoggingHandler implements LoggingHandlerInterface
// get the metadata handler option from the configuration
$this->logFile = $config->getPathValue('loggingdir', 'log/') .
$config->getString('logging.logfile', 'simplesamlphp.log');
$this->processname = $config->getString('logging.processname', 'SimpleSAMLphp');
// Remove any non-printable characters before storing
$this->processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp'));
if (@file_exists($this->logFile)) {
if (!@is_writeable($this->logFile)) {
......
......@@ -22,7 +22,8 @@ class StandardErrorLoggingHandler extends FileLoggingHandler
*/
public function __construct(Configuration $config)
{
$this->processname = $config->getString('logging.processname', 'SimpleSAMLphp');
// Remove any non-printable characters before storing
$this->processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp'));
$this->logFile = 'php://stderr';
}
}
......@@ -29,7 +29,8 @@ class SyslogLoggingHandler implements LoggingHandlerInterface
{
$facility = $config->getInteger('logging.facility', defined('LOG_LOCAL5') ? constant('LOG_LOCAL5') : LOG_USER);
$processname = $config->getString('logging.processname', 'SimpleSAMLphp');
// Remove any non-printable characters before storing
$processname = preg_replace('/[\x00-\x1F\x7F\xA0]/u', '', $config->getString('logging.processname', 'SimpleSAMLphp'));
// Setting facility to LOG_USER (only valid in Windows), enable log level rewrite on windows systems
if (Utils\System::getOS() === Utils\System::WINDOWS) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment