mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
Client: store auth credentials for later use
Store the client's auth credentials, so they can be used by extensions later.
This commit is contained in:
@@ -3549,6 +3549,14 @@ CloseDownClient(ClientPtr client)
|
||||
nextFreeClientID = client->index;
|
||||
clients[client->index] = NullClient;
|
||||
SmartLastClient = NullClient;
|
||||
|
||||
#ifdef CONFIG_STORE_CLIENT_CREDS
|
||||
if (client->authProto)
|
||||
free(client->authProto);
|
||||
if (client->authToken)
|
||||
free(client->authToken);
|
||||
#endif /* CONFIG_STORE_CLIENT_CREDS */
|
||||
|
||||
dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
|
||||
|
||||
while (!clients[currentMaxClients - 1])
|
||||
|
||||
@@ -111,6 +111,12 @@ typedef struct _Client {
|
||||
DeviceIntPtr clientPtr;
|
||||
ClientIdPtr clientIds;
|
||||
int req_fds;
|
||||
|
||||
#ifdef CONFIG_STORE_CLIENT_CREDS
|
||||
/* auth credentials used to connect */
|
||||
char *authProto;
|
||||
char *authToken; // hex printed
|
||||
#endif /* CONFIG_STORE_CLIENT_CREDS */
|
||||
} ClientRec;
|
||||
|
||||
static inline void
|
||||
|
||||
@@ -242,6 +242,9 @@ conf_data.set('XV', build_xv ? '1' : false)
|
||||
conf_data.set('XvExtension', build_xv ? '1' : false)
|
||||
conf_data.set('XvMCExtension', build_xvmc ? '1' : false)
|
||||
|
||||
# enable auto-selected internal lib functions
|
||||
conf_data.set('CONFIG_STORE_CLIENT_CREDS', build_store_client_creds ? '1' : false)
|
||||
|
||||
conf_data.set('HAVE_SHA1_IN_' + sha1.to_upper(), '1', description: 'Use @0@ SHA1 functions'.format(sha1))
|
||||
conf_data.set('HAVE_LIBUNWIND', get_option('libunwind'))
|
||||
|
||||
|
||||
10
meson.build
10
meson.build
@@ -114,8 +114,18 @@ if not libsystemd_daemon_dep.found()
|
||||
libsystemd_daemon_dep = dependency('libsystemd-daemon', required: false)
|
||||
endif
|
||||
|
||||
#
|
||||
# internal lib components needed by other features
|
||||
# (will be enabled later, as needed)
|
||||
#
|
||||
|
||||
# small hashtable implementation
|
||||
build_hashtable = false
|
||||
|
||||
# storing client's auth credentials so they can later be retrieved by extensions
|
||||
build_store_client_creds = false
|
||||
|
||||
|
||||
# Resolve default values of some options
|
||||
xkb_dir = get_option('xkb_dir')
|
||||
if xkb_dir == ''
|
||||
|
||||
@@ -576,6 +576,23 @@ ClientAuthorized(ClientPtr client,
|
||||
priv->auth_id = auth_id;
|
||||
priv->conn_time = 0;
|
||||
|
||||
#ifdef CONFIG_STORE_CLIENT_CREDS
|
||||
{
|
||||
/* store auth credentials for later use */
|
||||
client->authProto = calloc(proto_n+1, 1);
|
||||
memcpy(client->authProto, auth_proto, proto_n);
|
||||
|
||||
client->authToken = calloc(string_n*2+1, 1);
|
||||
char *ptr = client->authToken;
|
||||
for (int x=0; x<string_n; x++)
|
||||
{
|
||||
snprintf(ptr, 3, "%02hhx", auth_string[x]);
|
||||
ptr++;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_STORE_CLIENT_CREDS */
|
||||
|
||||
#ifdef XDMCP
|
||||
/* indicate to Xdmcp protocol that we've opened new client */
|
||||
XdmcpOpenDisplay(priv->fd);
|
||||
|
||||
Reference in New Issue
Block a user