diff options
author | Roland McGrath <roland@gnu.org> | 1994-08-30 08:09:04 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1994-08-30 08:09:04 +0000 |
commit | a732aa83186dc5a0f2ea6bfcc4119e5e5f91d122 (patch) | |
tree | 8b7ec023e35e06bc65147f6ea35239899032a6aa /hurd | |
parent | decdf44d3b7cd0c8b32e1c7275eb3784ed90e804 (diff) |
(_hurd_setauth): Use new authentication protocol: for each port, create a
fresh receive right and pass send-once rights in the auth calls, then
destroy the port.
Diffstat (limited to 'hurd')
-rw-r--r-- | hurd/setauth.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/hurd/setauth.c b/hurd/setauth.c index 94a7fe499d..848edfa4f7 100644 --- a/hurd/setauth.c +++ b/hurd/setauth.c @@ -36,7 +36,7 @@ _hurd_setauth (auth_t new) { error_t err; int d; - mach_port_t newport; + mach_port_t newport, ref; /* Give the new send right a user reference. This is a good way to check that it is valid. */ @@ -68,28 +68,42 @@ _hurd_setauth (auth_t new) if (_hurd_init_dtable[d] != MACH_PORT_NULL) { mach_port_t new; - if (! __io_reauthenticate (_hurd_init_dtable[d], _hurd_pid) && + ref = __mach_reply_port (); + if (! __io_reauthenticate (_hurd_init_dtable[d], + ref, MACH_MSG_TYPE_MAKE_SEND_ONCE) && ! HURD_PORT_USE (&_hurd_ports[INIT_PORT_AUTH], - __auth_user_authenticate (port, - _hurd_init_dtable[d], - _hurd_pid, - &new))) + __auth_user_authenticate + (port, + _hurd_init_dtable[d], + ref, MACH_MSG_TYPE_MAKE_SEND_ONCE, + &new))) { __mach_port_deallocate (__mach_task_self (), _hurd_init_dtable[d]); _hurd_init_dtable[d] = new; } + __mach_port_destroy (__mach_task_self (), ref); } + ref = __mach_reply_port (); if (__USEPORT (CRDIR, - ! __io_reauthenticate (port, _hurd_pid) && - ! __auth_user_authenticate (new, port, _hurd_pid, &newport))) + ! __io_reauthenticate (port, + ref, MACH_MSG_TYPE_MAKE_SEND_ONCE) && + ! __auth_user_authenticate (new, port, + ref, MACH_MSG_TYPE_MAKE_SEND_ONCE, + &newport))) _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], newport); + __mach_port_destroy (__mach_task_self (), ref); + ref = __mach_reply_port (); if (__USEPORT (CWDIR, - ! __io_reauthenticate (port, _hurd_pid) && - ! __auth_user_authenticate (new, port, _hurd_pid, &newport))) + ! __io_reauthenticate (port, + ref, MACH_MSG_TYPE_MAKE_SEND_ONCE) && + ! __auth_user_authenticate (new, port, + ref, MACH_MSG_TYPE_MAKE_SEND_ONCE, + &newport))) _hurd_port_set (&_hurd_ports[INIT_PORT_CWDIR], newport); + __mach_port_destroy (__mach_task_self (), ref); /* Run things which want to do reauthorization stuff. */ RUN_HOOK (_hurd_reauth_hook, (new)); |