summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-02-14 20:29:11 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-02-14 20:29:11 +0100
commit9e6649f31e1769ca3b2545993ef51f2039848719 (patch)
tree7391ad83bec8b2feae483ff05398a03cc16c8367
parent1b6cf043c4083c6a64706d67232363cf78f92975 (diff)
Fix hang on reauthentication
One needs to keep the port being reauthenticated alive until we are sure the server has complete authentication. * libfshelp/fetch-root.c (fshelp_fetch_root): Deallocate `port' after auth_user_authenticate has completed. * trans/fakeroot.c (netfs_S_dir_lookup): Likewise with `file'.
-rw-r--r--libfshelp/fetch-root.c2
-rw-r--r--trans/fakeroot.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c
index 1b6739ec2..d7761e581 100644
--- a/libfshelp/fetch-root.c
+++ b/libfshelp/fetch-root.c
@@ -75,10 +75,10 @@ fshelp_fetch_root (struct transbox *box, void *cookie,
/* MAKE_SEND is safe here because we destroy REND ourselves. */
err = io_reauthenticate (port, rend,
MACH_MSG_TYPE_MAKE_SEND);
- mach_port_deallocate (mach_task_self (), port);
if (! err)
err = auth_user_authenticate (newauth, rend,
MACH_MSG_TYPE_MAKE_SEND, &ret);
+ mach_port_deallocate (mach_task_self (), port);
if (err)
ret = MACH_PORT_NULL;
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 84b4efcb2..64f320816 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -308,10 +308,10 @@ netfs_S_dir_lookup (struct protid *diruser,
err = io_reauthenticate (file, ref, MACH_MSG_TYPE_MAKE_SEND);
if (! err)
{
- mach_port_deallocate (mach_task_self (), file);
err = auth_user_authenticate (fakeroot_auth_port, ref,
MACH_MSG_TYPE_MAKE_SEND,
&dir);
+ mach_port_deallocate (mach_task_self (), file);
}
mach_port_destroy (mach_task_self (), ref);
if (err)