diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-10-04 22:25:28 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2007-10-04 22:25:28 +0000 |
commit | e2bf2da75482d853c5da54e4dc6b89d0596e68fa (patch) | |
tree | 03776231997a2ef2ab8900ae922e1f6422715466 /daemon | |
parent | 14333ef1ffc4d2c5b162d2631c52ab71d88a2641 (diff) | |
download | gdm-e2bf2da75482d853c5da54e4dc6b89d0596e68fa.tar.gz |
Remove some more obsolete code. Move common code with unknown copyright
2007-10-04 William Jon McCann <mccann@jhu.edu>
* common/Makefile.am:
* common/gdm-common-unknown-origin.c: (gdm_sigchld_block_push),
(gdm_sigchld_block_pop), (gdm_sigterm_block_push),
(gdm_sigterm_block_pop), (gdm_sigusr2_block_push),
(gdm_sigusr2_block_pop), (gdm_safe_fopen_w), (ve_clearenv):
* common/gdm-common-unknown-origin.h:
* common/gdm-common.c:
* common/gdm-common.h:
* config/Makefile.am:
* config/XKeepsCrashing:
* config/default.desktop.in:
* config/extract-shell.sh:
* config/gdmprefetchlist.in:
* config/gettextfoo.h:
* config/locale.alias:
* config/ssh.desktop.in.in:
* configure.ac:
* daemon/Makefile.am:
* daemon/choose.c:
* daemon/choose.h:
* daemon/gdm-xdmcp-display-factory.c:
(gdm_xdmcp_handle_indirect_query), (gdm_xdmcp_handle_manage),
(gdm_xdmcp_handle_managed_forward):
* daemon/main.c: (delete_pid):
* utils/Makefile.am:
* utils/gdm-dmx-reconnect-proxy.c:
Remove some more obsolete code. Move common
code with unknown copyright status into separate file.
Try to identify more copy with unknown copyright status.
svn path=/branches/mccann-gobject/; revision=5340
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/Makefile.am | 2 | ||||
-rw-r--r-- | daemon/choose.c | 371 | ||||
-rw-r--r-- | daemon/choose.h | 48 | ||||
-rw-r--r-- | daemon/gdm-xdmcp-display-factory.c | 11 | ||||
-rw-r--r-- | daemon/main.c | 18 |
5 files changed, 23 insertions, 427 deletions
diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 9264392f..606f0e9d 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -212,8 +212,6 @@ gdm_binary_SOURCES = \ auth.c \ auth.h \ fstype.c \ - choose.c \ - choose.h \ $(NULL) XDMCP_SOURCES = \ diff --git a/daemon/choose.c b/daemon/choose.c deleted file mode 100644 index b3cf8378..00000000 --- a/daemon/choose.c +++ /dev/null @@ -1,371 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * GDM - The GNOME Display Manager - * Copyright (C) 1998, 1999, 2000 Martin K. Petersen <mkp@mkp.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* This file contains the XDMCP chooser glue */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <errno.h> -#include <X11/Xlib.h> -#include <X11/Xmd.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <netdb.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/utsname.h> -#include <fcntl.h> -#include <string.h> - -#include "choose.h" - -#include "gdm-address.h" -#include "gdm-common.h" -#include "gdm-log.h" - -#include "gdm-settings-keys.h" -#include "gdm-settings-direct.h" - -static gint ipending = 0; -static GSList *indirect = NULL; - -static guint indirect_id = 1; - -static gboolean -remove_oldest_pending (void) -{ - GSList *li; - GdmIndirectDisplay *oldest = NULL; - - for (li = indirect; li != NULL; li = li->next) { - GdmIndirectDisplay *idisp = li->data; - if (idisp->acctime == 0) - continue; - - if (oldest == NULL || - idisp->acctime < oldest->acctime) { - oldest = idisp; - } - } - - if (oldest != NULL) { - gdm_choose_indirect_dispose (oldest); - return TRUE; - } else { - return FALSE; - } -} - -#ifndef XDM_UDP_PORT -#define XDM_UDP_PORT 177 -#endif - -static gboolean -get_first_address_for_node (const char *node, - GdmAddress **address) -{ - struct addrinfo hints; - struct addrinfo *ai_list; - struct addrinfo *ai; - int gaierr; - gboolean found; - char strport[NI_MAXSERV]; - - found = FALSE; - - memset (&hints, 0, sizeof (hints)); - hints.ai_family = AF_UNSPEC; - - snprintf (strport, sizeof (strport), "%u", XDM_UDP_PORT); - - if ((gaierr = getaddrinfo (node, strport, &hints, &ai_list)) != 0) { - g_warning ("Unable get address: %s", gai_strerror (gaierr)); - return FALSE; - } - - for (ai = ai_list; ai != NULL; ai = ai->ai_next) { - if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) { - continue; - } -#ifndef ENABLE_IPV6 - if (ai->ai_family == AF_INET6) { - continue; - } -#endif - found = TRUE; - break; - } - - if (ai != NULL) { - if (address != NULL) { - *address = gdm_address_new_from_sockaddr_storage ((struct sockaddr_storage *)ai->ai_addr); - } - } - - freeaddrinfo (ai_list); - - return found; -} - -static int -get_config_int (char *key) -{ - int val; - - gdm_settings_direct_get_int (key, &val); - - return val; -} - -#if 0 -gboolean -gdm_choose_data (const char *data) -{ - int id; - GdmAddress *address; - GSList *li; - char *msg; - char *p; - char *host; - gboolean ret; - - msg = g_strdup (data); - address = NULL; - ret = FALSE; - - p = strtok (msg, " "); - if (p == NULL || strcmp (GDM_SOP_CHOSEN, p) != 0) { - goto out; - } - - p = strtok (NULL, " "); - if (p == NULL || sscanf (p, "%d", &id) != 1) { - goto out; - } - - p = strtok (NULL, " "); - - if (p == NULL) { - goto out; - } - - if (! get_first_address_for_node (p, &address)) { - goto out; - } - - gdm_address_get_numeric_info (address, &host, NULL); - g_debug ("gdm_choose_data: got indirect id: %d address: %s", - id, - host); - g_free (host); - - for (li = indirect; li != NULL; li = li->next) { - GdmIndirectDisplay *idisp = li->data; - if (idisp->id == id) { - /* whack the oldest if more then allowed */ - while (ipending >= get_config_int (GDM_KEY_MAX_INDIRECT) && - remove_oldest_pending ()) - ; - - idisp->acctime = time (NULL); - - g_free (idisp->chosen_host); - idisp->chosen_host = gdm_address_copy (address); - - /* Now this display is pending */ - ipending++; - - ret = TRUE; - break; - } - } - out: - gdm_address_free (address); - g_free (msg); - - return ret; -} -#endif - -GdmIndirectDisplay * -gdm_choose_indirect_alloc (GdmAddress *address) -{ - GdmIndirectDisplay *id; - char *host; - - g_assert (address != NULL); - - id = g_new0 (GdmIndirectDisplay, 1); - id->id = indirect_id++; - /* deal with a rollover, that will NEVER EVER happen, - * but I'm a paranoid bastard */ - if (id->id == 0) - id->id = indirect_id++; - - id->dsp_address = gdm_address_copy (address); - id->chosen_host = NULL; - - id->acctime = 0; - - indirect = g_slist_prepend (indirect, id); - - gdm_address_get_numeric_info (id->dsp_address, &host, NULL); - - g_debug ("gdm_choose_display_alloc: display=%s, pending=%d ", - host, - ipending); - g_free (host); - - return (id); -} - -/* dispose of indirect display of id, if no host is set */ -void -gdm_choose_indirect_dispose_empty_id (guint id) -{ - GSList *li; - - if (id == 0) - return; - - for (li = indirect; li != NULL; li = li->next) { - GdmIndirectDisplay *idisp = li->data; - - if (idisp == NULL) - continue; - - if (idisp->id == id) { - if (idisp->chosen_host == NULL) - gdm_choose_indirect_dispose (idisp); - return; - } - } -} - -GdmIndirectDisplay * -gdm_choose_indirect_lookup_by_chosen (GdmAddress *chosen, - GdmAddress *origin) -{ - GSList *li; - char *host; - - for (li = indirect; li != NULL; li = li->next) { - GdmIndirectDisplay *id = li->data; - - if (id != NULL && - id->chosen_host != NULL && - gdm_address_equal (id->chosen_host, chosen)) { - if (gdm_address_equal (id->dsp_address, origin)) { - return id; - } else if (gdm_address_is_loopback (id->dsp_address) && - gdm_address_is_local (origin)) { - return id; - } - } - } - - gdm_address_get_numeric_info (chosen, &host, NULL); - - g_debug ("gdm_choose_indirect_lookup_by_chosen: Chosen %s host not found", - host); - g_debug ("gdm_choose_indirect_lookup_by_chosen: Origin was: %s", - host); - g_free (host); - - return NULL; -} - - -GdmIndirectDisplay * -gdm_choose_indirect_lookup (GdmAddress *address) -{ - GSList *li, *ilist; - GdmIndirectDisplay *id; - time_t curtime = time (NULL); - char *host; - - ilist = g_slist_copy (indirect); - - for (li = ilist; li != NULL; li = li->next) { - id = (GdmIndirectDisplay *) li->data; - if (id == NULL) - continue; - - if (id->acctime > 0 && - curtime > id->acctime + get_config_int (GDM_KEY_MAX_WAIT_INDIRECT)) { - - gdm_address_get_numeric_info (address, &host, NULL); - g_debug ("gdm_choose_indirect_check: Disposing stale INDIRECT query from %s", - host); - g_free (host); - - gdm_choose_indirect_dispose (id); - continue; - } - - if (gdm_address_equal (id->dsp_address, address)) { - g_slist_free (ilist); - return id; - } - } - g_slist_free (ilist); - - gdm_address_get_numeric_info (address, &host, NULL); - g_debug ("gdm_choose_indirect_lookup: Host %s not found", - host); - g_free (host); - - return NULL; -} - - -void -gdm_choose_indirect_dispose (GdmIndirectDisplay *id) -{ - char *host; - - if (id == NULL) - return; - - indirect = g_slist_remove (indirect, id); - - if (id->acctime > 0) - ipending--; - id->acctime = 0; - - gdm_address_get_numeric_info (id->dsp_address, &host, NULL); - g_debug ("gdm_choose_indirect_dispose: Disposing %s", - host); - g_free (host); - - g_free (id->chosen_host); - id->chosen_host = NULL; - - gdm_address_free (id->dsp_address); - id->dsp_address = NULL; - - g_free (id); -} diff --git a/daemon/choose.h b/daemon/choose.h deleted file mode 100644 index 09c151a7..00000000 --- a/daemon/choose.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * GDM - The GNOME Display Manager - * Copyright (C) 1998, 1999, 2000 Martin K. Petersen <mkp@mkp.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef CHOOSE_H -#define CHOOSE_H - -#include "gdm-address.h" - -typedef struct _GdmIndirectDisplay GdmIndirectDisplay; -struct _GdmIndirectDisplay { - int id; - GdmAddress *dsp_address; - GdmAddress *chosen_host; - time_t acctime; -}; - -GdmIndirectDisplay * gdm_choose_indirect_alloc (GdmAddress *address); -GdmIndirectDisplay * gdm_choose_indirect_lookup (GdmAddress *address); -GdmIndirectDisplay * gdm_choose_indirect_lookup_by_chosen (GdmAddress *chosen, - GdmAddress *origin); -void gdm_choose_indirect_dispose (GdmIndirectDisplay *id); - -/* dispose of indirect display of id, if no host is set */ -void gdm_choose_indirect_dispose_empty_id (guint id); - -gboolean gdm_choose_data (const char *data); - -#endif /* CHOOSE_H */ - -/* EOF */ - diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c index 75766689..a46112bc 100644 --- a/daemon/gdm-xdmcp-display-factory.c +++ b/daemon/gdm-xdmcp-display-factory.c @@ -57,7 +57,6 @@ #include "gdm-display-store.h" #include "auth.h" -#include "choose.h" /* * On Sun, we need to define allow_severity and deny_severity to link @@ -1088,6 +1087,9 @@ gdm_xdmcp_handle_indirect_query (GdmXdmcpDisplayFactory *factory, } +#if 0 + /* FIXME: Add chooser support */ + id = gdm_choose_indirect_lookup (address); if (id != NULL && id->chosen_host != NULL) { @@ -1133,6 +1135,7 @@ gdm_xdmcp_handle_indirect_query (GdmXdmcpDisplayFactory *factory, } else { gdm_xdmcp_send_willing (factory, address); } +#endif out: XdmcpDisposeARRAYofARRAY8 (&clnt_authlist); @@ -2309,7 +2312,8 @@ gdm_xdmcp_handle_manage (GdmXdmcpDisplayFactory *factory, g_debug ("gdm_xdmcp_handle_manage: Looked up %s", name); g_free (name); -#if 0 /* FIXME: */ +#if 0 + /* FIXME: Add chooser support */ if (factory->priv->honor_indirect) { GdmIndirectDisplay *id; @@ -2401,10 +2405,13 @@ gdm_xdmcp_handle_managed_forward (GdmXdmcpDisplayFactory *factory, return; } +#if 0 + /* FIXME: Add chooser support */ id = gdm_choose_indirect_lookup_by_chosen (address, disp_address); if (id != NULL) { gdm_choose_indirect_dispose (id); } +#endif /* Note: we send GOT even on not found, just in case our previous * didn't get through and this was a second managed forward */ diff --git a/daemon/main.c b/daemon/main.c index 822d719a..3d2034e2 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -30,18 +30,17 @@ #include <fcntl.h> #include <pwd.h> #include <grp.h> +#include <wait.h> #include <glib.h> #include <glib/gi18n.h> +#include <glib/gstdio.h> #include <glib-object.h> #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> -/* Needed for signal handling */ -#include "gdm-common.h" - #include "gdm-manager.h" #include "gdm-log.h" #include "gdm-signal-handler.h" @@ -215,7 +214,7 @@ bus_proxy_destroyed_cb (DBusGProxy *bus_proxy, static void delete_pid (void) { - unlink (GDM_PID_FILE); + g_unlink (GDM_PID_FILE); } static void @@ -256,6 +255,11 @@ gdm_final_cleanup (void) g_object_unref (manager); } +/* + * ------------------------------------- + * BEGIN Copyright status/holder unknown + * ------------------------------------- + */ static void main_saveenv (void) { @@ -446,6 +450,12 @@ gdm_daemon_change_user (uid_t *uidp, g_free (groupname); } +/* + * ------------------------------------- + * END Copyright status/holder unknown + * ------------------------------------- + */ + static gboolean signal_cb (int signo, gpointer data) |