Commit f86251dc authored by Brian Cameron's avatar Brian Cameron Committed by Brian Cameron

Now support --with-sysconfsubdir so that GDM can be configured to have the

2006-03-27  Brian Cameron  <brian.cameron@sun.com>

        * acconfig.h, configure.ac, config/Makefile.am, config/PostLogin,
          config/gdm.conf.in, daemon/Makefile.am, daemon/gdm.[ch],
          daemon/gdmconfig.c, gui/Makefile.am, gui/greeter/Makeifle.am,
          gui/modules/Makefile.am, gui/modules/dwellmouselistener.c,
          gui/modules/keymouselistener.c, utils/Makefile.am: Now support
          --with-sysconfsubdir so that GDM can be configured to have
          the config files in a directory that isn't hardcoded to have "/gdm"
          at the end.  Fixes bug #335957.  Patch provided by Julio M
          Merino Vidal <jmmv@NetBSD.org> with minor changes by me to fix
          some usage of EXPANDED_GDMCONFDIR that caused breakage on Solaris.

        * gui/gdmXnestchooser, gui/gdmchooser.c, gui/gdmcomm.[ch],
          gui/gdmdynamic.c, gui/gdmflexiserver.c, gui/gdmlogin.c,
          gui/gdmphotosetup.c, gui/greeter/greeter.c:  Now use
          gdmcomm_comm_bulk_start and gdmcomm_comm_bulk_stop to wrap areas of
          the code where we want to keep the sockets connection open for
          performance.  This makes gdmsetup start faster and better ensures
          that sockets are not left open.  Now gdmcomm_call_gdm will always
          close the socket unless inside such a block, ensuring that if distros
          add patches to read new config values at random points in the code,
          the socket won't be left open.

        * daemon/gdm.c: Fix gdm_debug message.
