Carl Fredrik Hammar, le Tue 29 Dec 2009 23:01:06 +0100, a écrit :
> On Mon, Dec 28, 2009 at 03:24:52AM +0100, Samuel Thibault wrote:
> > Carl Fredrik Hammar, le Sun 27 Dec 2009 20:56:21 +0100, a écrit :
> > > If the notification request is canceled before auth_user_authenticate
> > > returns there should be no problem.
> > 
> > I tried a crude
> > 
> >           error_t err2 = mach_port_request_notification(mach_task_self(), 
> > rendezvous, MACH_NOTIFY_DEAD_NAME, 0, MACH_PORT_NULL, 
> > MACH_MSG_TYPE_MAKE_SEND_ONCE, &old);
> > 
> > after the complete if (hurd_condition_wait (&s.wakeup, &pending_lock)
> > statement, with no luck: ext2fs got an EINTR anyway.
> 
> Err, shouldn't be in the user part after it finds the pending server if
> we want to do it before auth_user_authenticate returns?

That's the same.  To make it clearer, see attached patch.

Samuel
--- auth.c.orig 2009-12-29 23:07:54.000000000 +0100
+++ auth.c      2009-12-29 23:08:41.000000000 +0100
@@ -328,18 +328,19 @@
          condition_init (&u.wakeup);
          ports_interrupt_self_on_port_death (userauth, rendezvous);
          if (hurd_condition_wait (&u.wakeup, &pending_lock)
              && hurd_ihash_find (&pending_users, rendezvous))
            /* We were interrupted; remove our record.  */
            {
              hurd_ihash_locp_remove (&pending_users, u.locp);
              err = EINTR;
            }
+         error_t err2 = mach_port_request_notification(mach_task_self(), 
rendezvous, MACH_NOTIFY_DEAD_NAME, 0, MACH_PORT_NULL, 
MACH_MSG_TYPE_MAKE_SEND_ONCE, &old);
        }
       /* The server side has already removed U from the ihash table.  */
       mutex_unlock (&pending_lock);
 
       if (! err)
        {
          /* The server RPC has set the port and signalled U.wakeup.  */
          *newport = u.passthrough;
          *newporttype = MACH_MSG_TYPE_MOVE_SEND;
@@ -410,18 +411,19 @@
          condition_init (&s.wakeup);
          ports_interrupt_self_on_port_death (serverauth, rendezvous);
          if (hurd_condition_wait (&s.wakeup, &pending_lock)
              && hurd_ihash_find (&pending_servers, rendezvous))
            /* We were interrupted; remove our record.  */
            {
              hurd_ihash_locp_remove (&pending_servers, s.locp);
              err = EINTR;
            }
+         error_t err2 = mach_port_request_notification(mach_task_self(), 
rendezvous, MACH_NOTIFY_DEAD_NAME, 0, MACH_PORT_NULL, 
MACH_MSG_TYPE_MAKE_SEND_ONCE, &old);
        }
       /* The user side has already removed S from the ihash table.  */
       mutex_unlock (&pending_lock);
 
       if (err)
        return err;
 
       /* The user RPC has set the port (with a ref) and signalled S.wakeup.  */
       user = s.user;

Reply via email to