summaryrefslogtreecommitdiff
path: root/pfinet/io-ops.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-07-14 00:18:11 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-07-14 00:18:11 +0000
commit966a500d2598db5ede16b32305633662a1e6f336 (patch)
tree51a8dd775b83c1f3f32951385246ff5f95a221fd /pfinet/io-ops.c
parent3e2410a33d47800692b9844c620251fda5308fff (diff)
(S_io_reauthenticate): Repeat auth_server_authenticate for as long as
we get EINTR. Deal with other errors without crashing.
Diffstat (limited to 'pfinet/io-ops.c')
-rw-r--r--pfinet/io-ops.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c
index 35281ce0..1ca158bb 100644
--- a/pfinet/io-ops.c
+++ b/pfinet/io-ops.c
@@ -361,6 +361,7 @@ S_io_reauthenticate (struct sock_user *user,
error_t err;
int i;
auth_t auth;
+ mach_port_t newright;
if (!user)
return EOPNOTSUPP;
@@ -375,22 +376,31 @@ S_io_reauthenticate (struct sock_user *user,
newuser = make_sock_user (user->sock, 0);
auth = getauth ();
- err = auth_server_authenticate (auth,
- rend,
- MACH_MSG_TYPE_COPY_SEND,
- ports_get_right (newuser),
- MACH_MSG_TYPE_MAKE_SEND,
- &gen_uids, &genuidlen,
- &aux_uids, &auxuidlen,
- &gen_gids, &gengidlen,
- &aux_gids, &auxgidlen);
+ newright = ports_get_right (newuser);
+ err = mach_port_insert_right (mach_task_self (), newright, newright,
+ MACH_MSG_TYPE_MAKE_SEND);
+ assert_perror (err);
+ do
+ err = auth_server_authenticate (auth,
+ rend,
+ MACH_MSG_TYPE_COPY_SEND,
+ newright,
+ MACH_MSG_TYPE_COPY_SEND,
+ &gen_uids, &genuidlen,
+ &aux_uids, &auxuidlen,
+ &gen_gids, &gengidlen,
+ &aux_gids, &auxgidlen);
+ while (err == EINTR);
mach_port_deallocate (mach_task_self (), rend);
- assert (!err); /* XXX */
+ mach_port_deallocate (mach_task_self (), newright);
mach_port_deallocate (mach_task_self (), auth);
- for (i = 0; i < genuidlen; i++)
- if (gen_uids[i] == 0)
- newuser->isroot = 1;
+ if (err)
+ newuser->isroot = 0;
+ else
+ for (i = 0; i < genuidlen; i++)
+ if (gen_uids[i] == 0)
+ newuser->isroot = 1;
mutex_unlock (&global_lock);
ports_port_deref (newuser);