parent 2a0310c3
2006-03-27 Brian Cameron <brian.cameron@sun.com>
* acconfig.h, configure.ac, config/Makefile.am, config/PostLogin,
config/gdm.conf.in, daemon/Makefile.am, daemon/gdm.[ch],
daemon/gdmconfig.c, gui/Makefile.am, gui/greeter/Makeifle.am,
gui/modules/Makefile.am, gui/modules/dwellmouselistener.c,
gui/modules/keymouselistener.c, utils/Makefile.am: Now support
--with-sysconfsubdir so that GDM can be configured to have
the config files in a directory that isn't hardcoded to have "/gdm"
at the end. Fixes bug #335957. Patch provided by Julio M
Merino Vidal <jmmv@NetBSD.org> with minor changes by me to fix
some usage of EXPANDED_GDMCONFDIR that caused breakage on Solaris.
* gui/gdmXnestchooser, gui/gdmchooser.c, gui/gdmcomm.[ch],
gui/gdmdynamic.c, gui/gdmflexiserver.c, gui/gdmlogin.c,
gui/gdmphotosetup.c, gui/greeter/greeter.c: Now use
gdmcomm_comm_bulk_start and gdmcomm_comm_bulk_stop to wrap areas of
the code where we want to keep the sockets connection open for
performance. This makes gdmsetup start faster and better ensures
that sockets are not left open. Now gdmcomm_call_gdm will always
close the socket unless inside such a block, ensuring that if distros
add patches to read new config values at random points in the code,
the socket won't be left open.
* daemon/gdm.c: Fix gdm_debug message.
2006-03-22 Tommi Vainikainen <thv@iki.fi>
* configure.ac (ALL_LINGUAS): Added Dzongkha (dz).
......
......@@ -44,14 +44,16 @@
#undef EXPANDED_AUTHDIR
#undef EXPANDED_DATADIR
#undef EXPANDED_BINDIR
#undef EXPANDED_DMCONFDIR
#undef EXPANDED_GDMCONFDIR
#undef EXPANDED_LIBEXECDIR
#undef EXPANDED_LIBDIR
#undef EXPANDED_LOCALEDIR
#undef EXPANDED_LOGDIR
#undef EXPANDED_PIXMAPDIR
#undef EXPANDED_SBINDIR
#undef EXPANDED_SYSCONFDIR
#undef EXPANDED_SESSDIR
#undef EXPANDED_SYSCONFSUBDIR
#undef X_SERVER
#undef X_SERVER_PATH
#undef X_XNEST_PATH
......
pixmapdir = $(datadir)/pixmaps
confdir = $(sysconfdir)/gdm
crossconfdir = $(sysconfdir)/dm
localedir = $(sysconfdir)/gdm
confdir = $(gdmconfdir)
localedir = $(gdmconfdir)
bisessdir = $(datadir)/gdm/BuiltInSessions
instsessdir = $(datadir)/xsessions
initdir = $(sysconfdir)/gdm/Init
initdir = $(gdmconfdir)/Init
authdir = $(localstatedir)/gdm
logdir = $(localstatedir)/log/gdm
gnomercdir = $(sysconfdir)/gdm
postdir = $(sysconfdir)/gdm/PostSession
predir = $(sysconfdir)/gdm/PreSession
postlogindir = $(sysconfdir)/gdm/PostLogin
gnomercdir = $(gdmconfdir)
postdir = $(gdmconfdir)/PostSession
predir = $(gdmconfdir)/PreSession
postlogindir = $(gdmconfdir)/PostLogin
noinst_DATA = gdm.conf
......@@ -70,9 +69,9 @@ install-data-hook: gdm.conf gdm.conf-custom Xsession Init PostSession PreSession
$(mkinstalldirs) $(DESTDIR)$(confdir); \
chmod 755 $(DESTDIR)$(confdir); \
fi
if test '!' -d $(DESTDIR)$(crossconfdir); then \
$(mkinstalldirs) $(DESTDIR)$(crossconfdir); \
chmod 755 $(DESTDIR)$(crossconfdir); \
if test '!' -d $(DESTDIR)$(dmconfdir); then \
$(mkinstalldirs) $(DESTDIR)$(dmconfdir); \
chmod 755 $(DESTDIR)$(dmconfdir); \
fi
if test '!' -d `dirname $(DESTDIR)$(GDM_DEFAULTS_CONF)`; then \
$(mkinstalldirs) `dirname $(DESTDIR)$(GDM_DEFAULTS_CONF)`; \
......
#!/bin/sh
#
# Note: this is a sample and will not be run as is. Change the name of this
# file to <sysconfdir>/gdm/PostLogin/Default for this script to be run. This
# file to <gdmconfdir>/PostLogin/Default for this script to be run. This
# script will be run before any setup is run on behalf of the user and is
# useful if you for example need to do some setup to create a home directory
# for the user or something like that. $HOME, $LOGIN and such will all be
......
......@@ -105,17 +105,17 @@ PidFile=/var/run/gdm.pid
# Note that a post login script is run before a PreSession script. It is run
# after the login is successful and before any setup is run on behalf of the
# user.
PostLoginScriptDir=@EXPANDED_SYSCONFDIR@/gdm/PostLogin/
PreSessionScriptDir=@EXPANDED_SYSCONFDIR@/gdm/PreSession/
PostSessionScriptDir=@EXPANDED_SYSCONFDIR@/gdm/PostSession/
DisplayInitDir=@EXPANDED_SYSCONFDIR@/gdm/Init
PostLoginScriptDir=@EXPANDED_GDMCONFDIR@/PostLogin/
PreSessionScriptDir=@EXPANDED_GDMCONFDIR@/PreSession/
PostSessionScriptDir=@EXPANDED_GDMCONFDIR@/PostSession/
DisplayInitDir=@EXPANDED_GDMCONFDIR@/Init
# Distributions: If you have some script that runs an X server in say VGA
# mode, allowing a login, could you please send it to me?
#FailsafeXServer=
# if X keeps crashing on us we run this script. The default one does a bunch
# of cool stuff to figure out what to tell the user and such and can run an X
# configuration program.
XKeepsCrashing=@EXPANDED_SYSCONFDIR@/gdm/XKeepsCrashing
XKeepsCrashing=@EXPANDED_GDMCONFDIR@/XKeepsCrashing
# Reboot, Halt and suspend commands, you can add different commands separated
# by a semicolon. GDM will use the first one it can find.
#RebootCommand=@REBOOT_COMMAND@
......@@ -126,12 +126,12 @@ ServAuthDir=@EXPANDED_AUTHDIR@
# This is our standard startup script. A bit different from a normal X
# session, but it shares a lot of stuff with that. See the provided default
# for more information.
BaseXsession=@EXPANDED_SYSCONFDIR@/gdm/Xsession
BaseXsession=@EXPANDED_GDMCONFDIR@/Xsession
# This is a directory where .desktop files describing the sessions live. It is
# really a PATH style variable since 2.4.4.2 to allow actual interoperability
# with KDM. Note that <sysconfdir>/dm/Sessions is there for backwards
# with KDM. Note that <dmconfdir>/Sessions is there for backwards
# compatibility reasons with 2.4.4.x.
#SessionDesktopDir=/etc/X11/sessions/:@EXPANDED_SYSCONFDIR@/dm/Sessions/:@EXPANDED_DATADIR@/gdm/BuiltInSessions/:@EXPANDED_DATADIR@/xsessions/
#SessionDesktopDir=/etc/X11/sessions/:@EXPANDED_DMCONFDIR@/Sessions/:@EXPANDED_DATADIR@/gdm/BuiltInSessions/:@EXPANDED_DATADIR@/xsessions/
# This is the default .desktop session. One of the ones in SessionDesktopDir
#DefaultSession=gnome.desktop
# Better leave this blank and HOME will be used. You can use syntax ~/ below
......@@ -273,7 +273,7 @@ Enable=false
# But if you supply something here, the output of this script will be sent as
# status of this host so that the chooser can display it. You could for
# example send load, or mail details for some user, or some such.
#Willing=@EXPANDED_SYSCONFDIR@/gdm/Xwilling
#Willing=@EXPANDED_GDMCONFDIR@/Xwilling
[gui]
# The specific gtkrc file we use. It should be the full path to the gtkrc that
......
......@@ -39,6 +39,25 @@ fi
old_exec_prefix=$exec_prefix
exec_prefix=$REAL_EXEC_PREFIX
dnl
dnl Let the user configure where to look for the configuration files.
dnl
AC_ARG_WITH(sysconfsubdir, AC_HELP_STRING([--with-sysconfsubdir],
[directory name used under sysconfdir, default=gdm]),
sysconfsubdir=${withval}, sysconfsubdir=gdm)
AC_SUBST(sysconfsubdir)
if test x"${sysconfsubdir}" != x; then
gdmconfdir='${sysconfdir}/${sysconfsubdir}'
else
gdmconfdir='${sysconfdir}'
fi
AC_SUBST(gdmconfdir)
AC_ARG_WITH(dmconfdir, AC_HELP_STRING([--with-dmconfdir],
[directory where Sessions are stored, default=SYSCONFDIR/dm]),
dmconfdir=${withval}, dmconfdir=${sysconfdir}/dm)
AC_SUBST(dmconfdir)
dnl
dnl Configure arguments
......@@ -808,7 +827,7 @@ EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
AC_SUBST(EXPANDED_LIBDIR)
AC_DEFINE_UNQUOTED(EXPANDED_LIBDIR,"$EXPANDED_LIBDIR")
LOCALEDIR_TMP="$sysconfdir/gdm"
LOCALEDIR_TMP="$gdmconfdir"
EXPANDED_LOCALEDIR=`eval echo $LOCALEDIR_TMP`
AC_SUBST(EXPANDED_LOCALEDIR)
AC_DEFINE_UNQUOTED(EXPANDED_LOCALEDIR,"$EXPANDED_LOCALEDIR")
......@@ -823,10 +842,15 @@ EXPANDED_LOGDIR=`eval echo $LOGDIR_TMP`
AC_SUBST(EXPANDED_LOGDIR)
AC_DEFINE_UNQUOTED(EXPANDED_LOGDIR,"$EXPANDED_LOGDIR")
SYSCONFDIR_TMP="$sysconfdir"
EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
AC_SUBST(EXPANDED_SYSCONFDIR)
AC_DEFINE_UNQUOTED(EXPANDED_SYSCONFDIR,"$EXPANDED_SYSCONFDIR")
DMCONFDIR_TMP="$dmconfdir"
EXPANDED_DMCONFDIR=`eval echo $DMCONFDIR_TMP`
AC_SUBST(EXPANDED_DMCONFDIR)
AC_DEFINE_UNQUOTED(EXPANDED_DMCONFDIR,"$EXPANDED_DMCONFDIR")
GDMCONFDIR_TMP="$gdmconfdir"
EXPANDED_GDMCONFDIR=`eval echo $GDMCONFDIR_TMP`
AC_SUBST(EXPANDED_GDMCONFDIR)
AC_DEFINE_UNQUOTED(EXPANDED_GDMCONFDIR,"$EXPANDED_GDMCONFDIR")
if test x$DMX_SUPPORT = xyes ; then
GDM_RECONNECT_PROXY=$EXPANDED_BINDIR/gdm-dmx-reconnect-proxy
......@@ -863,15 +887,15 @@ AC_DEFINE_UNQUOTED(GDM_DEFAULTS_CONF,"$GDM_DEFAULTS_CONF")
withval=""
AC_ARG_WITH(custom_conf,
[ --with-custom-conf=<FILENAME> FILENAME to give to custom configuration file [default=SYSCONFDIR/gdm/custom.conf]],)
[ --with-custom-conf=<FILENAME> FILENAME to give to custom configuration file [default=GDMCONFDIR/custom.conf]],)
if test x$withval != x; then
GDM_CUSTOM_CONF="$withval"
else
GDM_CUSTOM_CONF="$sysconfdir/gdm/custom.conf"
GDM_CUSTOM_CONF="$EXPANDED_GDMCONFDIR/custom.conf"
fi
GDM_OLD_CONF="$sysconfdir/gdm/gdm.conf"
GDM_OLD_CONF="$EXPANDED_GDMCONFDIR/gdm.conf"
AC_SUBST(GDM_CUSTOM_CONF)
AC_DEFINE_UNQUOTED(GDM_CUSTOM_CONF,"$GDM_CUSTOM_CONF")
......@@ -885,7 +909,7 @@ AC_ARG_WITH(prefetch,
if test x$with_prefetch != xno ; then
GDMPREFETCH="gdmprefetch"
GDMPREFETCHLIST="gdmprefetchlist"
GDMPREFETCHCMD="$EXPANDED_LIBDIR/gdmprefetch @$EXPANDED_SYSCONFDIR/gdm/gdmprefetchlist"
GDMPREFETCHCMD="$EXPANDED_LIBDIR/gdmprefetch @$EXPANDED_GDMCONFDIR/gdmprefetchlist"
fi
AC_SUBST(GDMPREFETCH)
AC_SUBST(GDMPREFETCHLIST)
......@@ -1098,7 +1122,7 @@ AC_DEFINE_UNQUOTED(X_SERVER,"$X_SERVER")
AC_DEFINE_UNQUOTED(X_SERVER_PATH,"$X_SERVER_PATH")
AC_DEFINE_UNQUOTED(X_CONFIG_OPTIONS,"$X_CONFIG_OPTIONS", Options used when launching xserver)
SESSDIR_TMP="$sysconfdir/gdm/Sessions"
SESSDIR_TMP="$EXPANDED_GDMCONFDIR/Sessions"
EXPANDED_SESSDIR=`eval echo $SESSDIR_TMP`
AC_SUBST(EXPANDED_SESSDIR)
AC_DEFINE_UNQUOTED(EXPANDED_SESSDIR,"$EXPANDED_SESSDIR")
......@@ -1184,11 +1208,13 @@ echo ""
dnl <= Prefixes =>
echo "prefix : $prefix"
echo "sysconf dir : "`eval echo $sysconfdir`
echo "sysconf "`eval echo $EXPANDED_SYSCONFDIR`
echo "gdmconf dir : "`eval echo $EXPANDED_GDMCONFDIR`
echo "dmconf dir : "`eval echo $EXPANDED_DMCONFDIR`
echo "bin dir : $EXPANDED_BINDIR"
echo "sbin dir : $EXPANDED_SBINDIR"
echo "PAM prefix : $PAM_PREFIX"
echo "data dir : "`eval echo $datadir`
echo "data dir : "`eval echo $EXPANDED_DATADIR`
echo "X server : "`eval echo $X_SERVER`
echo ""
......
......@@ -6,6 +6,7 @@ INCLUDES = \
-I. \
-I.. \
-I$(top_srcdir)/vicious-extensions \
-DGDMCONFDIR=\"$(gdmconfdir)\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DLOCALEDIR=\"$(datadir)/locale\" \
$(GUI_CFLAGS) \
......
......@@ -474,7 +474,7 @@ deal_with_x_crashes (GdmDisplay *d)
g_setenv ("BINDIR", EXPANDED_BINDIR, TRUE);
g_setenv ("SBINDIR", EXPANDED_SBINDIR, TRUE);
g_setenv ("LIBEXECDIR", EXPANDED_LIBEXECDIR, TRUE);
g_setenv ("SYSCONFDIR", EXPANDED_SYSCONFDIR, TRUE);
g_setenv ("SYSCONFDIR", GDMCONFDIR, TRUE);
/* To enable gettext stuff in the script */
g_setenv ("TEXTDOMAIN", GETTEXT_PACKAGE, TRUE);
......@@ -2821,7 +2821,7 @@ gdm_handle_user_message (GdmConnection *conn, const gchar *msg, gpointer data)
gdm_debug ("Handling user message: '%s'", msg);
if (gdm_connection_get_message_count (conn) > GDM_SUP_MAX_MESSAGES) {
gdm_debug ("Closing connection, %d messages reached");
gdm_debug ("Closing connection, %d messages reached", GDM_SUP_MAX_MESSAGES);
gdm_connection_write (conn, "ERROR 200 Too many messages\n");
gdm_connection_close (conn);
return;
......@@ -3144,10 +3144,16 @@ gdm_handle_user_message (GdmConnection *conn, const gchar *msg, gpointer data)
g_string_free (msg, TRUE);
} else if (strcmp (msg, GDM_SUP_GET_CUSTOM_CONFIG_FILE) == 0) {
GString *msg;
gchar *ret;
msg = g_string_new ("OK");
g_string_append (msg, "\n");
gdm_connection_printf (conn, "OK %s\n", gdm_get_custom_config_file ());
ret = gdm_get_custom_config_file ();
if (ret)
gdm_connection_printf (conn, "OK %s\n", ret);
else
gdm_connection_write (conn,
"ERROR 1 File not found\n");
g_string_free (msg, TRUE);
} else if (strcmp (msg, GDM_SUP_QUERY_LOGOUT_ACTION) == 0) {
const gchar *sep = " ";
......
......@@ -203,21 +203,21 @@ enum {
#define GDM_KEY_GTK_MODULES_LIST "daemon/GtkModulesList="
#define GDM_KEY_GROUP "daemon/Group=gdm"
#define GDM_KEY_HALT "daemon/HaltCommand=" HALT_COMMAND
#define GDM_KEY_DISPLAY_INIT_DIR "daemon/DisplayInitDir=" EXPANDED_SYSCONFDIR "/gdm/Init"
#define GDM_KEY_DISPLAY_INIT_DIR "daemon/DisplayInitDir=" GDMCONFDIR "/Init"
#define GDM_KEY_KILL_INIT_CLIENTS "daemon/KillInitClients=true"
#define GDM_KEY_LOG_DIR "daemon/LogDir=" EXPANDED_LOGDIR
#define GDM_KEY_PATH "daemon/DefaultPath=" GDM_USER_PATH
#define GDM_KEY_PID_FILE "daemon/PidFile=/var/run/gdm.pid"
#define GDM_KEY_POSTSESSION "daemon/PostSessionScriptDir=" EXPANDED_SYSCONFDIR "/gdm/PostSession/"
#define GDM_KEY_PRESESSION "daemon/PreSessionScriptDir=" EXPANDED_SYSCONFDIR "/gdm/PreSession/"
#define GDM_KEY_POSTLOGIN "daemon/PostLoginScriptDir=" EXPANDED_SYSCONFDIR "/gdm/PreSession/"
#define GDM_KEY_POSTSESSION "daemon/PostSessionScriptDir=" GDMCONFDIR "/PostSession/"
#define GDM_KEY_PRESESSION "daemon/PreSessionScriptDir=" GDMCONFDIR "/PreSession/"
#define GDM_KEY_POSTLOGIN "daemon/PostLoginScriptDir=" GDMCONFDIR "/PreSession/"
#define GDM_KEY_FAILSAFE_XSERVER "daemon/FailsafeXServer="
#define GDM_KEY_X_KEEPS_CRASHING "daemon/XKeepsCrashing=" EXPANDED_SYSCONFDIR "/gdm/XKeepsCrashing"
#define GDM_KEY_X_KEEPS_CRASHING "daemon/XKeepsCrashing=" GDMCONFDIR "/XKeepsCrashing"
#define GDM_KEY_REBOOT "daemon/RebootCommand=" REBOOT_COMMAND
#define GDM_KEY_ROOT_PATH "daemon/RootPath=/sbin:/usr/sbin:" GDM_USER_PATH
#define GDM_KEY_SERV_AUTHDIR "daemon/ServAuthDir=" EXPANDED_AUTHDIR
#define GDM_KEY_SESSION_DESKTOP_DIR "daemon/SessionDesktopDir=/etc/X11/sessions/:" EXPANDED_SYSCONFDIR "/dm/Sessions/:" EXPANDED_DATADIR "/gdm/BuiltInSessions/:" EXPANDED_DATADIR "/xsessions/"
#define GDM_KEY_BASE_XSESSION "daemon/BaseXsession=" EXPANDED_SYSCONFDIR "/gdm/Xsession"
#define GDM_KEY_SESSION_DESKTOP_DIR "daemon/SessionDesktopDir=/etc/X11/sessions/:" EXPANDED_DMCONFDIR "/Sessions/:" EXPANDED_DATADIR "/gdm/BuiltInSessions/:" EXPANDED_DATADIR "/xsessions/"
#define GDM_KEY_BASE_XSESSION "daemon/BaseXsession=" GDMCONFDIR "/Xsession"
#define GDM_KEY_DEFAULT_SESSION "daemon/DefaultSession=gnome.desktop"
#define GDM_KEY_SUSPEND "daemon/SuspendCommand=" SUSPEND_COMMAND
......@@ -286,7 +286,7 @@ enum {
#define GDM_KEY_MAX_INDIRECT "xdmcp/MaxPendingIndirect=4"
#define GDM_KEY_MAX_WAIT_INDIRECT "xdmcp/MaxWaitIndirect=15"
#define GDM_KEY_PING_INTERVAL "xdmcp/PingIntervalSeconds=15"
#define GDM_KEY_WILLING "xdmcp/Willing=" EXPANDED_SYSCONFDIR "/gdm/Xwilling"
#define GDM_KEY_WILLING "xdmcp/Willing=" GDMCONFDIR "/Xwilling"
#define GDM_KEY_XDMCP_PROXY "xdmcp/EnableProxy=false"
#define GDM_KEY_XDMCP_PROXY_XSERVER "xdmcp/ProxyXServer="
......@@ -1010,6 +1010,7 @@ void gdm_final_cleanup (void);
* OK <full path to GDM configuration file>
* ERROR <err number> <english error description>
* 0 = Not implemented
* 1 = File not found
* 200 = Too many messages
* 999 = Unknown error
*/
......
......@@ -882,8 +882,8 @@ _gdm_set_value_string (gchar *key, gchar *value_in, gboolean doing_update)
} else {
gdm_info (_("%s: BaseXsession empty; using %s/gdm/Xsession"),
"gdm_config_parse",
EXPANDED_SYSCONFDIR);
*setting = g_build_filename (EXPANDED_SYSCONFDIR,
GDMCONFDIR);
*setting = g_build_filename (GDMCONFDIR,
"gdm", "Xsession", NULL);
}
......
......@@ -3,7 +3,6 @@ SUBDIRS = . greeter modules faces
## Process this file with automake to produce makefile.in
DEFS = @DEFS@ \
-DPREFIX=\"@prefix@\" \
-DSYSCONFDIR=\"@sysconfdir@\" \
-DDATADIR=\"@datadir@\" \
-DLIBDIR=\"@libdir@\" \
-DGDM_GLADE_DIR=\"@datadir@/gdm\"
......
......@@ -493,13 +493,16 @@ main (int argc, char *argv[])
host = args[0];
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
xdmcp_enabled = gdm_config_get_bool (GDM_KEY_XDMCP);
honor_indirect = gdm_config_get_bool (GDM_KEY_INDIRECT);
pidfile = gdm_config_get_string (GDM_KEY_PID_FILE);
xnest = gdm_config_get_string (GDM_KEY_XNEST);
/* At this point we are done using the socket, so close it */
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
/* complex and wonderous way to get the exec vector */
execvec = make_us_an_exec_vector (xnest);
......
......@@ -1776,6 +1776,9 @@ gdm_chooser_gui_init (void)
static gboolean
gdm_read_config (void)
{
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
gdmcomm_set_debug (gdm_config_get_bool (GDM_KEY_DEBUG));
/*
......@@ -1798,7 +1801,7 @@ gdm_read_config (void)
gdm_config_get_bool (GDM_KEY_ALLOW_ADD);
gdm_config_get_bool (GDM_KEY_MULTICAST);
gdmcomm_comm_close();
gdmcomm_comm_bulk_stop ();
}
static gboolean
......@@ -1806,6 +1809,9 @@ gdm_reread_config (int sig, gpointer data)
{
/* reparse config stuff here. At least ones we care about */
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
if (gdm_config_reload_bool (GDM_KEY_DEBUG))
gdmcomm_set_debug (gdm_config_get_bool (GDM_KEY_DEBUG));
......@@ -1842,11 +1848,13 @@ gdm_reread_config (int sig, gpointer data)
if (gdm_config_reload_string (GDM_KEY_BACKGROUND_COLOR) ||
gdm_config_reload_int (GDM_KEY_BACKGROUND_TYPE)) {
if (gdm_config_get_int (GDM_KEY_BACKGROUND_TYPE) != GDM_BACKGROUND_NONE)
gdm_common_setup_background_color (gdm_config_get_string (GDM_KEY_BACKGROUND_COLOR));
if (gdm_config_get_int (GDM_KEY_BACKGROUND_TYPE) != GDM_BACKGROUND_NONE) {
gdm_common_setup_background_color (gdm_config_get_string
(GDM_KEY_BACKGROUND_COLOR));
}
}
gdmcomm_comm_close();
gdmcomm_comm_bulk_stop ();
return TRUE;
}
......
......@@ -42,9 +42,10 @@
#include "gdmcomm.h"
#include "gdmconfig.h"
static gboolean debug = FALSE;
static gboolean quiet = FALSE;
static int num_cmds = 0;
static gboolean bulk_acs = FALSE;
static gboolean debug = FALSE;
static gboolean quiet = FALSE;
static int num_cmds = 0;
/*
* Note, in this function we have to call gdm_common_error instead
......@@ -176,9 +177,9 @@ gdmcomm_call_gdm_real (const char *command,
/*
* If already sent the max number of commands, close the connection
* and reopen
* and reopen. Subtract 1 to allow the "CLOSE" to get through.
*/
if (num_cmds == (GDM_SUP_MAX_MESSAGES)) {
if (num_cmds == (GDM_SUP_MAX_MESSAGES - 1)) {
if (debug)
gdm_common_error (" Closing and reopening connection.");
do_command (comm_fd, GDM_SUP_CLOSE, FALSE);
......@@ -269,6 +270,7 @@ gdmcomm_call_gdm_real (const char *command,
gdm_common_error (" Version check failed, bad name");
g_free (ret);
do_command (comm_fd, GDM_SUP_CLOSE, FALSE);
VE_IGNORE_EINTR (close (comm_fd));
comm_fd = 0;
return NULL;
......@@ -277,6 +279,7 @@ gdmcomm_call_gdm_real (const char *command,
if ( !quiet)
gdm_common_error (" Version check failed, bad version");
g_free (ret);
do_command (comm_fd, GDM_SUP_CLOSE, FALSE);
VE_IGNORE_EINTR (close (comm_fd));
comm_fd = 0;
return NULL;
......@@ -300,6 +303,7 @@ gdmcomm_call_gdm_real (const char *command,
if (strcmp (ve_sure_string (ret), "OK") != 0) {
if ( !quiet)
gdm_common_error (" Error, auth check failed");
do_command (comm_fd, GDM_SUP_CLOSE, FALSE);
VE_IGNORE_EINTR (close (comm_fd));
comm_fd = 0;
/* returns the error */
......@@ -316,6 +320,23 @@ gdmcomm_call_gdm_real (const char *command,
min_version, tries - 1, try_start);
}
/*
* We want to leave the connection open if bulk_acs is set to
* true, so clients can read as much config data in one
* sockets connection when it is set. This requires that
* GDM client programs ensure that they call the bulk_start
* and bulk_stop functions around blocks of code that
* need to read data in bulk. If a client reads config data
* outside of the bulk_start/stop functions, then this
* will just negatively affect performance since an additional
* socket will be opened to read that config data.
*/
if (bulk_acs == FALSE) {
do_command (comm_fd, GDM_SUP_CLOSE, FALSE);
VE_IGNORE_EINTR (close (comm_fd));
comm_fd = 0;
}
return ret;
}
......@@ -361,14 +382,22 @@ gdmcomm_set_allow_sleep (gboolean val)
}
void
gdmcomm_comm_close (void)
gdmcomm_comm_bulk_start (void)
{
bulk_acs = TRUE;
}
void
gdmcomm_comm_bulk_stop (void)
{
/* Close the connection */
if (comm_fd > 0) {
do_command (comm_fd, GDM_SUP_CLOSE, FALSE);
VE_IGNORE_EINTR (close (comm_fd));
}
comm_fd = 0;
num_cmds = 0;
bulk_acs = FALSE;
}
const char *
......
......@@ -31,7 +31,8 @@ char * gdmcomm_call_gdm (const char *command,
int tries);
gboolean gdmcomm_did_connection_fail (void);
void gdmcomm_set_allow_sleep (gboolean val);
void gdmcomm_comm_close (void);
void gdmcomm_comm_bulk_start (void);
void gdmcomm_comm_bulk_finish (void);
const char * gdmcomm_get_display (void);
/* This just gets a cookie of MIT-MAGIC-COOKIE-1 type */
......
......@@ -220,6 +220,9 @@ main (int argc, char *argv[])
}
}
/* Start reading config data in bulk */
gdmcomm_comm_bulk_start ();
/*
* All other commands besides LIST need root cookie. Only bother
* getting the cookie if we haven't already gotten it since we do
......@@ -278,8 +281,8 @@ main (int argc, char *argv[])
}
}
/* Close socket now we are done using it. */
gdmcomm_comm_close ();
/* Done reading config data */
gdmcomm_comm_bulk_stop ();
/*
* If the connection failed, sleep and try again. The sleep time is
......
......@@ -733,6 +733,9 @@ main (int argc, char *argv[])
return 1;
}
/* Start reading config data in bulk */
gdmcomm_comm_bulk_start ();
/* Process --command option */
if (send_command != NULL) {
......@@ -770,7 +773,7 @@ main (int argc, char *argv[])
}
/* At this point we are done using the socket, so close it */
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
if (ret != NULL) {
g_print ("%s\n", ret);
......@@ -819,9 +822,11 @@ main (int argc, char *argv[])
if (use_xnest) {
char *cookie = gdmcomm_get_a_cookie (FALSE /* binary */);
if (cookie == NULL) {
/* At this point we are done using the socket, so close it */
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
dialog = ve_hig_dialog_new
(NULL /* parent */,
......@@ -849,8 +854,9 @@ main (int argc, char *argv[])
auth_cookie = NULL;
} else {
if (auth_cookie == NULL) {
/* At this point we are done using the socket, so close it */
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
dialog = ve_hig_dialog_new
(NULL /* parent */,
......@@ -883,7 +889,7 @@ main (int argc, char *argv[])
g_free (command);
/* At this point we are done using the socket, so close it */
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
if (ret != NULL &&
strncmp (ret, "OK ", 3) == 0) {
......
......@@ -3071,6 +3071,9 @@ enum {
static void
gdm_read_config (void)
{
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
gdmcomm_set_debug (gdm_config_get_bool (GDM_KEY_DEBUG));
/*
......@@ -3145,7 +3148,7 @@ gdm_read_config (void)
gdm_config_get_string (GDM_KEY_PRE_FETCH_PROGRAM);
gdm_config_get_bool (GDM_KEY_SET_POSITION);
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
}
static gboolean
......@@ -3153,6 +3156,9 @@ gdm_reread_config (int sig, gpointer data)
{
gboolean resize = FALSE;
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
if (gdm_config_reload_bool (GDM_KEY_DEBUG))
gdmcomm_set_debug (gdm_config_get_bool (GDM_KEY_DEBUG));
......@@ -3220,7 +3226,7 @@ gdm_reread_config (int sig, gpointer data)
gdm_wm_save_wm_order ();
gdm_kill_thingies ();
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
_exit (DISPLAY_RESTARTGREETER);
return TRUE;
......@@ -3300,7 +3306,7 @@ gdm_reread_config (int sig, gpointer data)
if (resize)
login_window_resize (TRUE /* force */);
gdmcomm_comm_close();
gdmcomm_comm_bulk_stop ();
return TRUE;
}
......
......@@ -307,6 +307,8 @@ main (int argc, char *argv[])
gtk_init(&argc, &argv);
photofile = g_build_filename (g_get_home_dir (), ".face", NULL);
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
face_browser = gdm_config_get_bool (GDM_KEY_BROWSER);
max_size = gdm_config_get_int (GDM_KEY_USER_MAX_FILE);
max_width = gdm_config_get_int (GDM_KEY_MAX_ICON_WIDTH);
......@@ -314,7 +316,7 @@ main (int argc, char *argv[])
greeter = gdm_config_get_string (GDM_KEY_GREETER);
facedir = gdm_config_get_string (GDM_KEY_GLOBAL_FACE_DIR);
/* At this point we are done using the socket, so close it */
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
imagename = NULL;
gtk_window_set_default_icon_name ("stock_person");
......
......@@ -6455,13 +6455,20 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_from_file (DATADIR"/pixmaps/gdm-setup.png", NULL);
glade_gnome_init();
/* Start using socket */
gdmcomm_comm_bulk_start ();
config_file = gdm_common_get_config_file ();
if (config_file == NULL) {
/* Done using socket */
gdmcomm_comm_bulk_stop ();
g_print (_("Could not access GDM configuration file.\n"));
exit (EXIT_FAILURE);
}
custom_config_file = gdm_common_get_custom_config_file ();
if (config_file == NULL) {
/* Done using socket */
gdmcomm_comm_bulk_stop ();
g_print (_("Could not access GDM configuration file.\n"));
exit (EXIT_FAILURE);
}
......@@ -6501,6 +6508,9 @@ main (int argc, char *argv[])
if ( ! DOING_GDM_DEVELOPMENT &&
geteuid() != 0) {
/* Done using socket */
gdmcomm_comm_bulk_stop ();
GtkWidget *fatal_error =
ve_hig_dialog_new (NULL /* parent */,
GTK_DIALOG_MODAL /* flags */,
......@@ -6536,6 +6546,10 @@ main (int argc, char *argv[])
xservers = gdm_config_get_xservers (FALSE);
dialog = setup_gui ();
/* Done using socket */
gdmcomm_comm_bulk_stop ();
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (apply_user_changes), dialog);
gtk_widget_show (dialog);
......
......@@ -6,7 +6,7 @@ INCLUDES = \
-I$(top_srcdir)/gui \
-I$(top_srcdir)/daemon \
-I$(top_srcdir)/vicious-extensions \
-DGDM_CONFIG_FILE=\"@sysconfdir@/gdm/gdm.conf\" \
-DGDM_CONFIG_FILE=\"$(gdmconfdir)/gdm.conf\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
$(GUI_CFLAGS) \
$(GREETER_CFLAGS)
......
......@@ -733,6 +733,9 @@ gdm_set_welcomemsg (void)
static void
gdm_read_config (void)
{
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
gdmcomm_set_debug (gdm_config_get_bool (GDM_KEY_DEBUG));
/*
......@@ -792,12 +795,15 @@ gdm_read_config (void)
gdm_config_get_string (GDM_KEY_PID_FILE);
gdm_config_get_string (GDM_KEY_PRE_FETCH_PROGRAM);
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
}
static gboolean
greeter_reread_config (int sig, gpointer data)
{
/* Read config data in bulk */
gdmcomm_comm_bulk_start ();
if (gdm_config_reload_bool (GDM_KEY_DEBUG))
gdmcomm_set_debug (gdm_config_get_bool (GDM_KEY_DEBUG));
......@@ -848,7 +854,7 @@ greeter_reread_config (int sig, gpointer data)
gdm_common_setup_cursor (GDK_WATCH);
gdm_wm_save_wm_order ();
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
_exit (DISPLAY_RESTARTGREETER);
}
......@@ -869,12 +875,12 @@ greeter_reread_config (int sig, gpointer data)
gdm_common_setup_cursor (GDK_WATCH);
gdm_wm_save_wm_order ();
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
_exit (DISPLAY_RESTARTGREETER);
}
gdmcomm_comm_close ();
gdmcomm_comm_bulk_stop ();
return TRUE;
}
......
......@@ -69,6 +69,10 @@ check_for_displays (void)
char *auth_cookie = NULL;