Bug#241169: gdm: Handle disk quota on HOME/.Xauthority

Paul Szabo Paul Szabo <psz@maths.usyd.edu.au>, 241169@bugs.debian.org
Wed, 31 Mar 2004 14:20:32 +1000


Package: gdm
Version: 2.2.5.5-2
Severity: important
Tags: patch

GDM seems to use the /etc/gdm/gdm.conf line

UserAuthFBDir=/tmp

only when it is unable to create (open) the ~/.Xauthority file. This
fallback mechanism should be used also when the file cannot be written,
e.g. when the user has exceeded his disk quota.

The problem seems to be that the return status of XauWriteAuth is ignored
(within gdm_auth_user_add, and everywhere else).

Seems to me that the following patch should solve this particular issue.


--- daemon/auth.c.old	Fri Nov 16 18:18:06 2001
+++ daemon/auth.c	Wed Mar 31 13:57:37 2004
@@ -415,7 +415,17 @@
     auths = d->auths;
 
     while (auths) {
-	XauWriteAuth (af, auths->data);
+	/* PSz 31 Mar 04  Check that write succeeded (disk quota?) */
+	if (! XauWriteAuth (af, auths->data)) {
+	    /* Any other cleanup needed? */
+	    gdm_error (_("gdm_auth_user_add: Could not write cookie file %s"), d->userauth);
+	    fclose (af);
+	    XauUnlockAuth (d->userauth);
+	    g_free (d->userauth);
+	    d->userauth = NULL;
+	    umask (022);
+	    return FALSE; 
+	}
 	auths = auths->next;
     }
 
--- daemon/slave.c.old	Wed Mar 31 13:25:27 2004
+++ daemon/slave.c	Wed Mar 31 14:09:34 2004
@@ -2252,10 +2252,17 @@
     setegid (pwent->pw_gid);
     seteuid (pwent->pw_uid);
 
-    authok = gdm_auth_user_add (d, pwent->pw_uid,
-				/* Only pass the home_dir if
-				 * it was ok */
-				home_dir_ok ? home_dir : NULL);
+    if (home_dir_ok) {
+	/* PSz 31 Mar 04  Try with home_dir ... */
+	authok = gdm_auth_user_add (d, pwent->pw_uid, home_dir);
+	/* ... if fails (disk quota?) then try again, without */
+	if (! authok) {
+	    authok = gdm_auth_user_add (d, pwent->pw_uid, NULL);
+	}
+    }
+    else {
+	authok = gdm_auth_user_add (d, pwent->pw_uid, NULL);
+    }
 
     seteuid (0);
     setegid (GdmGroupId);


Thanks,

Paul Szabo - psz@maths.usyd.edu.au  http://www.maths.usyd.edu.au:8000/u/psz/
School of Mathematics and Statistics  University of Sydney   2006  Australia



-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux pisa.maths.usyd.edu.au 2.4.22-smssvr1.3 #1 SMP Thu Feb 19 08:27:26 EST 2004 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages gdm depends on:
ii  adduser                3.47              Add and remove users and groups
ii  debconf                1.0.32            Debian configuration management sy
ii  dpkg                   1.9.21            Package maintenance system for Deb
ii  gdk-imlib1             1.9.14-2          Gdk-Imlib is an imaging library fo
ii  libart2                1.4.1.4-3         The Gnome canvas widget - runtime 
ii  libaudiofile0          0.2.3-4           The Audiofile Library
ii  libc6                  2.2.5-11.5        GNU C Library: Shared libraries an
ii  libdb3                 3.2.9-16          Berkeley v3 Database Libraries [ru
ii  libesd0                0.2.23-3          Enlightened Sound Daemon - Shared 
ii  libgdk-pixbuf2         0.17.0-2woody1    The GdkPixBuf library.
ii  libglade-gnome0        1:0.17-2.2        Library to load .glade files at ru
ii  libglade0              1:0.17-2.2        Library to load .glade files at ru
ii  libglib1.2             1.2.10-4          The GLib library of C routines
ii  libgnome32             1.4.1.4-3         The Gnome libraries
ii  libgnomesupport0       1.4.1.4-3         The Gnome libraries (Support libra
ii  libgnomeui32           1.4.1.4-3         The Gnome libraries (User Interfac
ii  libgtk1.2              1.2.10-11         The GIMP Toolkit set of widgets fo
ii  libjpeg62              6b-5              The Independent JPEG Group's JPEG 
ii  libpam-modules         0.72-35           Pluggable Authentication Modules f
ii  libpam0g               0.72-35           Pluggable Authentication Modules l
ii  libpng2                1.0.12-3.woody.3  PNG library - runtime
ii  libtiff3g              3.5.5-6           Tag Image File Format library
ii  libungif4g             4.1.0b1-2         shared library for GIF images (run
ii  libwrap0               7.6-9             Wietse Venema's TCP wrappers libra
ii  libxml1                1:1.8.17-2woody1  GNOME XML library
ii  scrollkeeper           0.3.6-3.1         A free electronic cataloging syste
ii  xlibs                  4.1.0-16woody3    X Window System client libraries
ii  zlib1g                 1:1.1.4-1.0woody0 compression library - runtime