summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/namereplace.cpp13
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);