diff options
author | George Lebl <jirka@5z.com> | 2003-07-25 23:32:53 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2003-07-25 23:32:53 +0000 |
commit | f9ccdb5f0535acbd89cb1392fb0629a507b37b03 (patch) | |
tree | 440c4b52f5a39cbb3eef0cf8006a0ca115537b3b | |
parent | ae0953b56420dc34bc4b366c0e50c75119500f7e (diff) | |
download | gdm-f9ccdb5f0535acbd89cb1392fb0629a507b37b03.tar.gz |
Fix updating the gdm_main_pid, which fixes gdm_fail that is done after
Fri Jul 25 16:31:24 2003 George Lebl <jirka@5z.com>
* daemon/gdm.c: Fix updating the gdm_main_pid, which fixes gdm_fail
that is done after daemonification.
* daemon/gdm.c, daemon/misc.c, daemon/verify-pam.c: Fix debian bug
194613 by adding an option --no-console which ignores the [servers]
section. An empty [servers] section implies --no-console. In this
mode the console will not be used (so no opening of text dialogs on
virtual terminals which just screws up XDMCP only headless servers)
* daemon/slave.c: always send XPID after server_stop unless of course
we're just about to exit
* docs/C/gdm.xml: add documentation of command line options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | daemon/gdm.c | 83 | ||||
-rw-r--r-- | daemon/misc.c | 8 | ||||
-rw-r--r-- | daemon/slave.c | 2 | ||||
-rw-r--r-- | daemon/verify-pam.c | 7 | ||||
-rw-r--r-- | docs/C/gdm.xml | 63 |
6 files changed, 146 insertions, 33 deletions
@@ -1,3 +1,19 @@ +Fri Jul 25 16:31:24 2003 George Lebl <jirka@5z.com> + + * daemon/gdm.c: Fix updating the gdm_main_pid, which fixes gdm_fail + that is done after daemonification. + + * daemon/gdm.c, daemon/misc.c, daemon/verify-pam.c: Fix debian bug + 194613 by adding an option --no-console which ignores the [servers] + section. An empty [servers] section implies --no-console. In this + mode the console will not be used (so no opening of text dialogs on + virtual terminals which just screws up XDMCP only headless servers) + + * daemon/slave.c: always send XPID after server_stop unless of course + we're just about to exit + + * docs/C/gdm.xml: add documentation of command line options + Fri Jul 25 13:06:49 2003 George Lebl <jirka@5z.com> * daemon/display.c, daemon/gdm.c: if child crashed (died of a signal) diff --git a/daemon/gdm.c b/daemon/gdm.c index 264d22a8..cd8127fb 100644 --- a/daemon/gdm.c +++ b/daemon/gdm.c @@ -80,9 +80,12 @@ gid_t GdmGroupId; /* Groupid under which gdm should run */ pid_t extra_process = 0; /* An extra process. Used for quickie processes, so that they also get whacked */ int extra_status = 0; /* Last status from the last extra process */ -pid_t gdm_main_pid = 0; +pid_t gdm_main_pid = 0; /* PID of the main daemon */ gboolean preserve_ld_vars = FALSE; /* Preserve the ld environment variables */ gboolean no_daemon = FALSE; /* Do not daemonize */ +gboolean no_console = FALSE; /* There are no local servers, this means, + don't run local servers and second, + don't display info on the console */ GdmConnection *fifoconn = NULL; /* Fifo connection */ GdmConnection *pipeconn = NULL; /* slavepipe (handled just like Fifo for compatibility) connection */ @@ -228,7 +231,8 @@ check_servauthdir (struct stat *statbuf) "correct gdm configuration %s and " "restart gdm."), GdmServAuthDir, GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: Authdir %s does not exist. Aborting."), "gdm_config_parse", GdmServAuthDir); } @@ -241,7 +245,8 @@ check_servauthdir (struct stat *statbuf) "correct gdm configuration %s and " "restart gdm."), GdmServAuthDir, GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: Authdir %s is not a directory. Aborting."), "gdm_config_parse", GdmServAuthDir); } @@ -442,18 +447,6 @@ gdm_config_parse (void) gdm_error (_("%s: No remote greeter specified."), "gdm_config_parse"); } - if (ve_string_empty (GdmServAuthDir)) { - gdm_text_message_dialog - (_("No daemon/ServAuthDir specified in the configuration file")); - GdmPidFile = NULL; - gdm_fail (_("%s: No authdir specified."), "gdm_config_parse"); - } - - if (ve_string_empty (GdmLogDir)) { - g_free (GdmLogDir); - GdmLogDir = g_strdup (GdmServAuthDir); - } - if (ve_string_empty (GdmSessDir)) gdm_error (_("%s: No sessions directory specified."), "gdm_config_parse"); @@ -508,7 +501,9 @@ gdm_config_parse (void) /* Find local X server definitions */ list = ve_config_get_keys (cfg, GDM_KEY_SERVERS); - for (li = list; li != NULL; li = li->next) { + /* only read the list if no_console is FALSE + at this stage */ + for (li = list; ! no_console && li != NULL; li = li->next) { const char *key = li->data; if (isdigit (*key)) { char *full; @@ -547,6 +542,13 @@ gdm_config_parse (void) if (displays == NULL && ! GdmXdmcp) { char *server = NULL; + + /* if we requested no local servers (there is no console), + then don't display errors in console messages */ + if (no_console) { + gdm_fail (_("%s: XDMCP disabled and no local servers defined. Aborting!"), "gdm_config_parse"); + } + if (access (GdmStandardXServer, X_OK) == 0) { server = GdmStandardXServer; } else if (access ("/usr/bin/X11/X", X_OK) == 0) { @@ -587,6 +589,11 @@ gdm_config_parse (void) } } + /* If no displays were found, then obviously + we're in a no console mode */ + if (displays == NULL) + no_console = TRUE; + /* Lookup user and groupid for the gdm user */ pwent = getpwnam (GdmUser); @@ -603,7 +610,8 @@ gdm_config_parse (void) "Please correct gdm configuration %s " "and restart gdm."), GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: Can't find the gdm user (%s). Aborting!"), "gdm_config_parse", GdmUser); } else { @@ -617,7 +625,8 @@ gdm_config_parse (void) "pose a security risk. Please " "correct gdm configuration %s and " "restart gdm."), GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: The gdm user should not be root. Aborting!"), "gdm_config_parse"); } @@ -637,7 +646,8 @@ gdm_config_parse (void) "Please correct gdm configuration %s " "and restart gdm."), GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: Can't find the gdm group (%s). Aborting!"), "gdm_config_parse", GdmGroup); } else { @@ -651,7 +661,8 @@ gdm_config_parse (void) "pose a security risk. Please " "correct gdm configuration %s and " "restart gdm."), GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: The gdm group should not be root. Aborting!"), "gdm_config_parse"); } @@ -691,6 +702,20 @@ gdm_config_parse (void) g_free (bin); + /* Check the serv auth and log dirs */ + if (ve_string_empty (GdmServAuthDir)) { + if ( ! no_console) + gdm_text_message_dialog + (_("No daemon/ServAuthDir specified in the configuration file")); + GdmPidFile = NULL; + gdm_fail (_("%s: No daemon/ServAuthDir specified."), "gdm_config_parse"); + } + + if (ve_string_empty (GdmLogDir)) { + g_free (GdmLogDir); + GdmLogDir = g_strdup (GdmServAuthDir); + } + /* Enter paranoia mode */ check_servauthdir (&statbuf); @@ -717,7 +742,8 @@ gdm_config_parse (void) "gdm."), GdmServAuthDir, GdmUser, GdmGroup, GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: Authdir %s is not owned by user %s, group %s. Aborting."), "gdm_config_parse", GdmServAuthDir, gdm_root_user (), GdmGroup); @@ -733,7 +759,8 @@ gdm_config_parse (void) "the gdm configuration %s and " "restart gdm."), GdmServAuthDir, (S_IRWXU|S_IRWXG|S_ISVTX), GDM_CONFIG_FILE); - gdm_text_message_dialog (s); + if ( ! no_console) + gdm_text_message_dialog (s); GdmPidFile = NULL; gdm_fail (_("%s: Authdir %s has wrong permissions %o. Should be %o. Aborting."), "gdm_config_parse", GdmServAuthDir, statbuf.st_mode, (S_IRWXU|S_IRWXG|S_ISVTX)); @@ -792,6 +819,7 @@ gdm_daemonify (void) exit (EXIT_SUCCESS); } + gdm_main_pid = getpid (); if (pid < 0) gdm_fail (_("%s: fork() failed!"), "gdm_daemonify"); @@ -1552,6 +1580,8 @@ create_connections (void) struct poptOption options [] = { { "nodaemon", '\0', POPT_ARG_NONE | POPT_ARGFLAG_ONEDASH, &no_daemon, 0, N_("Do not fork into the background"), NULL }, + { "no-console", '\0', POPT_ARG_NONE, + &no_console, 0, N_("No console (local) servers to be run"), NULL }, { "preserve-ld-vars", '\0', POPT_ARG_NONE, &preserve_ld_vars, 0, N_("Preserve LD_* variables"), NULL }, POPT_AUTOHELP @@ -1655,10 +1685,11 @@ main (int argc, char *argv[]) /* do nothing */ ; if (nextopt != -1) { - printf (_("Error on option %s: %s.\nRun '%s --help' to see a full list of available command line options.\n"), - poptBadOption (ctx, 0), - poptStrerror (nextopt), - argv[0]); + fprintf (stderr, + _("Error on option %s: %s.\nRun '%s --help' to see a full list of available command line options.\n"), + poptBadOption (ctx, 0), + poptStrerror (nextopt), + argv[0]); fflush (stdout); exit (1); } diff --git a/daemon/misc.c b/daemon/misc.c index 7ac804d8..7a809adc 100644 --- a/daemon/misc.c +++ b/daemon/misc.c @@ -63,6 +63,8 @@ extern pid_t gdm_main_pid; extern gboolean preserve_ld_vars; extern int gdm_in_signal; +extern gboolean no_console; + extern char *gdm_charset; static void @@ -408,6 +410,9 @@ gdm_text_message_dialog (const char *msg) char *dialog; /* do we have dialog?*/ char *msg_quoted; + if (no_console) + return FALSE; + if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0) return FALSE; @@ -468,6 +473,9 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret) { char *dialog; /* do we have dialog?*/ char *msg_quoted; + + if (no_console) + return FALSE; if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0) return FALSE; diff --git a/daemon/slave.c b/daemon/slave.c index 895683d2..470691a4 100644 --- a/daemon/slave.c +++ b/daemon/slave.c @@ -576,6 +576,7 @@ gdm_slave_start (GdmDisplay *display) /* remote and flexi only run once */ if (display->type != TYPE_LOCAL) { gdm_server_stop (display); + gdm_slave_send_num (GDM_SOP_XPID, 0); gdm_slave_quick_exit (DISPLAY_REMANAGE); } @@ -858,6 +859,7 @@ gdm_slave_check_user_wants_to_log_in (const char *user) if (d->type == TYPE_FLEXI) { gdm_slave_whack_greeter (); gdm_server_stop (d); + gdm_slave_send_num (GDM_SOP_XPID, 0); /* wait for a few seconds to avoid any vt changing race */ diff --git a/daemon/verify-pam.c b/daemon/verify-pam.c index 4e60550a..b9107e2a 100644 --- a/daemon/verify-pam.c +++ b/daemon/verify-pam.c @@ -47,6 +47,8 @@ extern gchar *GdmUser; extern gboolean GdmAllowRemoteAutoLogin; extern gint GdmRetryDelay; +extern gboolean no_console; + /* Evil, but this way these things are passed to the child session */ static pam_handle_t *pamh = NULL; @@ -1014,8 +1016,9 @@ gdm_verify_check (void) closelog (); openlog ("gdm", LOG_PID, LOG_DAEMON); - gdm_text_message_dialog - (_("Can't find PAM configuration for gdm.")); + if ( ! no_console) + gdm_text_message_dialog + (_("Can't find PAM configuration for gdm.")); gdm_fail ("gdm_verify_check: %s", _("Can't find PAM configuration for gdm.")); } diff --git a/docs/C/gdm.xml b/docs/C/gdm.xml index e6ac46b7..799a3303 100644 --- a/docs/C/gdm.xml +++ b/docs/C/gdm.xml @@ -2487,14 +2487,67 @@ The GDM package provides quite a few different commands. </para> - <sect2 id="mainbinaries"> - <title>Main GDM Commands</title> + <sect2 id="gdmcommandline"> + <title>GDM Command Line Options</title> <para> - First is the <filename>gdm</filename> command which is really just a script + First command is the <filename>gdm</filename> command which is really just a script which runs the <filename>gdm-binary</filename>. If you really need to set - some environment before launching GDM, you can do it in this file. - </para> + some environment before launching GDM, you can do it in this file. This command + accepts several command line parameters. + </para> + + <variablelist> + <title><filename>gdm</filename> Command Line Options</title> + + <varlistentry> + <term>--help</term> + <listitem> + <para> + Gives a brief overview of the command line options. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>-nodaemon</term> + <listitem> + <para> + If this option is specified, then gdm does not fork into the background when + run. You can use just a single dash with this option to preserve compatibility + with XDM. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>--no-console</term> + <listitem> + <para> + Tell the daemon that it should not run anything on the console. This means that + none of the local servers from the <filename>[servers]</filename> section will + be run, and the console will not be used for communicating errors to the user. + An empty <filename>[servers]</filename> section automatically implies this + option. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>--preserve-ld-vars</term> + <listitem> + <para> + When clearing the environment internally, preserve all variables starting with + LD_. This is mostly for debugging purposes. + </para> + </listitem> + </varlistentry> + </variablelist> + + </sect2> + + <sect2 id="mainbinaries"> + <title>Other Main GDM Commands</title> <para> Next are the two greeters, <filename>gdmlogin</filename> which is the |