diff options
author | 0 <mkp@mkp.net> | 1999-09-29 22:56:35 +0000 |
---|---|---|
committer | Martin Peterson <mkp@src.gnome.org> | 1999-09-29 22:56:35 +0000 |
commit | f4ac1bc7127d54d64422d0e53ac4a832bc11b342 (patch) | |
tree | 85eb9b58c2818188d92ed5743574806bfbba6518 | |
parent | 7dbe93b97081f36e001bf7e2a319bafc7abd87e4 (diff) | |
download | gdm-f4ac1bc7127d54d64422d0e53ac4a832bc11b342.tar.gz |
Example sessreg scripts.
1999-09-30 <mkp@mkp.net>
* config/PreSession, config/PostSession: Example sessreg scripts.
* daemon/slave.c (gdm_slave_session_cleanup): Run PostSession
script even when display is dead.
* daemon/xdmcp.c (gdm_xdmcp_handle_query): Get XDMCP running again.
1999-09-29 <mkp@mkp.net>
* gui/gdmlogin.c, gui/gdmchooser.c: bindtextdomain() + other
fixes.
* daemon/slave.c (gdm_slave_session_start): Pipe fix from Elliot.
1999-09-27 <mkp@mkp.net>
* docs/C/gdm.sgml: Lots of updates.
* daemon/slave.c (gdm_slave_session_start): Let the daemon handle
session/language lookups.
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | config/Makefile.am | 20 | ||||
-rwxr-xr-x | config/PostSession | 3 | ||||
-rwxr-xr-x | config/PreSession | 3 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | daemon/slave.c | 163 | ||||
-rw-r--r-- | daemon/xdmcp.c | 5 | ||||
-rw-r--r-- | docs/C/Makefile.am | 1 | ||||
-rw-r--r-- | docs/C/gdm.sgml | 204 | ||||
-rw-r--r-- | gui/Makefile.am | 8 | ||||
-rw-r--r-- | gui/gdmchooser.c | 3 | ||||
-rw-r--r-- | gui/gdmconfig.c | 3 | ||||
-rw-r--r-- | gui/gdmlogin.c | 167 |
14 files changed, 417 insertions, 192 deletions
@@ -1,8 +1,31 @@ +1999-09-30 <mkp@mkp.net> + + * config/PreSession, config/PostSession: Example sessreg scripts. + + * daemon/slave.c (gdm_slave_session_cleanup): Run PostSession + script even when display is dead. + + * daemon/xdmcp.c (gdm_xdmcp_handle_query): Get XDMCP running again. + +1999-09-29 <mkp@mkp.net> + + * gui/gdmlogin.c, gui/gdmchooser.c: bindtextdomain() + other + fixes. + + * daemon/slave.c (gdm_slave_session_start): Pipe fix from Elliot. + 1999-09-28 Rodrigo Stulzer Lopes <rodrigo@conectiva.com.br> * configure.in (ALL_LINGUAS): Added pt_BR. -1999-09-26 +09 Changwoo Ryu <cwryu@adam.kaist.ac.kr> +1999-09-27 <mkp@mkp.net> + + * docs/C/gdm.sgml: Lots of updates. + + * daemon/slave.c (gdm_slave_session_start): Let the daemon handle + session/language lookups. + +1999-09-26 Changwoo Ryu <cwryu@adam.kaist.ac.kr> * configure.in (ALL_LINGUAS): Added Korean. * config/locale.alias: Likewise. @@ -6,7 +6,7 @@ The Gnome Display Manager is a re-implementation of the well known xdm program. -gdm 2.0beta3 implements all significant features required for managing +gdm 2.0beta4 implements all significant features required for managing local and remote displays. gdm daemon: diff --git a/config/Makefile.am b/config/Makefile.am index 4844c487..cd30385a 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -5,6 +5,8 @@ sessdir = $(sysconfdir)/gdm/Sessions initdir = $(sysconfdir)/gdm/Init authdir = $(localstatedir)/gdm gnomercdir = $(sysconfdir) +postdir = $(sysconfdir)/gdm/PostSession +predir = $(sysconfdir)/gdm/PreSession gdm.conf: gdm.conf.in Makefile @@ -36,7 +38,9 @@ EXTRA_DIST = \ Xsession \ gdm \ locale.alias \ - Default + Default \ + PostSession \ + PreSession install-data-hook: gdm.conf gnomerc Gnome if test '!' -d $(confdir); then \ @@ -66,6 +70,20 @@ install-data-hook: gdm.conf gnomerc Gnome if test '!' -f $(initdir)/Default; then \ $(INSTALL_SCRIPT) $(srcdir)/Default $(initdir)/Default; \ fi + if test '!' -d $(predir); then \ + $(mkinstalldirs) $(predir); \ + chmod 755 $(predir); \ + fi + if test '!' -f $(predir)/Default; then \ + $(INSTALL_SCRIPT) $(srcdir)/PreSession $(predir)/Default; \ + fi + if test '!' -d $(postdir); then \ + $(mkinstalldirs) $(postdir); \ + chmod 755 $(postdir); \ + fi + if test '!' -f $(postdir)/Default; then \ + $(INSTALL_SCRIPT) $(srcdir)/PostSession $(postdir)/Default; \ + fi if test '!' -d $(authdir); then \ $(mkinstalldirs) $(authdir); \ chown gdm.gdm $(authdir); \ diff --git a/config/PostSession b/config/PostSession new file mode 100755 index 00000000..037ad72c --- /dev/null +++ b/config/PostSession @@ -0,0 +1,3 @@ +#!/bin/sh +/usr/bin/X11/sessreg -d -w /var/log/wtmp -u /var/run/utmp -l $DISPLAY $USER + diff --git a/config/PreSession b/config/PreSession new file mode 100755 index 00000000..4015aaed --- /dev/null +++ b/config/PreSession @@ -0,0 +1,3 @@ +#!/bin/sh +/usr/bin/X11/sessreg -a -w /var/log/wtmp -u /var/run/utmp -l $DISPLAY $USER + diff --git a/configure.in b/configure.in index e0774758..ff416173 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ AC_INIT(daemon/gdm.h) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(gdm,2.0beta3) +AM_INIT_AUTOMAKE(gdm,2.0beta4) AM_MAINTAINER_MODE AM_ACLOCAL_INCLUDE(macros) diff --git a/daemon/slave.c b/daemon/slave.c index 75256bee..386d952a 100644 --- a/daemon/slave.c +++ b/daemon/slave.c @@ -74,7 +74,7 @@ void gdm_slave_start (GdmDisplay *d); static gint gdm_slave_xerror_handler (Display *disp, XErrorEvent *evt); static gint gdm_slave_xioerror_handler (Display *disp); static void gdm_slave_greeter (void); -static void gdm_slave_session_start (gchar *login, gchar *session, gboolean savesess, gchar *lang, gboolean savelang); +static void gdm_slave_session_start (gchar *login); static void gdm_slave_session_stop (void); static void gdm_slave_session_cleanup (void); static void gdm_slave_term_handler (int sig); @@ -165,8 +165,7 @@ static void gdm_slave_greeter (void) { gint pipe1[2], pipe2[2]; - gchar *login = NULL, *session, *language; - gboolean savesess = FALSE, savelang = FALSE; + gchar *login = NULL; gchar **argv; gdm_debug ("gdm_slave_greeter: Running greeter on %s", d->name); @@ -222,14 +221,17 @@ gdm_slave_greeter (void) default: close (pipe1[0]); close (pipe2[1]); - + + fcntl(pipe1[1], F_SETFD, fcntl(pipe1[1], F_GETFD, 0) | FD_CLOEXEC); + fcntl(pipe2[0], F_SETFD, fcntl(pipe2[2], F_GETFD, 0) | FD_CLOEXEC); + if (pipe1[1] != STDOUT_FILENO) dup2 (pipe1[1], STDOUT_FILENO); if (pipe2[0] != STDIN_FILENO) dup2 (pipe2[0], STDIN_FILENO); - greeter=fdopen (STDIN_FILENO, "r"); + greeter = fdopen (STDIN_FILENO, "r"); gdm_debug ("gdm_slave_greeter: Greeter on pid %d", d->greetpid); break; @@ -244,9 +246,62 @@ gdm_slave_greeter (void) sleep (GdmRetryDelay); } } + + gdm_slave_session_start (login); +} + + +static void +gdm_slave_session_start (gchar *login) +{ + gchar *cfgdir, *sesspath; + struct stat statbuf; + gchar *session, *language, *usrsess, *usrlang; + gboolean savesess = FALSE, savelang = FALSE, usrcfgok = FALSE, authok = FALSE; + gint i; + + pwent = getpwnam (login); + + if (!pwent) + gdm_remanage (_("gdm_slave_session_start: User passed authentication but getpwnam(%s) failed. Spooky!"), login); + + setegid (pwent->pw_gid); + seteuid (pwent->pw_uid); + + /* Check if ~user/.gnome exists. Create it otherwise. */ + cfgdir = g_strconcat (pwent->pw_dir, "/.gnome", NULL); + + if (stat (cfgdir, &statbuf) == -1) { + mkdir (cfgdir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); + chmod (cfgdir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); + } + + /* Sanity check on ~user/.gnome/gdm */ + usrcfgok = gdm_file_check ("gdm_slave_greeter", pwent->pw_uid, cfgdir, "gdm", + TRUE, GdmUserMaxFile, GdmRelaxPerms); + g_free (cfgdir); + + if (usrcfgok) { + gchar *cfgstr; + + cfgstr = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/last", NULL); + usrsess = gnome_config_get_string (cfgstr); + g_free (cfgstr); + + cfgstr = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/lang", NULL); + usrlang = gnome_config_get_string (cfgstr); + g_free (cfgstr); + } + else { + usrsess = ""; + usrlang = ""; + } + + setegid (GdmGroupId); + seteuid (0); - session = gdm_slave_greeter_ctl (GDM_SESS, ""); - language = gdm_slave_greeter_ctl (GDM_LANG, ""); + session = gdm_slave_greeter_ctl (GDM_SESS, usrsess); + language = gdm_slave_greeter_ctl (GDM_LANG, usrlang); if (strlen (gdm_slave_greeter_ctl (GDM_SSESS, ""))) savesess = TRUE; @@ -254,7 +309,7 @@ gdm_slave_greeter (void) if (strlen (gdm_slave_greeter_ctl (GDM_SLANG, ""))) savelang = TRUE; - gdm_debug ("gdm_slave_greeter: Authentication completed. Whacking greeter"); + gdm_debug ("gdm_slave_session_start: Authentication completed. Whacking greeter"); sigemptyset (&mask); sigaddset (&mask, SIGCHLD); @@ -271,32 +326,8 @@ gdm_slave_greeter (void) if (GdmKillInitClients) gdm_slave_windows_kill(); - - gdm_slave_session_start (login, session, savesess, language, savelang); -} - - -static void -gdm_slave_session_start (gchar *login, gchar *session, gboolean savesess, gchar *lang, gboolean savelang) -{ - gchar *sessdir, *cfgdir, *cfgstr; - struct stat statbuf; - gboolean authok; - gboolean usercfgok; - - if (!login || !session || !lang) { - gdm_debug ("gdm_slave_session_start: Insufficient parameters"); - return; - } - - gdm_error ("gdm_slave_session_start: %s on %s", login, d->name); - - pwent = getpwnam (login); - - /* If the user doesn't exist, reset the X server and restart greeter */ - if (!pwent) - gdm_remanage (_("gdm_slave_session_init: User '%s' not found. Aborting."), login); - + + /* Prepare user session */ setenv ("DISPLAY", d->name, TRUE); setenv ("LOGNAME", login, TRUE); setenv ("USER", login, TRUE); @@ -313,14 +344,14 @@ gdm_slave_session_start (gchar *login, gchar *session, gboolean savesess, gchar setenv ("PATH", GdmDefaultPath, TRUE); /* Set locale */ - if (!strcasecmp (lang, "english")) + if (!strcasecmp (language, "english")) setenv ("LANG", "C", TRUE); else - setenv ("LANG", lang, TRUE); + setenv ("LANG", language, TRUE); /* If script fails reset X server and restart greeter */ if (gdm_exec_script (d, GdmPreSession) != EXIT_SUCCESS) - gdm_remanage (_("gdm_slave_session_init: Execution of PreSession script returned > 0. Aborting.")); + gdm_remanage (_("gdm_slave_session_start: Execution of PreSession script returned > 0. Aborting.")); /* Setup cookie -- We need this information during cleanup, thus * cookie handling is done before fork()ing */ @@ -344,7 +375,7 @@ gdm_slave_session_start (gchar *login, gchar *session, gboolean savesess, gchar switch (d->sesspid = fork()) { case -1: - gdm_abort (_("gdm_slave_session_init: Error forking user session")); + gdm_abort (_("gdm_slave_session_start: Error forking user session")); case 0: setpgid (0, 0); @@ -352,55 +383,49 @@ gdm_slave_session_start (gchar *login, gchar *session, gboolean savesess, gchar umask (022); if (setgid (pwent->pw_gid) < 0) - gdm_remanage (_("gdm_slave_session_init: Could not setgid %d. Aborting."), pwent->pw_gid); + gdm_remanage (_("gdm_slave_session_start: Could not setgid %d. Aborting."), pwent->pw_gid); if (initgroups (login, pwent->pw_gid) < 0) - gdm_remanage (_("gdm_slave_session_init: initgroups() failed for %s. Aborting."), login); + gdm_remanage (_("gdm_slave_session_start: initgroups() failed for %s. Aborting."), login); if (setuid (pwent->pw_uid) < 0) - gdm_remanage (_("gdm_slave_session_init: Could not become %s. Aborting."), login); + gdm_remanage (_("gdm_slave_session_start: Could not become %s. Aborting."), login); chdir (pwent->pw_dir); - /* Check if ~user/.gnome exists. Create it otherwise. */ - cfgdir = g_strconcat (pwent->pw_dir, "/.gnome", NULL); - - if (stat (cfgdir, &statbuf) == -1) { /* FIXME: Maybe I need to be a bit more paranoid here! */ - mkdir (cfgdir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); - chmod (cfgdir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); - } - - /* Sanity check on ~user/.gnome/gdm */ - usercfgok = gdm_file_check ("gdm_slave_session_init", pwent->pw_uid, cfgdir, "gdm", - TRUE, GdmUserMaxFile, GdmRelaxPerms); - - g_free (cfgdir); - - if (usercfgok && savesess) { - /* libgnome sets home to ~root, so we have to write the path ourselves */ - cfgstr = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/last", NULL); + if (usrcfgok && savesess) { + gchar *cfgstr = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/last", NULL); gnome_config_set_string (cfgstr, session); gnome_config_sync(); g_free (cfgstr); } - if (usercfgok && savelang) { - cfgstr = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/lang", NULL); - gnome_config_set_string (cfgstr, lang); + if (usrcfgok && savelang) { + gchar *cfgstr = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/lang", NULL); + gnome_config_set_string (cfgstr, language); gnome_config_sync(); g_free (cfgstr); } - sessdir = g_strconcat (GdmSessDir, "/", session, NULL); + sesspath = g_strconcat (GdmSessDir, "/", session, NULL); - gdm_debug ("Running %s for %s on %s", sessdir, login, d->name); + gdm_debug ("Running %s for %s on %s", sesspath, login, d->name); + + for (i = 0; i < sysconf (_SC_OPEN_MAX); i++) + close(i); + + /* No error checking here - if it's messed the best response + * is to ignore & try to continue */ + open("/dev/null", O_RDONLY); /* open stdin - fd 0 */ + open("/dev/null", O_RDWR); /* open stdout - fd 1 */ + open("/dev/null", O_RDWR); /* open stderr - fd 2 */ /* Restore sigmask inherited from init */ sigprocmask (SIG_SETMASK, &sysmask, NULL); - execl (sessdir, NULL); + execl (sesspath, NULL); - gdm_error (_("gdm_slave_session_init: Could not start session `%s'"), sessdir); + gdm_error (_("gdm_slave_session_start: Could not start session `%s'"), sesspath); gdm_slave_session_stop(); gdm_slave_session_cleanup(); @@ -445,11 +470,11 @@ gdm_slave_session_cleanup (void) { gdm_debug ("gdm_slave_session_cleanup: %s on %s", pwent->pw_name, d->name); - if (d->dsp && gdm_slave_xsync_ping()) { + /* Execute post session script */ + gdm_debug ("gdm_slave_session_cleanup: Running post session script"); + gdm_exec_script (d, GdmPostSession); - /* Execute post session script */ - gdm_debug ("gdm_slave_session_cleanup: Running post session script"); - gdm_exec_script (d, GdmPostSession); + if (d->dsp && gdm_slave_xsync_ping()) { /* Cleanup */ gdm_debug ("gdm_slave_session_cleanup: Killing windows"); diff --git a/daemon/xdmcp.c b/daemon/xdmcp.c index 7ae8061a..de26cb3d 100644 --- a/daemon/xdmcp.c +++ b/daemon/xdmcp.c @@ -298,6 +298,7 @@ gdm_xdmcp_decode_packet (void) gdm_debug ("gdm_xdmcp_decode: Received opcode %s from client %s", opcode_names[header.opcode], inet_ntoa (clnt_sa.sin_addr)); + switch (header.opcode) { case BROADCAST_QUERY: @@ -388,7 +389,7 @@ gdm_xdmcp_handle_query (struct sockaddr_in *clnt_sa, gint len, gint type) gdm_xdmcp_send_unwilling (clnt_sa, type); /* Dispose authlist from remote display */ - XdmcpDisposeARRAYofARRAY8 (&clnt_authlist); + /* XdmcpDisposeARRAYofARRAY8 (&clnt_authlist); */ } @@ -410,7 +411,7 @@ gdm_xdmcp_send_forward_query (GdmIndirectDisplay *id, ARRAYofARRAY8Ptr authlist) XdmcpWriteARRAY8 (&buf, &serv_authlist.authentication); /* Hardcoded authentication */ XdmcpWriteARRAY8 (&buf, &servhost); XdmcpWriteARRAY8 (&buf, &status); - /* XdmcpFlush (xdmcpfd, &buf, clnt_sa, sizeof (struct sockaddr_in));*/ + /* XdmcpFlush (xdmcpfd, &buf, clnt_sa, sizeof (struct sockaddr_in)); */ } diff --git a/docs/C/Makefile.am b/docs/C/Makefile.am index 21276286..10b60d3e 100644 --- a/docs/C/Makefile.am +++ b/docs/C/Makefile.am @@ -20,6 +20,7 @@ dist-hook: mkdir $(distdir)/gdm -cp $(srcdir)/gdm/*.html gdm/*.css $(distdir)/gdm -cp $(srcdir)/gdm.html $(distdir) + -cp $(srcdir)/gdm.html $(distdir)/gdm/index.html mkdir $(distdir)/images -cp $(srcdir)/images/*.gif $(srcdir)/images/*.jpg $(distdir)/images diff --git a/docs/C/gdm.sgml b/docs/C/gdm.sgml index e4f83be8..ffb0d412 100644 --- a/docs/C/gdm.sgml +++ b/docs/C/gdm.sgml @@ -78,16 +78,22 @@ </preface> <chapter id="intro"> - <title>Introduction</title> + <title>Overview</title> - <para> - GDM is a replacement for XDM, the X Display Manager. Unlike its - competitors (X3DM, KDM, WDM) GDM was written from scratch and - does not contain any original XDM / X Consortium code. - </para> + <sect1> + <title> + Introduction + </title> + + <para> + GDM is a replacement for XDM, the X Display Manager. Unlike its + competitors (X3DM, KDM, WDM) GDM was written from scratch and + does not contain any original XDM / X Consortium code. + </para> + </sect1> - <sect1 id="overview"> - <title>Daemon Overview</title> + <sect1 id="daemonov"> + <title>The GDM Daemon</title> <para> GDM was written with simplicity and security in mind. The @@ -157,11 +163,176 @@ reasons. Looking up icons in homedirs, scaling and rendering face icons can take quite a long time. YMMV. </para> + </sect1> + + <sect1> + <title> + XDMCP + </title> + + <para> + GDM also supports the X Display Manager Protocol (XDMCP) for + managing remote displays. + </para> + + <para> + GDM listens to UDP port 177 and will repond to QUERY and + BROADCAST_QUERY requests by sending a WILLING packet to the + originator. + </para> + + <para> + GDM can also be configured to honor INDIRECT queries and + present a host chooser to the remote display. GDM will + remember the user's choice and forward subsequent requests to + the chosen manager. + </para> + + <para> + GDM only supports the MIT-MAGIC-COOKIE-1 authentication + system. Little is gained from the other schemes, and no + effort has been made to implement them so far. + </para> + + <para> + Since it is fairly easy to do denial of service attacks on the + XDMCP service, GDM incorporates a few features to guard + against attacks. Please read the XDMCP reference section below + for more information. + </para> + + <para> + Even though GDM tries to outsmart potential attackers, it is + still adviced that you block UDP port 177 on your firewall + unless you really need it. GDM guards against DoS attacks, but + the X protocol is still inherently insecure and should only be + used in controlled environments. + </para> + + <para> + Even though your display is protected by cookies the XEvents + and thus the keystrokes typed when entering passwords will + still go over the wire in clear text. It is trivial to capture + these. You should also be aware that cookies, if placed on an + NFS mounted directory, are prone to eavesdropping too. + </para> </sect1> + + <sect1> + <title>The Greeter</title> + + <para> + The greeter is the graphical user interface that is presented + to the user. The greeter contains a menu at the top, an + optional face browser, an optional logo and a text entry + widget. + </para> + + <sect2> + <title> + Text entry + </title> + + <para> + The text entry field is used for entering logins, passwords, + passphrases etc. <filename /gdmlogin/ is controlled by the + underlying daemon and is basically stateless. The daemon + controls the greeter through a simple protocol where it can + ask the greeter for a text string with echo turned on or + off. Similarly, the daemon can change the label above the + text entry widget to correspond to the value the + authentication system wants the user to enter. + </para> + + </sect2> + + <sect2> + <title> + The Menu + </title> + + <para> + The menu bar in the top of the greeter enables the user to + select the requested session type/desktop environment, + select an appropriate locale/language and optionally + shutdown/reboot the machine. The greeter window can also be + iconified to make room for other applications on the login + screen. + </para> + + </sect2> + + <sect2> + <title> + The face browser + </title> + + <para> + The greeter provides a face browser containing icons for all + the users on a system. The icons can be installed globally + by the sysadmin or in the users' home directories. + </para> + + <para> + The face browser makes a few assumptions about your + environment. First of all, the greeter runs under a + dedicated userid, and therefore any face icons located in + user directories must be readable to the gdm user. I.e. all + home- and <filename>~/.gnome</filename> directories must be + made readable and executable to the ``other'' group on the + system. + </para> + + <para> + Similarly, face icons placed in the global face directory + must be readable to the gdm user. + </para> + + <para> + Please note that loading and scaling face icons located in + user home directories can be a very time consuming task. + Especially on large systems or systems running NIS. The + browser feature is only intended for systems with relatively + few users. + </para> + + <para> + To filter out unwanted user names in the browser, an exclude + option is implemented. The greeter will automatically ignore + usernames listed in the <filename /Exclude/ statement in the + config file. + </para> + + <para> + When the browser is turned on, valid usernames on the + machine are inherently exposed to a potential intruder. If + your system is connected directly to the Internet, this + might be a bad idea. + </para> + + </sect2> + + <sect2> + <title> + The Logo + </title> + + <para> + The greeter can optionally display a logo in the login + window. The image must be in a format readable to the Imlib + library (GIF, JPG, PNG, TIFF, XPM and possibly others), and + it must be readable to the gdm user. See the <filename + /Logo/ option in the reference section below for detauls. + </para> + + </sect2> + + </sect1> + </chapter> - <chapter id="ConfigurationOverview"> + <chapter id="Configuration"> <title>The Configuration Directory</title> <para> @@ -269,6 +440,13 @@ just logged out. </para> + <para> + Note that the PostSession script will be run even when the + display fails to respond due to an I/O error or similar. Thus, + there is no guarantee that X applications will work during + script execution. + </para> + <para> Neither of the Init, PreSession or PostSession scripts are necessary and can be left out. At least one session script is @@ -278,14 +456,6 @@ </sect1> <sect1> - <title>The Greeter</title> - - <para> - foo foo - </para> - </sect1> - - <sect1> <title>The Configuration File - <filename>gdm.conf</filename></title> <para> diff --git a/gui/Makefile.am b/gui/Makefile.am index 1e96a2ce..a2954f68 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -10,7 +10,7 @@ INCLUDES = -I. -I.. -I$(top_srcdir)/daemon -I$(includedir) \ -DLOCALEDIR=\"$(datadir)/locale\" \ $(GNOME_INCLUDEDIR) -bin_PROGRAMS = gdmchooser gdmlogin gdmconfig +bin_PROGRAMS = gdmchooser gdmlogin # gdmconfig gdmchooser_SOURCES = \ gdmchooser.c \ @@ -20,10 +20,10 @@ gdmlogin_SOURCES = \ gdmlogin.c \ gdmlogin.h -gdmconfig_SOURCES = \ - gdmconfig.c +#gdmconfig_SOURCES = \ +# gdmconfig.c gdmchooser_LDADD = $(GNOME_LIBDIR) $(GNOME_LIBS) $(GNOMEUI_LIBS) -lXdmcp -lX11 $(INTLLIBS) gdmlogin_LDADD = ../daemon/filecheck.o $(GNOME_LIBDIR) $(GNOME_LIBS) $(GNOMEUI_LIBS) $(INTLLIBS) -gdmconfig_LDADD = $(GNOME_LIBDIR) $(GNOME_LIBS) $(GNOMEUI_LIBS) $(INTLLIBS) +#gdmconfig_LDADD = $(GNOME_LIBDIR) $(GNOME_LIBS) $(GNOMEUI_LIBS) $(INTLLIBS) diff --git a/gui/gdmchooser.c b/gui/gdmchooser.c index 7f4de0c2..42f8f061 100644 --- a/gui/gdmchooser.c +++ b/gui/gdmchooser.c @@ -676,6 +676,9 @@ main (int argc, char *argv[]) gnome_init ("gdmchooser", VERSION, fixedargc, fixedargv); g_free (fixedargv); + bindtextdomain (PACKAGE, GNOMELOCALEDIR); + textdomain (PACKAGE); + gnome_preferences_set_dialog_position(GTK_WIN_POS_CENTER); gdm_chooser_parse_config(); diff --git a/gui/gdmconfig.c b/gui/gdmconfig.c index aed7812c..ad4b3e60 100644 --- a/gui/gdmconfig.c +++ b/gui/gdmconfig.c @@ -1167,6 +1167,9 @@ int main (int argc, gchar* argv[]) gnome_init ("gdmconfig", VERSION, argc, argv); gnome_sound_shutdown (); help.name = gnome_app_id; + + bindtextdomain (PACKAGE, GNOMELOCALEDIR); + textdomain (PACKAGE); gdm_config_gui_init (); gdm_config_parse (); diff --git a/gui/gdmlogin.c b/gui/gdmlogin.c index c7c0ce74..23eae8f8 100644 --- a/gui/gdmlogin.c +++ b/gui/gdmlogin.c @@ -449,135 +449,104 @@ gdm_login_list_lookup (GSList *l, gchar *data) static void -gdm_login_sesslang_lookup (void) /* Input validation sucks */ +gdm_login_session_lookup (gchar* savedsess) { - struct passwd *pwent; - gboolean fileok; - gchar msg[1024]; - gchar *dir=NULL, *cfg=NULL; - gchar *usrlang=NULL, *usrsess=NULL; + if (!curuser) + gdm_login_abort("gdm_login_session_lookup: curuser==NULL. Mail <mkp@mkp.net> with " \ + "information on your PAM and user database setup"); - if(!curuser) - gdm_login_abort("gdm_login_sesslang_lookup: curuser==NULL. Mail <mkp@mkp.net> with " \ - "information on your PAM and user database setup"); + /* Don't save session unless told otherwise */ + savesess = FALSE; gtk_widget_set_sensitive (GTK_WIDGET (sessmenu), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (langmenu), FALSE); - - /* Lookup verified user */ - pwent = getpwnam (curuser); - - if(!pwent) - gdm_login_abort("gdm_login_sesslang_lookup: pwent==NULL. Mail <mkp@mkp.net> with " \ - "information on your PAM and user database setup"); - dir = g_strconcat (pwent->pw_dir, "/.gnome", NULL); - fileok = gdm_file_check ("gdm_login_sesslang_lookup", pwent->pw_uid, dir, "gdm", TRUE, GdmUserMaxFile, GdmRelaxPerms); - g_free (dir); - - if (!fileok) { /* User's settings can't be retrieved */ - - /* If cursess==last use system default session */ + /* Previously saved session not found in ~user/.gnome/gdm */ + if (! strlen (savedsess)) { + /* If "Last" is chosen run Default, else run user's current selection */ if (!strcasecmp (cursess, lastsess)) session = defsess; else session = cursess; - /* If curlang==last use default */ - if (!strcasecmp (curlang, lastlang)) - language = GdmDefaultLocale; - else - language = curlang; - - savesess = FALSE; - savelang = FALSE; - + savesess = TRUE; return; } - /* Find user's last session and language if available */ - cfg = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/last", NULL); - usrsess = gnome_config_get_string (cfg); - g_free (cfg); - - cfg = g_strconcat ("=", pwent->pw_dir, "/.gnome/gdm=/session/lang", NULL); - usrlang = gnome_config_get_string (cfg); - g_free (cfg); - - /* If ``Last'' session is selected */ + /* If "Last" session is selected */ if (!strcasecmp (cursess, lastsess)) { + session = savedsess; + + /* Check if user's saved session exists on this box */ + if (!gdm_login_list_lookup (sessions, session)) { + gchar *msg; - /* User has no saved session. Use default. */ - if (!usrsess) { - session = defsess; - savesess = TRUE; - } - /* User's saved session exists on this box */ - else if (gdm_login_list_lookup (sessions, usrsess)) { - session = usrsess; - savesess = FALSE; - } - /* User's saved session type unknown */ - else { session = defsess; - g_snprintf (msg, 1023, - _("Your preferred session type %s is not installed on this machine.\n" \ - "Do you wish to make %s the default for future sessions?"), - usrsess, defsess); + msg = g_strdup_printf (_("Your preferred session type %s is not installed on this machine.\n" \ + "Do you wish to make %s the default for future sessions?"), + savedsess, defsess); savesess = gdm_login_query (msg); + g_free (msg); } } /* One of the other available session types is selected */ else { session = cursess; - /* User has no saved session type. Use current */ - if (!usrsess) - savesess = TRUE; - /* User's saved session is also the chosen one */ - else if (!strcasecmp (usrsess, cursess)) - savesess = FALSE; - /* User selected a new session type */ - else { - g_snprintf (msg, 1023, - _("You have chosen %s for this session, but your default setting is %s.\n" \ - "Do you wish to make %s the default for future sessions?"), - cursess, usrsess, cursess); + /* User's saved session is not the chosen one */ + if (strcasecmp (savedsess, session)) { + gchar *msg; + + msg = g_strdup_printf (_("You have chosen %s for this session, but your default setting is " \ + "%s.\nDo you wish to make %s the default for future sessions?"), + cursess, savedsess, cursess); savesess = gdm_login_query (msg); + g_free (msg); } } +} - /* If ``Last'' language is selected */ - if (!strcasecmp (curlang, lastlang)) { - /* User has no saved language. Use default. */ - if (!usrlang) { +static void +gdm_login_language_lookup (gchar* savedlang) +{ + if (!curuser) + gdm_login_abort("gdm_login_language_lookup: curuser==NULL. Mail <mkp@mkp.net> with " \ + "information on your PAM and user database setup"); + + /* Don't save language unless told otherwise */ + savelang = FALSE; + + gtk_widget_set_sensitive (GTK_WIDGET (langmenu), FALSE); + + /* Previously saved language not found in ~user/.gnome/gdm */ + if (! strlen (savedlang)) { + /* If "Last" is chosen use Default, else use current selection */ + if (!strcasecmp (curlang, lastlang)) language = GdmDefaultLocale; - savelang = TRUE; - } - else { - language = usrlang; - savelang = FALSE; - } + else + language = curlang; + + savelang = TRUE; + return; } - /* One of the available languages is selected */ - else { + + /* If a different language is selected */ + if (strcasecmp (curlang, lastlang)) { language = curlang; - /* User has no saved language. Use current */ - if (!usrlang) - savelang = TRUE; - /* User selected a new language */ - else { - g_snprintf (msg, 1023, - _("You have chosen %s for this session, but your default setting is %s.\n" \ - "Do you wish to make %s the default for future sessions?"), - curlang, usrlang, curlang); + /* User's saved language is not the chosen one */ + if (strcasecmp (savedlang, language)) { + gchar *msg; + + msg = g_strdup_printf (_("You have chosen %s for this session, but your default setting is " \ + "%s.\nDo you wish to make %s the default for future sessions?"), + curlang, savedlang, curlang); savelang = gdm_login_query (msg); + g_free (msg); } } - - return; + else + language = savedlang; } @@ -866,19 +835,22 @@ gdm_login_ctrl_handler (GIOChannel *source, GIOCondition cond, gint fd) case GDM_MSGERR: g_io_channel_read (source, buf, PIPE_SIZE-1, &len); buf[len-1] = '\0'; - gtk_label_set (GTK_LABEL(msg), buf); + gtk_label_set (GTK_LABEL (msg), buf); gtk_widget_show (GTK_WIDGET (msg)); g_print ("\n"); break; case GDM_SESS: g_io_channel_read (source, buf, PIPE_SIZE-1, &len); /* Empty */ - gdm_login_sesslang_lookup(); /* Lookup session and language */ + buf[len-1] = '\0'; + gdm_login_session_lookup (buf); g_print ("%s\n", session); break; case GDM_LANG: g_io_channel_read (source, buf, PIPE_SIZE-1, &len); /* Empty */ + buf[len-1] = '\0'; + gdm_login_language_lookup (buf); g_print ("%s\n", language); break; @@ -1523,6 +1495,9 @@ main (int argc, char *argv[]) gnome_init ("gdmlogin", VERSION, fixedargc, fixedargv); g_free (fixedargv); + bindtextdomain (PACKAGE, GNOMELOCALEDIR); + textdomain (PACKAGE); + gnome_preferences_set_dialog_position (GTK_WIN_POS_CENTER); gdm_login_parse_config(); |