Commit 300d7b31 authored by Demi Marie Obenour's avatar Demi Marie Obenour
Browse files

Implement XFixes 6.1

This adds support for terminating the server when a screen locker exits.
Since this allows a client to cause the server to terminate, the client
must have DixManageAccess on the server.
parent d83c84bd
Pipeline #371080 failed with stages
in 1 minute and 25 seconds
......@@ -734,7 +734,7 @@ XEXTPROTO="xextproto >= 7.2.99.901"
INPUTPROTO="inputproto >= 2.3.99.1"
KBPROTO="kbproto >= 1.0.3"
FONTSPROTO="fontsproto >= 2.1.3"
FIXESPROTO="fixesproto >= 6.0"
FIXESPROTO="fixesproto >= 6.1"
DAMAGEPROTO="damageproto >= 1.1"
XCMISCPROTO="xcmiscproto >= 1.2.0"
BIGREQSPROTO="bigreqsproto >= 1.1.0"
......
......@@ -3481,6 +3481,19 @@ CloseDownClient(ClientPtr client)
Bool really_close_down = client->clientGone ||
client->closeDownMode == DestroyAll;
if (XFixesMustTerminateServerOnDisconnect(client)) {
/*
* A screen locker has just crashed! Releasing grabs it holds would
* unlock the screen and create a security vulnerability. Since we
* can’t release the grabs, there is no easy way to avoid leaking
* resources or worse, so the safest action to take is to just exit.
*/
ErrorF("Client that set XFixesClientDisconnectFlagForceTerminate"
" exited, aborting!");
ddxGiveUp(EXIT_ERR_ABORT);
exit(1);
}
if (!client->clientGone) {
/* ungrab server if grabbing client dies */
if (grabState != GrabNone && grabClient == client) {
......
......@@ -73,7 +73,7 @@ xextproto_dep = dependency('xextproto', version: '>= 7.2.99.901', fallback: ['xo
inputproto_dep = dependency('inputproto', version: '>= 2.3.99.1', fallback: ['xorgproto', 'ext_xorgproto'])
kbproto_dep = dependency('kbproto', version: '>= 1.0.3', fallback: ['xorgproto', 'ext_xorgproto'])
fontsproto_dep = dependency('fontsproto', version: '>= 2.1.3', fallback: ['xorgproto', 'ext_xorgproto'])
fixesproto_dep = dependency('fixesproto', version: '>= 6.0', fallback: ['xorgproto', 'ext_xorgproto'])
fixesproto_dep = dependency('fixesproto', version: '>= 6.1', fallback: ['xorgproto', 'ext_xorgproto'])
damageproto_dep = dependency('damageproto', version: '>= 1.1', fallback: ['xorgproto', 'ext_xorgproto'])
xcmiscproto_dep = dependency('xcmiscproto', version: '>= 1.2.0', fallback: ['xorgproto', 'ext_xorgproto'])
bigreqsproto_dep = dependency('bigreqsproto', version: '>= 1.1.0', fallback: ['xorgproto', 'ext_xorgproto'])
......
......@@ -48,6 +48,7 @@
#include "xfixesint.h"
#include "opaque.h"
#include "xace.h"
static DevPrivateKeyRec ClientDisconnectPrivateKeyRec;
......@@ -64,13 +65,25 @@ typedef struct _ClientDisconnect {
int
ProcXFixesSetClientDisconnectMode(ClientPtr client)
{
int rc = Success;
ClientDisconnectPtr pDisconnect = GetClientDisconnect(client);
REQUEST(xXFixesSetClientDisconnectModeReq);
pDisconnect->disconnect_mode = stuff->disconnect_mode;
return Success;
REQUEST_SIZE_MATCH(xXFixesSetClientDisconnectModeReq);
if (stuff->disconnect_mode &
~(CARD32)(XFixesClientDisconnectFlagTerminate |
XFixesClientDisconnectFlagForceTerminate))
return BadValue;
/*
* To force the server to terminate, the client must have permission to
* control the server.
*/
if (stuff->disconnect_mode & XFixesClientDisconnectFlagForceTerminate)
rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
if (rc == Success)
pDisconnect->disconnect_mode = stuff->disconnect_mode;
return rc;
}
int _X_COLD
......@@ -136,6 +149,17 @@ XFixesShouldDisconnectClient(ClientPtr client)
return FALSE;
}
Bool
XFixesMustTerminateServerOnDisconnect(ClientPtr client)
{
ClientDisconnectPtr pDisconnect = GetClientDisconnect(client);
if (!pDisconnect)
return FALSE;
return (pDisconnect->disconnect_mode & XFixesClientDisconnectFlagForceTerminate);
}
Bool
XFixesClientDisconnectInit(void)
{
......
......@@ -309,6 +309,9 @@ int
Bool
XFixesShouldDisconnectClient(ClientPtr client);
Bool
XFixesMustTerminateServerOnDisconnect(ClientPtr client);
/* Xinerama */
#ifdef PANORAMIX
extern int (*PanoramiXSaveXFixesVector[XFixesNumberRequests]) (ClientPtr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment