diff options
author | Simon Rettberg | 2024-10-25 16:25:00 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-10-25 16:25:00 +0200 |
commit | d74d037a7e48acd7904d330e47df83714c57e5d1 (patch) | |
tree | 41383253387e1192303c4a385f54d16ad16667e4 | |
parent | [minilinux] Fix copy & paste error (diff) | |
download | slx-admin-d74d037a7e48acd7904d330e47df83714c57e5d1.tar.gz slx-admin-d74d037a7e48acd7904d330e47df83714c57e5d1.tar.xz slx-admin-d74d037a7e48acd7904d330e47df83714c57e5d1.zip |
[sysconfig] loginscreen: Properly escape strings written to Qt INI
-rw-r--r-- | modules-available/sysconfig/inc/configmodule/loginscreen.inc.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/modules-available/sysconfig/inc/configmodule/loginscreen.inc.php b/modules-available/sysconfig/inc/configmodule/loginscreen.inc.php index 4aa187c0..ed99fcd5 100644 --- a/modules-available/sysconfig/inc/configmodule/loginscreen.inc.php +++ b/modules-available/sysconfig/inc/configmodule/loginscreen.inc.php @@ -76,11 +76,25 @@ class ConfigModule_LoginScreen extends ConfigModule foreach (self::VALID_FIELDS as $field) { if (!isset($this->moduleData[$field])) continue; - $content .= $field . '=' . $this->moduleData[$field] . "\n"; + $content .= $field . '=' . $this->escapeString($this->moduleData[$field]) . "\n"; } return [ "/etc/lightdm/qt-lightdm-greeter.conf.d/80-$id-customization.conf" => $content, ]; } + private function escapeString(string $str) + { + if (strpos($str, '\\') !== false) { + $str = str_replace('\\', '\\\\', $str); + } + if (strpos($str, '"') !== false) { + $str = str_replace('"', '\\"', $str); + } + if (strpos($str, ';') !== false) { + $str = '"' . $str. '"'; + } + return $str; + } + } |