* auth/auth.c (S_auth_user_authenticate,S_auth_server_authenticate): Return EINVAL if rendezvous port dies during transaction.
--- Hello, This is a patch for the auth server to make it also return EINVAL when the rendezvous port has died during a transaction and not only if it is dead on arrival, as discussed earlier on IRC. This is probably not an important fix since a server should retry the RPC when it fails with EINTR and would then get EINVAL, and the user shouldn't have a problem since it is typically in control of the rendezvous port. Still, it is not impossible to come up with contrived, future situations where this could become a problem. Instead, my main motivation for doing this is just that it seems very sloppy of the auth server to rely on its client's behavior to make sure it eventually gets the correct error code. I have booted my installation with this patch installed and actually tested that the code indeed handles port death, which was easy since I've been debugging and testing port death recently anyway. The only thing left is to test that it still handles interruption, but I'm not sure how to do it and I don't think it's necessary. Shall I commit? Regards, Fredrik --- auth/auth.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/auth/auth.c b/auth/auth.c index 2afeaf7..5335d75 100644 --- a/auth/auth.c +++ b/auth/auth.c @@ -332,7 +332,11 @@ S_auth_user_authenticate (struct authhandle *userauth, /* We were interrupted; remove our record. */ { hurd_ihash_locp_remove (&pending_users, u.locp); - err = EINTR; + + /* Was it a normal interruption or did RENDEZVOUS die? */ + mach_port_type_t type; + mach_port_type (mach_task_self (), rendezvous, &type); + err = type & MACH_PORT_TYPE_DEAD_NAME ? EINVAL : EINTR; } } /* The server side has already removed U from the ihash table. */ @@ -414,7 +418,11 @@ S_auth_server_authenticate (struct authhandle *serverauth, /* We were interrupted; remove our record. */ { hurd_ihash_locp_remove (&pending_servers, s.locp); - err = EINTR; + + /* Was it a normal interruption or did RENDEZVOUS die? */ + mach_port_type_t type; + mach_port_type (mach_task_self (), rendezvous, &type); + err = type & MACH_PORT_TYPE_DEAD_NAME ? EINVAL : EINTR; } } /* The user side has already removed S from the ihash table. */ -- tg: (5923172..) t/auth-port-death (depends on: master)