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