diff options
author | Roland Winklmeier <Roland.M.Winklmeier@gmail.com> | 2014-01-13 21:49:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-15 14:15:22 +0100 |
commit | 419a1f53d527583458da46d1508aab272fdf0280 (patch) | |
tree | 374c0a203d118e76a31f1bde3797c1ec01b76826 /src/dbus/qdbusintegrator.cpp | |
parent | 40133df06fea67ab3983b90844cc2a8f47e6e20c (diff) |
Add method to QDBusServer to allow anonymous client connections.
This change adds a new method to QDBusServer to allow anonymous
connections. This is part of the DBus API and was not yet possible
to use with QDBusServer. It is set in the newConnection callback
when a new client tries to connect.
Anonymous connections are enabled by default in DBus but not allowed
by default.
[ChangeLog][QtDBus][QDBusServer] Added method to QDBusServer to allow
anonymous client connections, even if the connecting client is not
authenticated as a user.
Change-Id: I984c9e634101ecd2e67bb25c8d12bb1071836fd3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 7ec19d6fec..1fef6d4d49 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -391,6 +391,10 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v q_dbus_connection_ref(connection); QDBusConnectionPrivate *serverConnection = static_cast<QDBusConnectionPrivate *>(data); + // allow anonymous authentication + if (serverConnection->anonymousAuthenticationAllowed) + q_dbus_connection_set_allow_anonymous(connection, true); + QDBusConnectionPrivate *newConnection = new QDBusConnectionPrivate(serverConnection->parent()); QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(newConnection)), newConnection); @@ -1014,7 +1018,8 @@ extern bool qDBusInitThreads(); QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) : QObject(p), ref(1), capabilities(0), mode(InvalidMode), connection(0), server(0), busService(0), watchAndTimeoutLock(QMutex::Recursive), - rootNode(QString(QLatin1Char('/'))) + rootNode(QString(QLatin1Char('/'))), + anonymousAuthenticationAllowed(false) { static const bool threads = q_dbus_threads_init_default(); static const int debugging = qgetenv("QDBUS_DEBUG").toInt(); |