[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/7] trans: fix transparent reauthentication in fakeroot
From: |
Justus Winter |
Subject: |
[PATCH 6/7] trans: fix transparent reauthentication in fakeroot |
Date: |
Wed, 4 Dec 2013 12:11:55 +0100 |
When looking up files, fakeroot intercepts reauthentication requests
and executes io_reauthenticate and auth_user_authenticate
transparently for the client. This, however, makes the client
incorrectly assume that the lookup is finished (assuming
/media/scratch is a translator):
% cd /media/scratch && fakeroot-hurd pwd
pwd: reading directory `..': Bad file descriptor
Make the reauthentication completely transparent to the client by
re-doing the lookup ourselves.
* trans/fakeroot.c (netfs_S_dir_lookup): Fix transparent reauthentication.
---
trans/fakeroot.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index b6938dc..24d3a4f 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -235,7 +235,10 @@ netfs_S_dir_lookup (struct protid *diruser,
return EOPNOTSUPP;
dnp = diruser->po->np;
- err = dir_lookup (dnp->nn->file, filename,
+
+ mach_port_t dir = dnp->nn->file;
+ redo_lookup:
+ err = dir_lookup (dir, filename,
flags & (O_NOLINK|O_RDWR|O_EXEC|O_CREAT|O_EXCL|O_NONBLOCK),
mode, do_retry, retry_name, &file);
if (err)
@@ -252,14 +255,14 @@ netfs_S_dir_lookup (struct protid *diruser,
mach_port_deallocate (mach_task_self (), file);
err = auth_user_authenticate (fakeroot_auth_port, ref,
MACH_MSG_TYPE_MAKE_SEND,
- retry_port);
+ &dir);
}
mach_port_destroy (mach_task_self (), ref);
if (err)
return err;
}
- *do_retry = FS_RETRY_NORMAL;
- /*FALLTHROUGH*/
+ filename = retry_name;
+ goto redo_lookup;
case FS_RETRY_NORMAL:
case FS_RETRY_MAGICAL:
--
1.7.10.4
- [PATCH 3/7] trans: remove unused declaration from fakeroot.c, (continued)
- [PATCH 3/7] trans: remove unused declaration from fakeroot.c, Justus Winter, 2013/12/04
- [PATCH 4/7] trans: improve the netfs_demuxer function in fakeroot.c, Justus Winter, 2013/12/04
- [PATCH 5/7] trans: fix the creation of files in fakeroot, Justus Winter, 2013/12/04
- [PATCH 2/7] utils: improve the auth_demuxer function in fakeauth.c, Justus Winter, 2013/12/04
- [PATCH 7/7] trans: make the fakeroot environment more transparent, Justus Winter, 2013/12/04
- [PATCH 6/7] trans: fix transparent reauthentication in fakeroot,
Justus Winter <=
- Re: [PATCH 1/7] auth: improve the auth_demuxer function, Samuel Thibault, 2013/12/04