Commit cdff5fee authored by William Jon McCann's avatar William Jon McCann

Clean house

svn path=/branches/mccann-gobject/; revision=4984
parent 08646869
......@@ -3,9 +3,9 @@ NULL =
SUBDIRS = \
data \
config \
pixmaps \
common \
daemon \
libgreeter \
gui \
utils \
docs \
......
......@@ -11,7 +11,7 @@ PKG_NAME="GDM"
(test -f $srcdir/configure.ac \
&& test -d $srcdir/daemon \
&& test -f $srcdir/daemon/gdm.h) || {
&& test -f $srcdir/daemon/gdm-display.h) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level gdm directory"
exit 1
......
......@@ -24,8 +24,8 @@ INCLUDES = \
$(DBUS_CFLAGS) \
$(GLIB_CFLAGS)
noinst_LIBRARIES = \
libgdmcommon.a \
noinst_LTLIBRARIES = \
libgdmcommon.la \
$(null)
BUILT_SOURCES = \
......@@ -44,7 +44,7 @@ gdm-marshal.c: gdm-marshal.list
gdm-marshal.h: gdm-marshal.list
@GLIB_GENMARSHAL@ $< --prefix=gdm_marshal --header > $@
libgdmcommon_a_SOURCES = \
libgdmcommon_la_SOURCES = \
gdm-address.h \
gdm-address.c \
gdm-marshal.c \
......@@ -74,6 +74,21 @@ libgdmcommon_a_SOURCES = \
ve-signal.c \
$(NULL)
libgdmcommon_la_CPPFLAGS = \
$(DISABLE_DEPRECATED_CFLAGS) \
$(NULL)
libgdmcommon_la_CFLAGS = \
$(DBUS_CFLAGS) \
$(NULL)
libgdmcommon_la_LIBADD = \
$(NULL)
libgdmcommon_la_LDFLAGS = \
-export-dynamic \
$(NULL)
noinst_PROGRAMS = \
test-settings-server \
test-settings-client \
......
AC_PREREQ(2.52)
AC_INIT(daemon/gdm.h)
AC_PREREQ(2.59c)
AC_INIT([gdm],
[2.99.0],
[http://bugzilla.gnome.org/enter_bug.cgi?product=gdm2],
[gdm])
AC_CONFIG_SRCDIR([daemon/gdm-manager.c])
AM_INIT_AUTOMAKE
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AC_PROG_LIBTOOL
AC_HEADER_STDC
AC_SUBST(VERSION)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gdm,2.19.0)
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE
......@@ -131,7 +145,7 @@ else
LANG_CONFIG_FILE='${sysconfdir}/sysconfig/i18n'
fi
AC_SUBST(LANG_CONFIG_FILE)
AC_PATH_PROG(CONSOLE_HELPER,consolehelper,no)
if test "x$CONSOLE_HELPER" = "xno" ; then
if test "x$enable_console_helper" = "xyes" ; then
......@@ -145,14 +159,7 @@ else
fi
fi
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
dnl AC_ARG_PROGRAM
AM_PROG_LIBTOOL
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_XTRA
dnl socklen_t may be declared, but not in a "standard" C header location
......@@ -463,7 +470,6 @@ AC_SUBST(XDMCP_LIBS)
if test x$XDMCP_SUPPORT = xyes ; then
AM_CONDITIONAL(XDMCP_SUPPORT, true)
GDMCHOOSER=gdmchooser
GDMXNESTCHOOSER=gdmXnestchooser
else
# No need for TCP Wrappers in case XDMCP is disabled
if test x$with_tcp_wrappers != xno ; then
......@@ -472,10 +478,8 @@ else
with_tcp_wrappers=no
AM_CONDITIONAL(XDMCP_SUPPORT, false)
GDMCHOOSER=
GDMXNESTCHOOSER=
fi
AC_SUBST(GDMCHOOSER)
AC_SUBST(GDMXNESTCHOOSER)
#
# TCP Wrappers for XDMCP access control
......@@ -1211,9 +1215,9 @@ AC_DEFINE_UNQUOTED(X_XNEST_UNSCALED_FONTPATH,"$X_XNEST_UNSCALED_FONTPATH")
AC_OUTPUT([
Makefile
daemon/Makefile
libgreeter/Makefile
gui/Makefile
gui/gdmflexiserver-xnest.desktop.in
gui/faces/Makefile
gui/greeter/Makefile
gui/greeter/themes/Makefile
gui/greeter/themes/circles/Makefile
......@@ -1221,11 +1225,12 @@ gui/greeter/themes/happygnome/Makefile
gui/greeter/themes/happygnome-list/Makefile
gui/modules/Makefile
utils/Makefile
pixmaps/Makefile
pixmaps/16x16/Makefile
pixmaps/32x32/Makefile
pixmaps/48x48/Makefile
data/Makefile
data/faces/Makefile
data/pixmaps/Makefile
data/pixmaps/16x16/Makefile
data/pixmaps/32x32/Makefile
data/pixmaps/48x48/Makefile
config/Makefile
common/Makefile
po/Makefile.in
......
......@@ -147,8 +147,6 @@ EXTRA_gdm_binary_SOURCES = \
$(NULL)
CONSOLE_KIT_SOURCES = \
gdmconsolekit.c \
gdmconsolekit.h \
$(NULL)
EXTRA_gdm_binary_SOURCES += $(CONSOLE_KIT_SOURCES)
......
......@@ -46,8 +46,6 @@
#include "gdm-common.h"
#include "gdm-log.h"
#include "gdm-socket-protocol.h"
#include "gdm-settings-keys.h"
#include "gdm-settings-direct.h"
......@@ -142,6 +140,7 @@ get_config_int (char *key)
return val;
}
#if 0
gboolean
gdm_choose_data (const char *data)
{
......@@ -209,7 +208,7 @@ gdm_choose_data (const char *data)
return ret;
}
#endif
GdmIndirectDisplay *
gdm_choose_indirect_alloc (GdmAddress *address)
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; 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 _GDM_DISPLAY_H
#define _GDM_DISPLAY_H
#include <X11/Xlib.h> /* for Display */
#include <X11/Xmd.h> /* for CARD32 */
#include <netinet/in.h> /* for in_addr */
typedef struct _GdmDisplay GdmDisplay;
#include "gdm-net.h" /* for GdmConnection */
/* DO NOTE USE 1, that's used as error if x connection fails usually */
/* Note that there is no reason why these were a power of two, and note
* that they have to fit in 256 */
/* These are the exit codes */
#define DISPLAY_REMANAGE 2 /* Restart display */
#define DISPLAY_ABORT 4 /* Houston, we have a problem */
#define DISPLAY_REBOOT 8 /* Rebewt */
#define DISPLAY_HALT 16 /* Halt */
#define DISPLAY_SUSPEND 17 /* Suspend (don't use, use the interrupt) */
#define DISPLAY_CHOSEN 20 /* successful chooser session,
restart display */
#define DISPLAY_RUN_CHOOSER 30 /* Run chooser */
#define DISPLAY_XFAILED 64 /* X failed */
#define DISPLAY_GREETERFAILED 65 /* greeter failed (crashed) */
#define DISPLAY_RESTARTGREETER 127 /* Restart greeter */
#define DISPLAY_RESTARTGDM 128 /* Restart GDM */
enum {
DISPLAY_UNBORN /* Not yet started */,
DISPLAY_ALIVE /* Yay! we're alive (non-XDMCP) */,
XDMCP_PENDING /* Pending XDMCP display */,
XDMCP_MANAGED /* Managed XDMCP display */,
DISPLAY_DEAD /* Left for dead */,
DISPLAY_CONFIG /* in process of being configured */
};
#define TYPE_STATIC 1 /* X server defined in GDM configuration */
#define TYPE_XDMCP 2 /* Remote display/Xserver */
#define TYPE_FLEXI 3 /* Local Flexi X server */
#define TYPE_FLEXI_XNEST 4 /* Local Flexi Nested server */
#define TYPE_XDMCP_PROXY 5 /* Proxy X server for XDMCP */
#define SERVER_IS_LOCAL(d) ((d)->type == TYPE_STATIC || \
(d)->type == TYPE_FLEXI || \
(d)->type == TYPE_FLEXI_XNEST || \
(d)->type == TYPE_XDMCP_PROXY)
#define SERVER_IS_FLEXI(d) ((d)->type == TYPE_FLEXI || \
(d)->type == TYPE_FLEXI_XNEST || \
(d)->type == TYPE_XDMCP_PROXY)
#define SERVER_IS_PROXY(d) ((d)->type == TYPE_FLEXI_XNEST || \
(d)->type == TYPE_XDMCP_PROXY)
#define SERVER_IS_XDMCP(d) ((d)->type == TYPE_XDMCP || \
(d)->type == TYPE_XDMCP_PROXY)
/* Use this to get the right authfile name */
#define GDM_AUTHFILE(display) \
(display->authfile_gdm != NULL ? display->authfile_gdm : display->authfile)
/* Values between GDM_LOGOUT_ACTION_CUSTOM_CMD_FIRST and
GDM_LOGOUT_ACTION_CUSTOM_CMD_LAST are reserved and should not be used */
typedef enum {
GDM_LOGOUT_ACTION_NONE = 0,
GDM_LOGOUT_ACTION_HALT,
GDM_LOGOUT_ACTION_REBOOT,
GDM_LOGOUT_ACTION_SUSPEND,
GDM_LOGOUT_ACTION_CUSTOM_CMD_FIRST,
GDM_LOGOUT_ACTION_CUSTOM_CMD_LAST,
GDM_LOGOUT_ACTION_LAST
} GdmLogoutAction;
struct _GdmDisplay
{
/* ALL DISPLAY TYPES */
guint8 type;
Display *dsp;
gchar *name; /* value of DISPLAY */
gchar *hostname; /* remote hostname */
guint8 dispstat;
guint16 dispnum;
gboolean logged_in; /* TRUE if someone is logged in */
char *login;
gboolean attached; /* Display is physically attached to the machine. */
gboolean handled;
gboolean tcp_disallowed;
int priority;
gboolean timed_login_ok;
gboolean try_different_greeter;
char *theme_name;
time_t managetime; /* time the display was managed */
/* loop check stuff */
time_t last_start_time;
time_t last_loop_start_time;
gint retry_count;
int sleep_before_run;
gchar *cookie;
gchar *bcookie;
gchar *authfile; /* authfile for the server */
gchar *authfile_gdm; /* authfile readable by gdm user
if necessary */
GSList *auths;
GSList *local_auths;
gchar *userauth;
gboolean authfb;
time_t last_auth_touch;
int screenx;
int screeny;
int screenwidth; /* Note 0 means use the gdk size */
int screenheight;
int lrh_offsetx; /* lower right hand corner x offset */
int lrh_offsety; /* lower right hand corner y offset */
pid_t slavepid;
pid_t greetpid;
pid_t sesspid;
int last_sess_status; /* status returned by last session */
/* Notification connection */
int master_notify_fd; /* write part of the connection */
int slave_notify_fd; /* read part of the connection */
/* The xsession-errors connection */
int xsession_errors_fd; /* write to the file */
int session_output_fd; /* read from the session */
int xsession_errors_bytes;
#define MAX_XSESSION_ERRORS_BYTES (80*2500) /* maximum number of bytes in
the ~/.xsession-errors file */
char *xsession_errors_filename; /* if NULL then there is no .xsession-errors
file */
/* chooser stuff */
pid_t chooserpid;
gboolean use_chooser; /* run chooser instead of greeter */
gchar *chosen_hostname; /* locally chosen hostname if not NULL,
"-query chosen_hostname" is appened to server command line */
int chooser_output_fd; /* from the chooser */
char *chooser_last_line;
guint indirect_id;
gboolean is_emergency_server;
gboolean failsafe_xserver;
gchar *xserver_session_args;
/* Only set in the main daemon as that's the only place that cares */
GdmLogoutAction logout_action;
/* XDMCP TYPE */
time_t acctime;
int xdmcp_dispnum;
CARD32 sessionid;
struct sockaddr_storage addr;
struct sockaddr_storage *addrs; /* array of addresses */
int addr_count; /* number of addresses in array */
/* Note that the above may in fact be empty even though
addr is set, these are just extra addresses
(it could also contain addr for all we know) */
/* ALL LOCAL TYPE (static, flexi) */
int vt;
pid_t servpid;
guint8 servstat;
gchar *command;
time_t starttime;
/* order in the Xservers file for sessreg, -1 if unset yet */
int x_servers_order;
gboolean wait_for_go;
/* STATIC TYPE */
gboolean removeconf; /* used to mark "dynamic" static displays for removal */
gboolean busy_display; /* only needed on static displays since flexi try another */
time_t last_x_failed;
int x_faileds;
/* FLEXI TYPE */
char *preset_user;
uid_t server_uid;
GdmConnection *socket_conn;
/* PROXY/Parented TYPE (flexi-xnest or xdmcp proxy) */
char *parent_disp;
Display *parent_dsp;
/* XDMCP PROXY TYPE */
char *parent_auth_file;
/* FLEXI XNEST TYPE */
char *parent_temp_auth_file;
};
GdmDisplay *gdm_display_alloc (gint id, const gchar *command);
gboolean gdm_display_manage (GdmDisplay *d);
void gdm_display_dispose (GdmDisplay *d);
void gdm_display_unmanage (GdmDisplay *d);
GdmDisplay *gdm_display_lookup (pid_t pid);
#endif /* _GDM_DISPLAY_H */
This diff is collapsed.
/* 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 GDM_ERRORGUI_H
#define GDM_ERRORGUI_H
#include "gdm.h"
#include <gtk/gtkmessagedialog.h>
void gdm_errorgui_error_box_full (GdmDisplay *d,
GtkMessageType type,
const char *error,
const char *details_label,
const char *details_file,
/* zero doesn't mean root,
we never wish to run as root,
zero means use the gdm user */
uid_t uid,
gid_t gid);
void gdm_errorgui_error_box (GdmDisplay *d,
GtkMessageType type,
const char *error);
char * gdm_errorgui_failsafe_question (GdmDisplay *d,
const char *question,
gboolean echo);
gboolean gdm_errorgui_failsafe_yesno (GdmDisplay *d,
const char *question);
int gdm_errorgui_failsafe_ask_buttons (GdmDisplay *d,
const char *question,
char **but);
#endif /* GDM_ERRORGUI_H */
/* EOF */
......@@ -23,7 +23,6 @@
#include <glib/gi18n.h>
#include <sys/stat.h>
#include "gdm.h"
#include "gdm-common.h"
#include "filecheck.h"
......
/* 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
*/
#include "config.h"
#include <strings.h>
#include <unistd.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
#include <glib/gi18n.h>
#include "gdm.h"
#include "misc.h"
#include "gdm-net.h"
#include "gdm-common.h"
#include "gdm-log.h"
#include "gdm-daemon-config.h"
/*
* Kind of a weird setup, new connections whack old connections.
*
* We may want to allow tuning of the max connections, since
* this number means that only a certain number of slaves can
* talk to the daemon at once. Note that since new connections
* whack old connections, this tends to cause traffic problems
* if the daemon is really being hammered.
*
* This is because the slaves retry a failed connection 5 times,
* though they are at least smart enough to sleep 1 second
* between retries if the connection failed on the connect()
* call. But, this means that throwing off a connection causes
* that slave to come back in another second and try to
* connect again. So if the daemon is really being hammered,
* this just causes more traffic problems. It's really faster
* to let each connection finish.
*
* This may cause problems for some setups (perhaps terminal
* servers) where lots of connections may hit the server at once
* and 15 connections may not be enough (especially since the
* console login screen may also be using one of them). Perhaps
* this number should be in configuration file so it can be
* tuned by the end user?
*
* If, when you turn on debug, you notice messages like this
* in the log, "Closing connection, x subconnections reached"
* and some slaves are not working properly, then bumping this
* number up is probably a reasonable fix if you can't simply
* reduce the socket load the daemon must handle.
*/
#define MAX_CONNECTIONS 15
struct _GdmConnection {
int fd;
guint source;
gboolean writable;
GString *buffer;
int message_count;
gboolean nonblock;
int close_level; /* 0 - normal
1 - no close, when called raise to 2
2 - close was requested */
char *filename; /* unix socket or fifo filename */
guint32 user_flags;
GdmConnectionHandler handler;
gpointer data;
GDestroyNotify destroy_notify;
gpointer close_data;
GDestroyNotify close_notify;
GdmConnection *parent;
GList *subconnections;
int n_subconnections;
GdmDisplay *disp;
};
int
gdm_connection_is_server_busy (GdmConnection *conn) {
int max_connections = MAX_CONNECTIONS;
if (conn->n_subconnections >= (max_connections / 2)) {
gdm_debug ("Connections is %d, max is %d, busy TRUE",
conn->n_subconnections, max_connections);
return TRUE;
} else {
gdm_debug ("Connections is %d, max is %d, busy FALSE",
conn->n_subconnections, max_connections);
return FALSE;
}
}
static gboolean
close_if_needed (GdmConnection *conn, GIOCondition cond, gboolean error)
{
/* non-subconnections are never closed */
if (conn->parent == NULL)
return TRUE;
if (cond & G_IO_ERR ||
cond & G_IO_HUP || error) {
if (cond & G_IO_ERR)
gdm_debug ("close_if_needed: Got G_IO_ERR on %d", conn->fd);
if (cond & G_IO_HUP)
gdm_debug ("close_if_needed: Got G_IO_HUP on %d", conn->fd);
if (error)
gdm_debug ("close_if_needed: Got error on %d", conn->fd);
conn->source = 0;
gdm_connection_close (conn);
return FALSE;
}
return TRUE;
}
static gboolean
gdm_connection_handler (GIOChannel *source,
GIOCondition cond,
gpointer data)
{
GdmConnection *conn = data;
char buf[PIPE_SIZE];
char *p;
size_t len;
if ( ! (cond & G_IO_IN))
return close_if_needed (conn, cond, FALSE);
VE_IGNORE_EINTR (len = read (conn->fd, buf, sizeof (buf) -1));
if (len <= 0)
return close_if_needed (conn, cond, TRUE);
buf[len] = '\0';
if (conn->buffer == NULL)
conn->buffer = g_string_new (NULL);
for (p = buf; *p != '\0'; p++) {
if (*p == '\r' ||
(*p == '\n' &&
ve_string_empty (conn->buffer->str)))
/*ignore \r or empty lines*/
continue;
if (*p == '\n' ||
/* cut lines short at 4096 to prevent DoS attacks */
conn->buffer->len > 4096) {
conn->close_level = 1;
conn->message_count++;
conn->handler (conn, conn->buffer->str,
conn->data);
if (conn->close_level == 2) {
conn->close_level = 0;
conn->source = 0;
gdm_connection_close (conn);
return FALSE;
}
conn->close_level = 0;
g_string_truncate (conn->buffer, 0);
} else {
g_string_append_c (conn->buffer, *p);
}
}
return close_if_needed (conn, cond, FALSE);
}
gboolean
gdm_connection_is_writable (GdmConnection *conn)
{
g_return_val_if_fail (conn != NULL, FALSE);
return conn->writable;
}
gboolean
gdm_connection_write (GdmConnection *conn, const char *str)
{
int ret;
int save_errno;
int flags = 0;
#ifndef MSG_NOSIGNAL
void (*old_handler)(int);
#endif
g_return_val_if_fail (conn != NULL, FALSE);
g_return_val_if_fail (str != NULL, FALSE);
if G_UNLIKELY ( ! conn->writable)
return FALSE;
#ifdef MSG_DONTWAIT
if (conn->nonblock)
flags |= MSG_DONTWAIT;
#endif
#ifdef MSG_NOSIGNAL
VE_IGNORE_EINTR (ret = send (conn->fd, str, strlen (str), MSG_NOSIGNAL | flags));
save_errno = errno;
#else
old_handler = signal (SIGPIPE,<