summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@digia.com>2013-05-22 14:23:54 +0200
committerJørgen Lind <jorgen.lind@digia.com>2013-05-22 14:44:52 +0200
commitb6971d6204b9554a713984f4fc40612faec20ea0 (patch)
treea45b36b363140037f605279a0063a10ed7db1b4f /src
parentf7dfdc6b82da1900c485510768c8eb8376183349 (diff)
downloadqtwayland-b6971d6204b9554a713984f4fc40612faec20ea0.tar.gz
Remove the unsecure security protocol extensions
Change-Id: I99a5f964520f801070744ca73df394e1107f3dbf Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp23
-rw-r--r--src/compositor/wayland_wrapper/qwlcompositor.cpp9
-rw-r--r--src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp75
-rw-r--r--src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.h26
-rw-r--r--src/extensions/windowmanager.xml6
-rw-r--r--src/plugins/platforms/wayland_common/qwaylandwindow.cpp5
-rw-r--r--src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.cpp15
-rw-r--r--src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.h3
8 files changed, 7 insertions, 155 deletions
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index f9716925..7f0813a4 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -227,25 +227,10 @@ void QWaylandSurface::setSurfaceItem(QWaylandSurfaceItem *surfaceItem)
qint64 QWaylandSurface::processId() const
{
Q_D(const QWaylandSurface);
- WindowManagerServerIntegration *wmIntegration = d->surface->compositor()->windowManagerIntegration();
- if (!wmIntegration) {
- return 0;
- }
-
- WaylandManagedClient *mcl = wmIntegration->managedClient(d->surface->base()->resource.client);
- return mcl ? mcl->processId() : 0;
-}
-
-QByteArray QWaylandSurface::authenticationToken() const
-{
- Q_D(const QWaylandSurface);
- WindowManagerServerIntegration *wmIntegration = d->surface->compositor()->windowManagerIntegration();
- if (!wmIntegration) {
- return QByteArray();
- }
-
- WaylandManagedClient *mcl = wmIntegration->managedClient(d->surface->base()->resource.client);
- return mcl ? mcl->authenticationToken() : QByteArray();
+ struct wl_client *client = static_cast<struct wl_client *>(this->client());
+ pid_t pid;
+ wl_client_get_credentials(client,&pid, 0,0);
+ return pid;
}
QVariantMap QWaylandSurface::windowProperties() const
diff --git a/src/compositor/wayland_wrapper/qwlcompositor.cpp b/src/compositor/wayland_wrapper/qwlcompositor.cpp
index 96aad809..0f2fedc4 100644
--- a/src/compositor/wayland_wrapper/qwlcompositor.cpp
+++ b/src/compositor/wayland_wrapper/qwlcompositor.cpp
@@ -331,12 +331,9 @@ void Compositor::destroyClient(WaylandClient *c)
if (!client)
return;
- if (m_windowManagerIntegration->managedClient(client)) {
- m_windowManagerIntegration->sendQuitMessage(client);
- m_windowManagerIntegration->removeClient(client);
- } else {
- wl_client_destroy(client);
- }
+ m_windowManagerIntegration->sendQuitMessage(client);
+
+ wl_client_destroy(client);
}
QWindow *Compositor::window() const
diff --git a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp
index 4a36f72f..e607d636 100644
--- a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp
+++ b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.cpp
@@ -61,7 +61,6 @@ WindowManagerServerIntegration::WindowManagerServerIntegration(QWaylandComposito
WindowManagerServerIntegration::~WindowManagerServerIntegration()
{
- qDeleteAll(m_managedClients);
}
void WindowManagerServerIntegration::initialize(QtWayland::Display *waylandDisplay)
@@ -69,39 +68,6 @@ void WindowManagerServerIntegration::initialize(QtWayland::Display *waylandDispl
wl_display_add_global(waylandDisplay->handle(),&qt_windowmanager_interface,this,WindowManagerServerIntegration::bind_func);
}
-void WindowManagerServerIntegration::removeClient(wl_client *client)
-{
- WaylandManagedClient *managedClient = m_managedClients.take(client);
- delete managedClient;
-}
-
-WaylandManagedClient *WindowManagerServerIntegration::managedClient(wl_client *client) const
-{
- return m_managedClients.value(client, 0);
-}
-
-void WindowManagerServerIntegration::mapClientToProcess(wl_client *client, uint32_t processId)
-{
- WaylandManagedClient *managedClient = m_managedClients.value(client);
- if (!managedClient)
- managedClient = new WaylandManagedClient;
- managedClient->m_processId = processId;
- m_managedClients.insert(client, managedClient);
-}
-
-void WindowManagerServerIntegration::authenticateWithToken(wl_client *client, const char *token)
-{
- Q_ASSERT(token != 0 && *token != 0);
-
- WaylandManagedClient *managedClient = m_managedClients.value(client);
- if (!managedClient)
- managedClient = new WaylandManagedClient;
- managedClient->m_authenticationToken = QByteArray(token);
- m_managedClients.insert(client, managedClient);
-
- emit clientAuthenticated(client);
-}
-
void WindowManagerServerIntegration::setShowIsFullScreen(bool value)
{
m_showIsFullScreen = value;
@@ -145,30 +111,11 @@ void WindowManagerServerIntegration::bind_func(struct wl_client *client, void *d
void WindowManagerServerIntegration::destroy_resource(wl_resource *resource)
{
WindowManagerServerIntegrationClientData *data = static_cast<WindowManagerServerIntegrationClientData *>(resource->data);
- WindowManagerServerIntegration *window_mgr = data->integration;
-
- window_mgr->removeClient(resource->client);
delete data;
free(resource);
}
-void WindowManagerServerIntegration::map_client_to_process(struct wl_client *client,
- struct wl_resource *window_mgr_resource,
- uint32_t process_id)
-{
- WindowManagerServerIntegration *window_mgr = static_cast<WindowManagerServerIntegrationClientData *>(window_mgr_resource->data)->integration;
- window_mgr->mapClientToProcess(client,process_id);
-}
-
-void WindowManagerServerIntegration::authenticate_with_token(struct wl_client *client,
- struct wl_resource *window_mgr_resource,
- const char *wl_authentication_token)
-{
- WindowManagerServerIntegration *window_mgr = static_cast<WindowManagerServerIntegrationClientData *>(window_mgr_resource->data)->integration;
- window_mgr->authenticateWithToken(client,wl_authentication_token);
-}
-
void WindowManagerServerIntegration::open_url(struct wl_client *client,
struct wl_resource *window_mgr_resource,
uint32_t remaining,
@@ -186,29 +133,7 @@ void WindowManagerServerIntegration::open_url(struct wl_client *client,
}
const struct qt_windowmanager_interface WindowManagerServerIntegration::windowmanager_interface = {
- WindowManagerServerIntegration::map_client_to_process,
- WindowManagerServerIntegration::authenticate_with_token,
WindowManagerServerIntegration::open_url
};
-
-/// ///
-/// / WaylandManagedClient
-/// ///
-
-WaylandManagedClient::WaylandManagedClient()
- : m_processId(0)
-{
-}
-
-qint64 WaylandManagedClient::processId() const
-{
- return m_processId;
-}
-
-QByteArray WaylandManagedClient::authenticationToken() const
-{
- return m_authenticationToken;
-}
-
QT_END_NAMESPACE
diff --git a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.h b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.h
index b85d69d3..10a29a47 100644
--- a/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.h
+++ b/src/compositor/windowmanagerprotocol/waylandwindowmanagerintegration.h
@@ -72,24 +72,13 @@ public:
~WindowManagerServerIntegration();
void initialize(QtWayland::Display *waylandDisplay);
- void removeClient(wl_client *client);
-
- WaylandManagedClient *managedClient(wl_client *client) const;
void setShowIsFullScreen(bool value);
void sendQuitMessage(wl_client *client);
-signals:
- void clientAuthenticated(wl_client *client);
-
-private:
- void mapClientToProcess(wl_client *client, uint32_t processId);
- void authenticateWithToken(wl_client *client, const char *token);
-
private:
bool m_showIsFullScreen;
QWaylandCompositor *m_compositor;
- QMap<wl_client*, WaylandManagedClient*> m_managedClients;
static void bind_func(struct wl_client *client, void *data,
uint32_t version, uint32_t id);
@@ -108,21 +97,6 @@ private:
static const struct qt_windowmanager_interface windowmanager_interface;
};
-
-class WaylandManagedClient
-{
-public:
- WaylandManagedClient();
- qint64 processId() const;
- QByteArray authenticationToken() const;
-
-private:
- qint64 m_processId;
- QByteArray m_authenticationToken;
-
- friend class WindowManagerServerIntegration;
-};
-
QT_END_NAMESPACE
#endif // WAYLANDWINDOWMANAGERINTEGRATION_H
diff --git a/src/extensions/windowmanager.xml b/src/extensions/windowmanager.xml
index dbec4f1d..e03bc3ad 100644
--- a/src/extensions/windowmanager.xml
+++ b/src/extensions/windowmanager.xml
@@ -39,12 +39,6 @@
</copyright>
<interface name="qt_windowmanager" version="1">
- <request name="map_client_to_process">
- <arg name="processid" type="uint" />
- </request>
- <request name="authenticate_with_token">
- <arg name="processid" type="string" />
- </request>
<request name="open_url">
<description summary="client requests a url to be opened">
If remaining is not 0 this is a multipart request, and
diff --git a/src/plugins/platforms/wayland_common/qwaylandwindow.cpp b/src/plugins/platforms/wayland_common/qwaylandwindow.cpp
index 92698808..a322c2bb 100644
--- a/src/plugins/platforms/wayland_common/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland_common/qwaylandwindow.cpp
@@ -93,11 +93,6 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
if (mDisplay->subSurfaceExtension())
mSubSurfaceWindow = new QWaylandSubSurface(this, mDisplay->subSurfaceExtension()->get_sub_surface_aware_surface(wl_surface()));
-#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
- mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid());
- mDisplay->windowManagerIntegration()->authenticateWithToken();
-#endif
-
if (mShellSurface) {
// Set surface class to the .desktop file name (obtained from executable name)
QFileInfo exeFileInfo(qApp->applicationFilePath());
diff --git a/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.cpp b/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
index c23f7eac..673400bd 100644
--- a/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
+++ b/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.cpp
@@ -108,21 +108,6 @@ void QWaylandWindowManagerIntegration::windowmanager_quit()
QGuiApplication::quit();
}
-void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId)
-{
- if (isInitialized())
- map_client_to_process(uint32_t(processId));
-}
-
-void QWaylandWindowManagerIntegration::authenticateWithToken(const QByteArray &token)
-{
- QByteArray authToken = token;
- if (authToken.isEmpty())
- authToken = qgetenv("WL_AUTHENTICATION_TOKEN");
-
- if (isInitialized() && !authToken.isEmpty())
- authenticate_with_token(authToken.constData());
-}
void QWaylandWindowManagerIntegration::openUrl_helper(const QUrl &url)
{
diff --git a/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.h b/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.h
index 28919731..0982632d 100644
--- a/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.h
+++ b/src/plugins/platforms/wayland_common/windowmanager_integration/qwaylandwindowmanagerintegration.h
@@ -65,9 +65,6 @@ public:
explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay);
virtual ~QWaylandWindowManagerIntegration();
- void mapSurfaceToProcess(struct wl_surface *surface, long long processId);
- void mapClientToProcess(long long processId);
- void authenticateWithToken(const QByteArray &token = QByteArray());
bool openUrl(const QUrl &url);
bool openDocument(const QUrl &url);