diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-07-14 00:09:53 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-07-14 00:09:53 +0000 |
commit | 5e3ee224ab284d1329d2b71ef9a3f5cae9859376 (patch) | |
tree | d9db794a1d0a2e2b72a7073437e880f8f9d94611 /libnetfs/io-reauthenticate.c | |
parent | 3903b6ff56a3387a4bcbf86ffd3d4c77867f1108 (diff) |
(netfs_S_io_reauthenticate): Repeat auth_server_authenticate for as
long as we get EINTR. Tolerate other errors without crashing as well.
Diffstat (limited to 'libnetfs/io-reauthenticate.c')
-rw-r--r-- | libnetfs/io-reauthenticate.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/libnetfs/io-reauthenticate.c b/libnetfs/io-reauthenticate.c index 3d8db79d..5b33b65c 100644 --- a/libnetfs/io-reauthenticate.c +++ b/libnetfs/io-reauthenticate.c @@ -29,6 +29,7 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port) uid_t *gen_uids, *gen_gids, *aux_uids, *aux_gids; u_int genuidlen, gengidlen, auxuidlen, auxgidlen; error_t err; + mach_port_t newright; if (!user) return EOPNOTSUPP; @@ -41,20 +42,31 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port) mutex_lock (&user->po->np->lock); newpi = netfs_make_protid (user->po, 0); - err = auth_server_authenticate (netfs_auth_server_port, - rend_port, - MACH_MSG_TYPE_COPY_SEND, - ports_get_right (newpi), - MACH_MSG_TYPE_MAKE_SEND, - &gen_uids, &genuidlen, - &aux_uids, &auxuidlen, - &gen_gids, &gengidlen, - &aux_uids, &auxuidlen); - mach_port_deallocate (mach_task_self (), rend_port); + + newright = ports_get_right (newpi); + err = mach_port_insert_right (mach_task_self (), newpi, newpi, + MACH_MSG_TYPE_MAKE_SEND); assert_perror (err); - - newpi->credential = netfs_make_credential (gen_uids, genuidlen, - gen_gids, gengidlen); + do + err = auth_server_authenticate (netfs_auth_server_port, + rend_port, + MACH_MSG_TYPE_COPY_SEND, + newright, + MACH_MSG_TYPE_COPY_SEND, + &gen_uids, &genuidlen, + &aux_uids, &auxuidlen, + &gen_gids, &gengidlen, + &aux_uids, &auxuidlen); + while (err == EINTR); + mach_port_deallocate (mach_task_self (), rend_port); + mach_port_deallocate (mach_task_self (), newright); + + if (err) + newpi->credential = netfs_make_credential (0, 0, 0, 0); + else + newpi->credential = netfs_make_credential (gen_uids, genuidlen, + gen_gids, gengidlen); + mutex_unlock (&user->po->np->lock); ports_port_deref (newpi); |