summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2003-10-03 20:43:11 +0000
committerGeorge Lebl <jirka@src.gnome.org>2003-10-03 20:43:11 +0000
commit6b7fd4cff43f5954270a19d55ef932535adf8e89 (patch)
tree2b516675d08f643964324d8ea2fb22d6398980e5
parent86829824c1ffcc93c3b43fd3896a7922634af14a (diff)
downloadgdm-6b7fd4cff43f5954270a19d55ef932535adf8e89.tar.gz
when the ~/.Xauthority didn't exist and we tried to create it but failed
Fri Oct 03 13:40:22 2003 George Lebl <jirka@5z.com> * daemon/auth.c: when the ~/.Xauthority didn't exist and we tried to create it but failed due to root squashing, whack the file (we created as user, but can't access it as root).
-rw-r--r--ChangeLog7
-rw-r--r--daemon/auth.c12
2 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9415a716..b4c1e2bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Fri Oct 03 13:40:22 2003 George Lebl <jirka@5z.com>
+
+ * daemon/auth.c: when the ~/.Xauthority didn't exist
+ and we tried to create it but failed due to root
+ squashing, whack the file (we created as user, but
+ can't access it as root).
+
Mon Sep 29 14:32:18 2003 George Lebl <jirka@5z.com>
* config/PreSession.in, config/PostSession.in, config/XKeepsCrashing,
diff --git a/daemon/auth.c b/daemon/auth.c
index 151e44d4..b9d2cf1d 100644
--- a/daemon/auth.c
+++ b/daemon/auth.c
@@ -493,6 +493,7 @@ gdm_auth_user_add (GdmDisplay *d, uid_t user, const char *homedir)
gboolean automatic_tmp_dir = FALSE;
gboolean authdir_is_tmp_dir = FALSE;
gboolean locked;
+ gboolean user_auth_exists;
if (!d)
return FALSE;
@@ -536,6 +537,9 @@ try_user_add_again:
else
d->userauth = g_build_filename (authdir, GdmUserAuthFile, NULL);
+ user_auth_exists = (d->userauth != NULL &&
+ access (d->userauth, F_OK) == 0);
+
/* Find out if the Xauthority file passes the paranoia check */
/* Note that this is not very efficient, we stat the files over
and over, but we don't care, we don't do this too often */
@@ -558,6 +562,14 @@ try_user_add_again:
and we don't want to write cookies over NFS */
! try_open_read_as_root (d->userauth)) {
+ /* if the userauth file didn't exist and we were looking at it,
+ it likely exists now but empty, so just whack it
+ (it may not exist if the file didn't exist and the directory
+ was of wrong permissions, but more likely this is
+ file on NFS dir with root-squashing enabled) */
+ if ( ! user_auth_exists && d->userauth != NULL)
+ unlink (d->userauth);
+
/* No go. Let's create a fallback file in GdmUserAuthFB (/tmp)
* or perhaps GdmUserAuth directory (usually would be /tmp) */
d->authfb = TRUE;