diff options
author | Simon Rettberg | 2021-03-04 13:49:43 +0100 |
---|---|---|
committer | Simon Rettberg | 2021-03-04 13:49:43 +0100 |
commit | 6ac4ffab0627df378e161a9406d27da536ec6cb8 (patch) | |
tree | 8c7cde630b8849059a9bfe549f2be9c5a9c99e86 | |
parent | Improve debug layout of screen setup (diff) | |
download | slxgreeter-6ac4ffab0627df378e161a9406d27da536ec6cb8.tar.gz slxgreeter-6ac4ffab0627df378e161a9406d27da536ec6cb8.tar.xz slxgreeter-6ac4ffab0627df378e161a9406d27da536ec6cb8.zip |
Prefix usernames that start with a digit with _x_v28r1
-rw-r--r-- | src/namereplace.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/namereplace.cpp b/src/namereplace.cpp index c2c36a8..93f4a21 100644 --- a/src/namereplace.cpp +++ b/src/namereplace.cpp @@ -64,10 +64,23 @@ void NameReplace::loadSubs() void NameReplace::replace(QString& input) { if (!list.isEmpty()) { + // First, apply user defined replacement for (auto &brumm : list) { input = input.replace(brumm.first, brumm.second); } } + // Now, prefix names that start with a digit, since systemd/logind refuses + // to work with those in more recent versions. It was never a good idea to + // do this anyways, but now we don't have a choice, since sessions without + // a proper systemd user instance will become more and more broken in the + // future. + if (*input.constData() >= '0' && *input.constData() <= '9') { + input = QLatin1String("_x_") + input; + } + // Finally, look up the proper casing of the desired username, as some + // servers (AD) are case insensitive, which can lead to problems if what the + // user entered doesn't exactly match what it's actually spelled like + // server-side. QProcess getCaps; getCaps.start(LOOKUP_PROCESS, QStringList(input)); getCaps.waitForFinished(8000); |