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

Fix problem with client not properly counting the number of connections,

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

        * gui/gdmcommon.c: Fix problem with client not properly counting
          the number of connections, and make logic more robust so when
          it receives an "ERROR 200 Too many messages" it will close and
          reopen the connection and try again rather than just fail.
        * configure.ac, configure/Makefile.am: Add loginpreloadlist
        * utils/prefetch.c: Now handle comments that start with "#" in
          the preloadlist file.
        * daemon/gdm.h, daemon/gdmconfig.c, config/gdm.conf, gui/gdmlogin.c,
          gui/gdmcommon.[ch], gui/greeter/greeter.c: Now PostDisplayProgram is
          PreFetchProgram.  Fixed some comments in gdm.h.
        * daemon/gdm.c: Now KEY_PRE_FETCH_PROGRAM is only returned to the
          first slave that asks for the value, ensuring the prefetch only
          happens the first time a greeter is displayed.
        * docs/C/gdm.xml: Rewrote the Introduction section so it is more
          clear, made improvements to the Accessibility section, and fixed
          a number of formatting issues.  Now a separate Security section.
          Updated docs to reflect PreFetchProgram change.
        * gui/gdmflexiserver.c: Clean up the code a little.
parent c2189ff6
2006-01-03 Brian Cameron <brian.cameron@sun.com>
* gui/gdmcommon.c: Fix problem with client not properly counting
the number of connections, and make logic more robust so when
it receives an "ERROR 200 Too many messages" it will close and
reopen the connection and try again rather than just fail.
* configure.ac, configure/Makefile.am: Add loginpreloadlist
* utils/prefetch.c: Now handle comments that start with "#" in
the preloadlist file.
* daemon/gdm.h, daemon/gdmconfig.c, config/gdm.conf, gui/gdmlogin.c,
gui/gdmcommon.[ch], gui/greeter/greeter.c: Now PostDisplayProgram is
PreFetchProgram. Fixed some comments in gdm.h.
* daemon/gdm.c: Now KEY_PRE_FETCH_PROGRAM is only returned to the
first slave that asks for the value, ensuring the prefetch only
happens the first time a greeter is displayed.
* docs/C/gdm.xml: Rewrote the Introduction section so it is more
clear, made improvements to the Accessibility section, and fixed
a number of formatting issues. Now a separate Security section.
Updated docs to reflect PreFetchProgram change.
* gui/gdmflexiserver.c: Clean up the code a little.
2006-01-02 Brian Cameron <brian.cameron@sun.com>
* configure.ac: Update glib required to 2.8 since we now use g_access.
......
......@@ -14,3 +14,4 @@ Default.desktop
CDE.desktop
default.desktop
Init
gdmprefetchlist
......@@ -34,6 +34,7 @@ EXTRA_DIST = \
PostLogin \
XKeepsCrashing \
gettextfoo.h \
gdmprefetchlist.in \
extract-shell.sh
gettextfoo.h: XKeepsCrashing Xsession.in
......@@ -56,13 +57,14 @@ uninstall-hook:
$(DESTDIR)$(gdmconfdir)/factory-gdm.conf \
$(DESTDIR)$(confdir)/XKeepsCrashing \
$(DESTDIR)$(confdir)/Xsession \
$(DESTDIR)$(confdir)/gdmprefetchlist \
$(DESTDIR)$(localedir)/locale.alias \
$(DESTDIR)$(initdir)/Default \
$(DESTDIR)$(postlogindir)/Default.sample \
$(DESTDIR)$(predir)/Default \
$(DESTDIR)$(postdir)/Default
install-data-hook: gdm.conf gdm.conf-custom Xsession gnome.desktop default.desktop CDE.desktop Init PostSession PreSession
install-data-hook: gdm.conf gdm.conf-custom Xsession gnome.desktop default.desktop CDE.desktop Init PostSession PreSession $(GDMPREFETCHLIST)
if test '!' -d $(DESTDIR)$(confdir); then \
$(mkinstalldirs) $(DESTDIR)$(confdir); \
chmod 755 $(DESTDIR)$(confdir); \
......@@ -143,7 +145,7 @@ install-data-hook: gdm.conf gdm.conf-custom Xsession gnome.desktop default.deskt
chmod 755 $(DESTDIR)$(initdir); \
fi
-if test -f $(DESTDIR)$(initdir)/Default; then \
cp -f $(DESTDIR)$(initdir)/Init $(DESTDIR)$(initdir)/Default.orig; \
cp -f $(DESTDIR)$(initdir)/Default $(DESTDIR)$(initdir)/Default.orig; \
fi
$(INSTALL_SCRIPT) Init $(DESTDIR)$(initdir)/Default
......@@ -204,3 +206,6 @@ install-data-hook: gdm.conf gdm.conf-custom Xsession gnome.desktop default.deskt
echo "Please add PAM authentication for gdm and gdm-autologin in $(PAM_PREFIX)/pam.conf!"; \
fi; \
fi
if test "x$(GDMPREFETCHLIST)" != "x"; then \
$(INSTALL_SCRIPT) loginpreloadlist $(DESTDIR)$(confdir)/gdmprefetchlist; \
fi
......@@ -439,9 +439,10 @@ GraphicalThemedColor=#76848F
#SoundOnLoginFailure=false
#SoundOnLoginFailureFile=
# Specifies a program to be called by the greeter/login program when the
# initial screen is displayed. The initial purpose is to provide a hook
# where libraries can be preloaded to speed performance for the user.
#PostDisplayProgram=
# initial screen is displayed. The purpose is to provide a hook
# where files used after login can be preloaded to speed performance for
# the user. The program will only be called once.
PreFetchProgram=@GDMPREFETCHCMD@
# The chooser is what's displayed when a user wants an indirect XDMCP session,
# or selects Run XDMCP chooser from the system menu
......
# This list of libraries has been optimized for a GNOME session running
# on Solaris. People who want to contribute alternative lists of
# libraries that can be installed with GDM can contribute them to
# http://bugzilla.gnome.org/ and GDM can be enhanced to install
# different preload files based on configure options.
#
/usr/share/icons/hicolor/icon-theme.cache
/usr/share/icons/blueprint/icon-theme.cache
/usr/share/icons/gnome/icon-theme.cache
/usr/bin/nautilus
/usr/bin/gnome-panel
/usr/lib/libnautilus-private.so
/usr/lib/libbonoboui-2.so
/usr/lib/libwnck-1.so
/usr/lib/libgnomevfs-2.so
/usr/bin/metacity
/usr/lib/libeel-2.so
/usr/lib/libbonobo-2.so
/usr/openwin/lib/libXt.so
/usr/lib/libgnomeui-2.so
/usr/lib/clock-applet
/usr/lib/libORBit-2.so
/usr/X11/lib/libGL.so
/usr/openwin/lib/X11/fonts/TrueType/VeraMoIt.ttf
/usr/lib/libgnome-desktop-2.so
/usr/lib/wnck-applet
/usr/lib/libgstreamer-0.8.so
/usr/dt/lib/libXm.so
/usr/lib/libpoppler.so
/usr/lib/libgconf-2.so
/usr/sfw/lib/libcrypto.so
/usr/lib/nautilus/extensions-1.0/libevince-properties-page.so
/usr/lib/gnome-vfs-2.0/modules/libmapping.so
/usr/lib/libpoppler-glib.so
/usr/lib/libpanel-applet-2.so
/usr/lib/libstartup-notification-1.so
/usr/lib/libatk-1.0.so
......@@ -864,8 +864,12 @@ AC_ARG_WITH(prefetch,
if test x$with_prefetch != xno ; then
GDMPREFETCH="gdmprefetch"
GDMPREFETCHLIST="gdmprefetchlist"
GDMPREFETCHCMD="$EXPANDED_LIBDIR/gdmprefetch $EXPANDED_SYSCONFDIR/gdm/gdmprefetchlist"
fi
AC_SUBST(GDMPREFETCH)
AC_SUBST(GDMPREFETCHLIST)
AC_SUBST(GDMPREFETCHCMD)
AC_ARG_WITH(xevie,
[ --with-xevie=[yes/no] Add XEvIE Xserver extension support [default=no]],,
......@@ -880,7 +884,7 @@ fi
AC_SUBST(XEVIE_OPTION)
AC_DEFINE_UNQUOTED(XEVIE_OPTION,"$XEVIE_OPTION")
AC_MSG_CHECKING(for fbconsole (for Solaris))
AC_MSG_CHECKING(for Solaris fbconsole)
if test -x /usr/openwin/bin/fbconsole; then
AC_DEFINE(HAVE_FBCONSOLE)
AC_MSG_RESULT(yes)
......@@ -1103,6 +1107,7 @@ config/Xsession
config/Init
config/PreSession
config/PostSession
config/gdmprefetchlist
daemon/gdm
gdm-stop
gdm-restart
......
......@@ -3092,6 +3092,19 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
strlen (GDM_SUP_GET_CONFIG " ")) == 0) {
const char *key = &msg[strlen (GDM_SUP_GET_CONFIG " ")];
gchar *retval;
static gboolean done_prefetch = FALSE;
/*
* If key is for prefetch do it only once
*/
if (strcmp(key, GDM_KEY_PRE_FETCH_PROGRAM) == 0) {
if (done_prefetch) {
gdm_connection_printf (conn, "OK \n");
return;
} else {
done_prefetch = TRUE;
}
}
gdm_config_to_string ((gchar *)key, &retval);
if (retval != NULL) {
......
......@@ -357,7 +357,7 @@ enum {
#define GDM_KEY_INFO_MSG_FILE "greeter/InfoMsgFile="
#define GDM_KEY_INFO_MSG_FONT "greeter/InfoMsgFont="
#define GDM_KEY_POST_DISPLAY_PROGRAM "greeter/PostDisplayProgram="
#define GDM_KEY_PRE_FETCH_PROGRAM "greeter/PreFetchProgram="
#define GDM_KEY_SOUND_ON_LOGIN "greeter/SoundOnLogin=true"
#define GDM_KEY_SOUND_ON_LOGIN_SUCCESS "greeter/SoundOnLoginSuccess=false"
......@@ -747,8 +747,8 @@ void gdm_final_cleanup (void);
* 999 = Unknown error
*/
#define GDM_SUP_AUTH_LOCAL "AUTH_LOCAL" /* <xauth cookie> */
/* AUTH_LOCAL: Setup this connection as authenticated for FLEXI_SERVER
* Because all full blown (non-Xnest) servers can be started
/* AUTH_LOCAL: Setup this connection as authenticated for FLEXI_SERVER.
* Because all full blown (non-Xnest) displays can be started
* only from users logged in locally, and here gdm assumes
* only users logged in from gdm. They must pass the xauth
* MIT-MAGIC-COOKIE-1 that they were passed before the
......@@ -772,11 +772,11 @@ void gdm_final_cleanup (void);
* 999 = Unknown error
*/
#define GDM_SUP_FLEXI_XSERVER "FLEXI_XSERVER" /* <xserver type> */
/* FLEXI_XSERVER: Start a new X flexible server. Only supported on
/* FLEXI_XSERVER: Start a new X flexible display. Only supported on
* connection that passed AUTH_LOCAL
* Supported since: 2.2.4.0
* Arguments: <xserver type>
* If no arguments, starts the standard x server
* If no arguments, starts the standard X server
* Answers:
* OK <display>
* ERROR <err number> <english error description>
......@@ -791,7 +791,7 @@ void gdm_final_cleanup (void);
* 999 = Unknown error
*/
#define GDM_SUP_FLEXI_XNEST "FLEXI_XNEST" /* <display> <uid> <xauth cookie> <xauth file> */
/* FLEXI_XNEXT: Start a new flexible Xnest server.
/* FLEXI_XNEXT: Start a new flexible Xnest display.
* Note: Supported on older versions from 2.2.4.0, later
* 2.2.4.2, but since 2.3.90.4 you must supply 4
* arguments or ERROR 100 will be returned. This
......@@ -875,8 +875,8 @@ void gdm_final_cleanup (void);
*/
#define GDM_SUP_ATTACHED_SERVERS "ATTACHED_SERVERS" /* None */
#define GDM_SUP_CONSOLE_SERVERS "CONSOLE_SERVERS" /* None */
/* ATTACHED_SERVERS: List all attached servers. Doesn't list XDMCP
* and xnest non-attached servers
/* ATTACHED_SERVERS: List all attached displays. Doesn't list XDMCP
* and xnest non-attached displays.
* Note: This command used to be named CONSOLE_SERVERS,
* which is still recognized for backwards
* compatibility. The optional pattern argument
......@@ -905,7 +905,7 @@ void gdm_final_cleanup (void);
#define GDM_SUP_ALL_SERVERS "ALL_SERVERS" /* None */
/* ALL_SERVERS: List all displays, including attached, remote, xnest.
* This can for example be useful to figure out if
* the server you are on is managed by the gdm daemon,
* the display you are on is managed by the gdm daemon,
* by seeing if it is in the list. It is also somewhat
* like the 'w' command but for graphical sessions.
* Supported since: 2.4.2.96
......@@ -1097,7 +1097,7 @@ void gdm_final_cleanup (void);
* 999 = Unknown error
*/
#define GDM_SUP_SET_LOGOUT_ACTION "SET_LOGOUT_ACTION" /* <action> */
/* SET_LOGOUT_ACTION: Tell the daemon to halt/reboot/suspend after
/* SET_LOGOUT_ACTION: Tell the daemon to halt/restart/suspend after
* slave process exits. Only supported on
* connections that passed AUTH_LOCAL.
* Supported since: 2.5.90.0
......@@ -1116,7 +1116,7 @@ void gdm_final_cleanup (void);
* 999 = Unknown error
*/
#define GDM_SUP_SET_SAFE_LOGOUT_ACTION "SET_SAFE_LOGOUT_ACTION" /* <action> */
/* SET_SAFE_LOGOUT_ACTION: Tell the daemon to halt/reboot/suspend
/* SET_SAFE_LOGOUT_ACTION: Tell the daemon to halt/restart/suspend
* after everybody logs out. If only one
* person logs out, then this is obviously
* the same as the SET_LOGOUT_ACTION. Note
......
......@@ -216,7 +216,7 @@ static gchar *GdmHosts;
static gchar *GdmGraphicalThemeColor;
static gchar *GdmGraphicalThemeDir;
static gchar *GdmGraphicalThemes;
static gchar *GdmPostDisplayProgram;
static gchar *GdmPreFetchProgram;
static gint GdmPositionX;
static gint GdmPositionY;
......@@ -495,8 +495,8 @@ gdm_config_init (void)
gdm_config_add_hash (GDM_KEY_DEFAULT_HOST_IMG, &GdmHost, &string_type);
gdm_config_add_hash (GDM_KEY_HOST_IMAGE_DIR, &GdmHostImageDir, &string_type);
gdm_config_add_hash (GDM_KEY_HOSTS, &GdmHosts, &string_type);
gdm_config_add_hash (GDM_KEY_POST_DISPLAY_PROGRAM,
&GdmPostDisplayProgram, &string_type);
gdm_config_add_hash (GDM_KEY_PRE_FETCH_PROGRAM,
&GdmPreFetchProgram, &string_type);
/* int values */
gdm_config_add_hash (GDM_KEY_XINERAMA_SCREEN, &GdmXineramaScreen, &int_type);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -42,6 +42,7 @@
#include "gdmconfig.h"
static gboolean debug = FALSE;
static int num_cmds = 0;
static char *
do_command (int fd, const char *command, gboolean get_response)
......@@ -68,6 +69,10 @@ do_command (int fd, const char *command, gboolean get_response)
#endif
g_free (cstr);
num_cmds++;
if (debug)
g_print ("Incrementing num_cmds to %d\n", num_cmds);
if (ret < 0)
return NULL;
......@@ -85,6 +90,12 @@ do_command (int fd, const char *command, gboolean get_response)
cstr = str->str;
g_string_free (str, FALSE);
if (strcmp (ve_sure_string (cstr), "ERROR 200 Too many messages") == 0) {
g_free (cstr);
return NULL;
}
return cstr;
}
......@@ -112,18 +123,15 @@ char *
gdmcomm_call_gdm (const char *command, const char * auth_cookie, const char *min_version, int tries)
{
static int fd = 0;
static int num_cmds = 0;
char *ret;
if (num_cmds == (GDM_SUP_MAX_CONNECTIONS - 1)) {
if (num_cmds == (GDM_SUP_MAX_CONNECTIONS)) {
do_command (fd, GDM_SUP_CLOSE, FALSE);
VE_IGNORE_EINTR (close (fd));
fd = 0;
num_cmds = 0;
}
num_cmds++;
if (tries <= 0)
return NULL;
......@@ -178,7 +186,7 @@ gdmcomm_call_gdm (const char *command, const char * auth_cookie, const char *min
min_version, tries - 1);
}
/* not auth'ed */
if (strcmp (ret, "OK") != 0) {
if (strcmp (ve_sure_string (ret), "OK") != 0) {
VE_IGNORE_EINTR (close (fd));
fd = 0;
/* returns the error */
......@@ -367,7 +375,7 @@ gdmcomm_get_auth_cookie (void)
ret = gdmcomm_call_gdm (cmd, NULL /* auth cookie */, "2.2.4.0", 5);
g_free (cmd);
if (ret != NULL &&
strcmp (ret, "OK") == 0) {
strcmp (ve_sure_string (ret), "OK") == 0) {
g_free (ret);
cookie = g_strdup (buffer);
break;
......
......@@ -380,34 +380,34 @@ gdm_common_get_welcomemsg (void)
}
static gchar *
post_display_prog_get_path (void)
pre_fetch_prog_get_path (void)
{
gchar *postdisplayprog;
gchar *prefetchprog;
postdisplayprog = gdm_config_get_string (GDM_KEY_POST_DISPLAY_PROGRAM);
if (! ve_string_empty (postdisplayprog)) {
return postdisplayprog;
prefetchprog = gdm_config_get_string (GDM_KEY_PRE_FETCH_PROGRAM);
if (! ve_string_empty (prefetchprog)) {
return prefetchprog;
} else
return NULL;
}
static gboolean
post_display_run (gpointer data)
pre_fetch_run (gpointer data)
{
GPid pid = -1;
GError *error = NULL;
char *command = NULL;
gchar **post_display_prog_argv = NULL;
gchar **pre_fetch_prog_argv = NULL;
command = post_display_prog_get_path ();
command = pre_fetch_prog_get_path ();
if (! command)
return FALSE;
post_display_prog_argv = ve_split (command);
pre_fetch_prog_argv = ve_split (command);
g_spawn_async (".",
post_display_prog_argv,
pre_fetch_prog_argv,
NULL,
(GSpawnFlags) (G_SPAWN_SEARCH_PATH),
NULL,
......@@ -419,12 +419,12 @@ post_display_run (gpointer data)
}
void
gdm_common_post_display_launch (void)
gdm_common_pre_fetch_launch (void)
{
if (! post_display_prog_get_path ())
if (! pre_fetch_prog_get_path ())
return;
g_idle_add (post_display_run, NULL);
g_idle_add (pre_fetch_run, NULL);
}
/*
......
......@@ -57,7 +57,7 @@ gchar* gdm_common_get_config_file (void);
gboolean gdm_common_select_time_format (void);
void gdm_common_setup_background_color (gchar *bg_color);
gchar* gdm_common_get_welcomemsg (void);
void gdm_common_post_display_launch (void);
void gdm_common_pre_fetch_launch (void);
gchar* gdm_common_expand_text (const gchar *text);
gchar* gdm_common_get_clock (struct tm **the_tm);
......
......@@ -44,18 +44,18 @@
#include "gdmconfig.h"
#include "gdmconfig.h"
static GSList *xservers = NULL;
static gboolean got_standard = FALSE;
static gboolean use_xnest = FALSE;
static gboolean authenticate = FALSE;
static gboolean no_lock = FALSE;
static gboolean monte_carlo_pi = FALSE;
static const char *send_command = NULL;
static const char *server = NULL;
static GSList *xservers = NULL;
static const char *send_command = NULL;
static const char *server = NULL;
static const char *chosen_server = NULL;
static gboolean debug = FALSE;
static gboolean startnew = FALSE;
static char *auth_cookie = NULL;
static char *auth_cookie = NULL;
static gboolean got_standard = FALSE;
static gboolean use_xnest = FALSE;
static gboolean debug_in = FALSE;
static gboolean authenticate = FALSE;
static gboolean no_lock = FALSE;
static gboolean monte_carlo_pi = FALSE;
static gboolean startnew = FALSE;
static int
get_cur_vt (void)
......@@ -688,7 +688,7 @@ struct poptOption options [] = {
{ "command", 'c', POPT_ARG_STRING, &send_command, 0, N_("Send the specified protocol command to GDM"), N_("COMMAND") },
{ "xnest", 'n', POPT_ARG_NONE, &use_xnest, 0, N_("Xnest mode"), NULL },
{ "no-lock", 'l', POPT_ARG_NONE, &no_lock, 0, N_("Do not lock current screen"), NULL },
{ "debug", 'd', POPT_ARG_NONE, &debug, 0, N_("Debugging output"), NULL },
{ "debug", 'd', POPT_ARG_NONE, &debug_in, 0, N_("Debugging output"), NULL },
{ "authenticate", 'a', POPT_ARG_NONE, &authenticate, 0, N_("Authenticate before running --command"), NULL },
{ "startnew", 's', POPT_ARG_NONE, &startnew, 0, N_("Start new flexible session; do not show popup"), NULL },
{ "monte-carlo-pi", 0, POPT_ARG_NONE, &monte_carlo_pi, 0, NULL, NULL },
......@@ -722,7 +722,7 @@ main (int argc, char *argv[])
return 0;
}
gdmcomm_set_debug (debug);
gdmcomm_set_debug (debug_in);
args = poptGetArgs (ctx);
if (args != NULL && args[0] != NULL)
......
......@@ -3572,7 +3572,7 @@ main (int argc, char *argv[])
/* Only setup the cursor now since it will be a WATCH from before */
gdm_common_setup_cursor (GDK_LEFT_PTR);
gdm_common_post_display_launch ();
gdm_common_pre_fetch_launch ();
gtk_main ();
gdm_kill_thingies ();
......
......@@ -1330,7 +1330,7 @@ main (int argc, char *argv[])
gdm_config_get_string (GDM_KEY_INFO_MSG_FONT));
gdm_common_setup_cursor (GDK_LEFT_PTR);
gdm_common_post_display_launch ();
gdm_common_pre_fetch_launch ();
gtk_main ();
return 0;
......
......@@ -17,10 +17,6 @@ libexec_PROGRAMS = \
@GDMPREFETCH@ \
gdmtranslate
# This is not useful anymore
# bin_PROGRAMS = \
# gdmmktemp
if DMX_SUPPORT
bin_PROGRAMS = gdm-dmx-reconnect-proxy
endif
......@@ -39,9 +35,6 @@ gdmopen_SOURCES = \
gdmprefetch_SOURCES = \
gdmprefetch.c
#gdmmktemp_SOURCES = \
# gdmmktemp.c
gdmaskpass_LDADD = \
$(INTLLIBS) \
-lpam \
......@@ -53,9 +46,6 @@ gdmopen_LDADD = \
gdmtranslate_LDADD = \
$(INTLLIBS)
#gdmmktemp_LDADD = \
# $(INTLLIBS)
if DMX_SUPPORT
gdm_dmx_reconnect_proxy_SOURCES = \
gdm-dmx-reconnect-proxy.c
......
......@@ -113,6 +113,10 @@ main (int argc, char *argv[])
while (fgets (path, sizeof (path), fp) != 0) {
path[strlen(path) -1] = '\0';
if (path[0] == '#') {
continue;
}
if (!out) {
doin (path);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment