diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index 7cce0d71aa..ecbe001ac9 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -213,11 +213,16 @@ DEFINEFUNC(DBusDispatchStatus , dbus_connection_dispatch,   (DBusConnection
            (connection), return)
 DEFINEFUNC(DBusDispatchStatus , dbus_connection_get_dispatch_status, (DBusConnection             *connection),
            (connection), return)
+DEFINEFUNC(dbus_bool_t        , dbus_connection_get_is_authenticated, (DBusConnection             *connection),
+           (connection), return)
 DEFINEFUNC(dbus_bool_t        , dbus_connection_get_is_connected, (DBusConnection             *connection),
            (connection), return)
 DEFINEFUNC(DBusConnection*    , dbus_connection_open_private, (const char                 *address,
                                                                DBusError                  *error),
            (address, error), return)
+DEFINEFUNC(dbus_bool_t        , dbus_connection_read_write,   (DBusConnection             *connection,
+                                                               int timeout_milliseconds),
+           (connection, timeout_milliseconds), return)
 DEFINEFUNC(DBusConnection*    , dbus_connection_ref,          (DBusConnection             *connection),
            (connection), return)
 DEFINEFUNC(dbus_bool_t        , dbus_connection_send,         (DBusConnection             *connection,
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 412b428bdc..69421e5dd6 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -277,6 +277,11 @@ void QDBusConnectionManager::executeConnectionRequest(QDBusConnectionManager::Co
                 q_dbus_connection_unref(c);
                 c = nullptr;
             }
+        } else {
+          // authenticate the connection to make sure that dbus_connection_can_send_type works
+          while (!q_dbus_connection_get_is_authenticated(c))
+            if (!q_dbus_connection_read_write(c, -1))
+              break;
         }
         break;
     }
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index b0a9342515..84fd6fe125 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -304,6 +304,11 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
     if (serverConnection->anonymousAuthenticationAllowed)
         q_dbus_connection_set_allow_anonymous(connection, true);
 
+    // authenticate the connection to make sure that dbus_connection_can_send_type works
+    while (!q_dbus_connection_get_is_authenticated(connection))
+      if (!q_dbus_connection_read_write(connection, -1))
+        break;
+
     QDBusConnectionPrivate *newConnection = new QDBusConnectionPrivate(serverConnection->parent());
     const auto locker = qt_scoped_lock(QDBusConnectionManager::instance()->mutex);
     QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(newConnection), 16), newConnection);
@@ -1737,6 +1742,30 @@ void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const
     Q_UNUSED(data_set);
 }
 
+static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnection *connection)
+{
+    QDBusConnection::ConnectionCapabilities result;
+    typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int);
+    static can_send_type_t can_send_type = nullptr;
+
+#if defined(QT_LINKED_LIBDBUS)
+# if DBUS_VERSION-0 >= 0x010400
+    can_send_type = dbus_connection_can_send_type;
+# endif
+#elif QT_CONFIG(library)
+    // run-time check if the next functions are available
+    can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type");
+#endif
+
+#ifndef DBUS_TYPE_UNIX_FD
+# define DBUS_TYPE_UNIX_FD int('h')
+#endif
+    if (can_send_type && can_send_type(connection, DBUS_TYPE_UNIX_FD))
+        result |= QDBusConnection::UnixFileDescriptorPassing;
+
+    return result;
+}
+
 void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal &error)
 {
     mode = PeerMode;
@@ -1747,6 +1776,8 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
 
     connection = c;
 
+    capabilities = connectionCapabilies(connection);
+
     q_dbus_connection_set_exit_on_disconnect(connection, false);
     q_dbus_connection_set_watch_functions(connection,
                                         qDBusAddWatch,
@@ -1768,30 +1799,6 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
     QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection);
 }
 
-static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnection *connection)
-{
-    QDBusConnection::ConnectionCapabilities result;
-    typedef dbus_bool_t (*can_send_type_t)(DBusConnection *, int);
-    static can_send_type_t can_send_type = nullptr;
-
-#if defined(QT_LINKED_LIBDBUS)
-# if DBUS_VERSION-0 >= 0x010400
-    can_send_type = dbus_connection_can_send_type;
-# endif
-#elif QT_CONFIG(library)
-    // run-time check if the next functions are available
-    can_send_type = (can_send_type_t)qdbus_resolve_conditionally("dbus_connection_can_send_type");
-#endif
-
-#ifndef DBUS_TYPE_UNIX_FD
-# define DBUS_TYPE_UNIX_FD int('h')
-#endif
-    if (can_send_type && can_send_type(connection, DBUS_TYPE_UNIX_FD))
-        result |= QDBusConnection::UnixFileDescriptorPassing;
-
-    return result;
-}
-
 void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusErrorInternal &error)
 {
     mode = ClientMode;
