|
|
c90517 |
From 53132e40e407e4af455504f08d733e485b6bd48e Mon Sep 17 00:00:00 2001
|
|
|
c90517 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
c90517 |
Date: Thu, 21 Feb 2019 15:20:01 -0500
|
|
|
c90517 |
Subject: [PATCH 41/48] xdmcp-display-factory: don't return value from foreach
|
|
|
c90517 |
funcs
|
|
|
c90517 |
|
|
|
c90517 |
The xdmcp code is returning TRUE from its display store foreach
|
|
|
c90517 |
functions, which is useless since commit 47d01abe and wrong
|
|
|
c90517 |
before that.
|
|
|
c90517 |
|
|
|
c90517 |
This commit makes it return void instead.
|
|
|
c90517 |
---
|
|
|
c90517 |
daemon/gdm-xdmcp-display-factory.c | 8 ++------
|
|
|
c90517 |
1 file changed, 2 insertions(+), 6 deletions(-)
|
|
|
c90517 |
|
|
|
c90517 |
diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c
|
|
|
c90517 |
index 5b5786c6f..2e14beab4 100644
|
|
|
c90517 |
--- a/daemon/gdm-xdmcp-display-factory.c
|
|
|
c90517 |
+++ b/daemon/gdm-xdmcp-display-factory.c
|
|
|
c90517 |
@@ -639,76 +639,74 @@ gdm_xdmcp_host_allow (GdmAddress *address)
|
|
|
c90517 |
{
|
|
|
c90517 |
#ifdef HAVE_TCPWRAPPERS
|
|
|
c90517 |
char *client;
|
|
|
c90517 |
char *host;
|
|
|
c90517 |
gboolean ret;
|
|
|
c90517 |
|
|
|
c90517 |
host = NULL;
|
|
|
c90517 |
client = NULL;
|
|
|
c90517 |
|
|
|
c90517 |
/* Find client hostname */
|
|
|
c90517 |
gdm_address_get_hostname (address, &client);
|
|
|
c90517 |
gdm_address_get_numeric_info (address, &host, NULL);
|
|
|
c90517 |
|
|
|
c90517 |
/* Check with tcp_wrappers if client is allowed to access */
|
|
|
c90517 |
ret = hosts_ctl ("gdm", client, host, "");
|
|
|
c90517 |
|
|
|
c90517 |
g_free (host);
|
|
|
c90517 |
g_free (client);
|
|
|
c90517 |
|
|
|
c90517 |
return ret;
|
|
|
c90517 |
#else /* HAVE_TCPWRAPPERS */
|
|
|
c90517 |
return (TRUE);
|
|
|
c90517 |
#endif /* HAVE_TCPWRAPPERS */
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
typedef struct {
|
|
|
c90517 |
GdmAddress *address;
|
|
|
c90517 |
int count;
|
|
|
c90517 |
} CountDisplayData;
|
|
|
c90517 |
|
|
|
c90517 |
-static gboolean
|
|
|
c90517 |
+static void
|
|
|
c90517 |
count_displays_from_host (const char *id,
|
|
|
c90517 |
GdmDisplay *display,
|
|
|
c90517 |
CountDisplayData *data)
|
|
|
c90517 |
{
|
|
|
c90517 |
GdmAddress *address;
|
|
|
c90517 |
|
|
|
c90517 |
if (GDM_IS_XDMCP_DISPLAY (display)) {
|
|
|
c90517 |
address = gdm_xdmcp_display_get_remote_address (GDM_XDMCP_DISPLAY (display));
|
|
|
c90517 |
|
|
|
c90517 |
if (gdm_address_equal (address, data->address)) {
|
|
|
c90517 |
data->count++;
|
|
|
c90517 |
}
|
|
|
c90517 |
}
|
|
|
c90517 |
-
|
|
|
c90517 |
- return TRUE;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
static int
|
|
|
c90517 |
gdm_xdmcp_num_displays_from_host (GdmXdmcpDisplayFactory *factory,
|
|
|
c90517 |
GdmAddress *address)
|
|
|
c90517 |
{
|
|
|
c90517 |
CountDisplayData data;
|
|
|
c90517 |
GdmDisplayStore *store;
|
|
|
c90517 |
|
|
|
c90517 |
data.count = 0;
|
|
|
c90517 |
data.address = address;
|
|
|
c90517 |
|
|
|
c90517 |
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
|
|
|
c90517 |
gdm_display_store_foreach (store,
|
|
|
c90517 |
(GdmDisplayStoreFunc)count_displays_from_host,
|
|
|
c90517 |
&data);
|
|
|
c90517 |
|
|
|
c90517 |
return data.count;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
typedef struct {
|
|
|
c90517 |
GdmAddress *address;
|
|
|
c90517 |
int display_num;
|
|
|
c90517 |
} LookupHostData;
|
|
|
c90517 |
|
|
|
c90517 |
static gboolean
|
|
|
c90517 |
lookup_by_host (const char *id,
|
|
|
c90517 |
GdmDisplay *display,
|
|
|
c90517 |
LookupHostData *data)
|
|
|
c90517 |
{
|
|
|
c90517 |
@@ -1780,78 +1778,76 @@ gdm_xdmcp_send_managed_forward (GdmXdmcpDisplayFactory *factory,
|
|
|
c90517 |
|
|
|
c90517 |
static void
|
|
|
c90517 |
gdm_xdmcp_send_got_managed_forward (GdmXdmcpDisplayFactory *factory,
|
|
|
c90517 |
GdmAddress *address,
|
|
|
c90517 |
GdmAddress *origin)
|
|
|
c90517 |
{
|
|
|
c90517 |
ARRAY8 addr;
|
|
|
c90517 |
XdmcpHeader header;
|
|
|
c90517 |
char *host;
|
|
|
c90517 |
|
|
|
c90517 |
host = NULL;
|
|
|
c90517 |
gdm_address_get_numeric_info (address, &host, NULL);
|
|
|
c90517 |
g_debug ("GdmXdmcpDisplayFactory: Sending GOT_MANAGED_FORWARD to %s",
|
|
|
c90517 |
host ? host : "(null)");
|
|
|
c90517 |
g_free (host);
|
|
|
c90517 |
|
|
|
c90517 |
set_address_for_request (origin, &addr);
|
|
|
c90517 |
|
|
|
c90517 |
header.opcode = (CARD16) GDM_XDMCP_GOT_MANAGED_FORWARD;
|
|
|
c90517 |
header.length = 4 + addr.length;
|
|
|
c90517 |
header.version = GDM_XDMCP_PROTOCOL_VERSION;
|
|
|
c90517 |
XdmcpWriteHeader (&factory->priv->buf, &header);
|
|
|
c90517 |
|
|
|
c90517 |
XdmcpWriteARRAY8 (&factory->priv->buf, &addr);
|
|
|
c90517 |
XdmcpFlush (factory->priv->socket_fd,
|
|
|
c90517 |
&factory->priv->buf,
|
|
|
c90517 |
(XdmcpNetaddr)gdm_address_peek_sockaddr_storage (address),
|
|
|
c90517 |
(int)gdm_sockaddr_len (gdm_address_peek_sockaddr_storage (address)));
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
-static gboolean
|
|
|
c90517 |
+static void
|
|
|
c90517 |
count_sessions (const char *id,
|
|
|
c90517 |
GdmDisplay *display,
|
|
|
c90517 |
GdmXdmcpDisplayFactory *factory)
|
|
|
c90517 |
{
|
|
|
c90517 |
if (GDM_IS_XDMCP_DISPLAY (display)) {
|
|
|
c90517 |
int status;
|
|
|
c90517 |
|
|
|
c90517 |
status = gdm_display_get_status (display);
|
|
|
c90517 |
|
|
|
c90517 |
if (status == GDM_DISPLAY_MANAGED) {
|
|
|
c90517 |
factory->priv->num_sessions++;
|
|
|
c90517 |
} else if (status == GDM_DISPLAY_UNMANAGED) {
|
|
|
c90517 |
factory->priv->num_pending_sessions++;
|
|
|
c90517 |
}
|
|
|
c90517 |
}
|
|
|
c90517 |
-
|
|
|
c90517 |
- return TRUE;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
static void
|
|
|
c90517 |
gdm_xdmcp_recount_sessions (GdmXdmcpDisplayFactory *factory)
|
|
|
c90517 |
{
|
|
|
c90517 |
GdmDisplayStore *store;
|
|
|
c90517 |
|
|
|
c90517 |
factory->priv->num_sessions = 0;
|
|
|
c90517 |
factory->priv->num_pending_sessions = 0;
|
|
|
c90517 |
|
|
|
c90517 |
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
|
|
|
c90517 |
gdm_display_store_foreach (store,
|
|
|
c90517 |
(GdmDisplayStoreFunc)count_sessions,
|
|
|
c90517 |
factory);
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
static gboolean
|
|
|
c90517 |
purge_displays (const char *id,
|
|
|
c90517 |
GdmDisplay *display,
|
|
|
c90517 |
GdmXdmcpDisplayFactory *factory)
|
|
|
c90517 |
{
|
|
|
c90517 |
if (GDM_IS_XDMCP_DISPLAY (display)) {
|
|
|
c90517 |
int status;
|
|
|
c90517 |
time_t currtime;
|
|
|
c90517 |
time_t acctime;
|
|
|
c90517 |
|
|
|
c90517 |
currtime = time (NULL);
|
|
|
c90517 |
status = gdm_display_get_status (display);
|
|
|
c90517 |
acctime = gdm_display_get_creation_time (display);
|
|
|
c90517 |
|
|
|
c90517 |
--
|
|
|
c90517 |
2.26.0
|
|
|
c90517 |
|