Commit 473e7df6 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

if we can't use the file ~/.xsession-errors, try /tmp/xses-<user>.XXXXXX

Mon Aug 25 16:27:09 2003  George Lebl <jirka@5z.com>

	* daemon/slave.c, daemon/errorgui.c, daemon/gdm.h, daemon/display.c:
	  if we can't use the file ~/.xsession-errors, try
	  /tmp/xses-<user>.XXXXXX using mkstemp.

	* docs/C/gdm.xml: update

	* NEWS: update
parent 5e5addf0
Mon Aug 25 16:27:09 2003 George Lebl <jirka@5z.com>
* daemon/slave.c, daemon/errorgui.c, daemon/gdm.h, daemon/display.c:
if we can't use the file ~/.xsession-errors, try
/tmp/xses-<user>.XXXXXX using mkstemp.
* docs/C/gdm.xml: update
* NEWS: update
Mon Aug 25 13:55:09 2003 George Lebl <jirka@5z.com>
* daemon/gdm.h, daemon/auth.[ch], daemon/xdmcp.c, daemon/server.c:
......
......@@ -8,6 +8,10 @@ Ahh news...
the Xsession file redirect .xsession-errors output
itself (which is really a bug IMO) (#120580)
- Fallback to an alternative file in the temp dir
if we can't create .xsession-errors (or if the home
dir is unsafe or it's a failsafe session)
- Fix sensitivity with respect to action menu toggle in
the security tab in gdmsetup (#120639)
......@@ -30,6 +34,10 @@ Ahh news...
- The AUTHORS file is updated
- Translation updates (Artur Flinta, Duarte Loreto,
Metin Amiroff, Tõivo Leedjärv, Changwoo Ryu,
Kjartan Maraas)
2.4.2.101 stuff:
- Memory profiling of the graphical greeter by not keeping
......
......@@ -8,7 +8,7 @@ dnl
AC_PROG_INTLTOOL([0.21])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gdm,2.4.2.101)
AM_INIT_AUTOMAKE(gdm,2.4.2.102)
AM_MAINTAINER_MODE
GTK_REQUIRED=1.3.1
......
......@@ -480,6 +480,9 @@ gdm_display_dispose (GdmDisplay *d)
g_free (d->login);
d->login = NULL;
g_free (d->xsession_errors_filename);
d->xsession_errors_filename = NULL;
g_free (d);
}
......
......@@ -270,7 +270,7 @@ gdm_error_box_full (GdmDisplay *d, GtkMessageType type, const char *error,
}
/* First read the details if they exist */
if (details_file) {
if (details_label != NULL && details_file != NULL) {
FILE *fp;
struct stat s;
int r;
......
......@@ -366,6 +366,8 @@ struct _GdmDisplay {
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 */
};
typedef struct _GdmXServer GdmXServer;
......
......@@ -2893,10 +2893,14 @@ open_xsession_errors (struct passwd *pwent,
gboolean home_dir_ok)
{
int logfd = -1;
g_free (d->xsession_errors_filename);
d->xsession_errors_filename = NULL;
/* Log all output from session programs to a file,
* unless in failsafe mode which needs to work when there is
* no diskspace as well */
if ( ! failsafe && home_dir_ok) {
if G_LIKELY ( ! failsafe && home_dir_ok) {
char *filename = g_build_filename (home_dir,
".xsession-errors",
NULL);
......@@ -2911,11 +2915,38 @@ open_xsession_errors (struct passwd *pwent,
seteuid (old);
setegid (oldg);
g_free (filename);
if G_UNLIKELY (logfd < 0) {
gdm_error (_("%s: Could not open ~/.xsession-errors"),
"run_session_child");
g_free (filename);
} else {
d->xsession_errors_filename = filename;
}
}
/* let's try an alternative */
if G_UNLIKELY (logfd < 0) {
mode_t oldmode;
char *filename = g_strdup_printf ("/tmp/xses-%s.XXXXXX",
pwent->pw_name);
uid_t old = geteuid ();
uid_t oldg = getegid ();
setegid (pwent->pw_gid);
seteuid (pwent->pw_uid);
oldmode = umask (077);
logfd = mkstemp (filename);
umask (oldmode);
seteuid (old);
setegid (oldg);
if G_LIKELY (logfd >= 0) {
d->xsession_errors_filename = filename;
} else {
g_free (filename);
}
}
......@@ -3612,7 +3643,6 @@ gdm_slave_session_start (void)
(end_time - 10 <= session_start_time) &&
/* only if the X server still exist! */
d->servpid > 1) {
char *errfile = g_build_filename (home_dir, ".xsession-errors", NULL);
gdm_debug ("Session less than 10 seconds!");
/* FIXME: perhaps do some checking to display a better error,
......@@ -3626,12 +3656,11 @@ gdm_slave_session_start (void)
"be out of diskspace. Try logging in with "
"one of the failsafe sessions to see if you "
"can fix this problem."),
(home_dir_ok && ! failsafe) ?
(d->xsession_errors_filename != NULL) ?
_("View details (~/.xsession-errors file)") :
NULL,
errfile,
d->xsession_errors_filename,
uid, gid);
g_free (errfile);
}
gdm_slave_session_stop (pid != 0 /* run_post_session */,
......
......@@ -546,8 +546,7 @@
script. As is usually done. If the user session lasted less then
10 seconds, GDM assumes that the session crashed and allows the user to
view this file in a dialog before returning to the login screen.
Also if the session being started is one of the failsafe session, this
file is not created. This way the user can view the session errors from
This way the user can view the session errors from
the last session and correct the problem this way.
</para>
......@@ -578,6 +577,14 @@
using the same script.
</para>
<para>
Note that if the session is a failsafe session, or if GDM can't open
this file for some reason, then a fallback file will be created in the
<filename>/tmp</filename> directory named
<filename>/tmp/xses-&lt;user&gt;.XXXXXX</filename> where the
<filename>XXXXXX</filename> are some random characters.
</para>
<para>
If you run a system with quotas set, it would be good to delete the
<filename>~/.xsession-errors</filename> in the
......
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