summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2024-10-25 16:25:00 +0200
committerSimon Rettberg2024-10-25 16:25:00 +0200
commitd74d037a7e48acd7904d330e47df83714c57e5d1 (patch)
tree41383253387e1192303c4a385f54d16ad16667e4
parent[minilinux] Fix copy & paste error (diff)
downloadslx-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.php16
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;
+ }
+
}