org.kde.filesharing.samba.isuserknown action does not execute properly for each user
The problem is that all isuserknown
executions scheduled at the same time (with different username argument) returns the same result as the first isuserknown
execution.
There is a minimal reproducible example for this behaviour: https://invent.kde.org/ptrnine/kauth-action-bug
The same happens with isuserknown
action: all isuserknown
executions returns the result for the first user here: https://invent.kde.org/network/kdenetwork-filesharing/-/blob/master/samba/filepropertiesplugin/usermanager.cpp#L101
This patch can be used to test this behaviour in the filesharing plugin:
diff --git a/samba/filepropertiesplugin/usermanager.cpp b/samba/filepropertiesplugin/usermanager.cpp
index 7ae0f22..66bd2e7 100644
--- a/samba/filepropertiesplugin/usermanager.cpp
+++ b/samba/filepropertiesplugin/usermanager.cpp
@@ -6,6 +6,7 @@
#include "usermanager.h"
#include <KUser>
+#include <QDebug>
#include <QFile>
#include <QRegularExpression>
#include <QProcess>
@@ -99,6 +100,7 @@ void User::resolve()
connect(job, &KAuth::ExecuteJob::result, this, [this, job] {
job->deleteLater();
m_inSamba = job->data().value(QStringLiteral("exists"), false).toBool();
+ qWarning() << "user" << m_name << "exists:" << m_inSamba;
Q_EMIT inSambaChanged();
Q_EMIT resolved();
});
@@ -156,6 +158,7 @@ void UserManager::load()
const QString currentUserName = KUser().loginName();
const QStringList nameList = getUsersList();
for (const auto &name : nameList) {
+ qWarning() << "load(): processing user" << name;
++m_waitingForResolution;
auto user = new User(name, this);
connect(user, &User::resolved, this, [this] {
For example, we have two users:
user test
:
# pdbedit --debuglevel=0 --user test
test:500:
and user another-user
:
# pdbedit --debuglevel=0 --user another-user
Username not found!
so the output will be:
load(): processing user "Everyone"
load(): processing user "test"
load(): processing user "another-user"
user "test" exists: true
user "another-user" exists: true
but should be false
for the another-user
.
I don't know for sure if something is being done wrong here, or if it's a flaw/bug (feature!?) in the KAuth.