1 Index: glibc-2.31/hurd/hurdsig.c
2 ===================================================================
3 --- glibc-2.31.orig/hurd/hurdsig.c
4 +++ glibc-2.31/hurd/hurdsig.c
5 @@ -1580,28 +1580,53 @@ _hurdsig_init (const int *intarray, size
7 reauth_proc (mach_port_t new)
9 - mach_port_t ref, ignore;
11 + mach_port_t ref, newproc;
13 ref = __mach_reply_port ();
14 - if (! HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
15 + err = HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
16 __proc_reauthenticate (port, ref,
17 - MACH_MSG_TYPE_MAKE_SEND)
18 - || __auth_user_authenticate (new, ref,
19 - MACH_MSG_TYPE_MAKE_SEND,
21 - && ignore != MACH_PORT_NULL)
22 - __mach_port_deallocate (__mach_task_self (), ignore);
23 + MACH_MSG_TYPE_MAKE_SEND));
26 + __mach_port_destroy (__mach_task_self (), ref);
30 + err = __auth_user_authenticate (new, ref,
31 + MACH_MSG_TYPE_MAKE_SEND,
33 __mach_port_destroy (__mach_task_self (), ref);
37 + if (newproc == MACH_PORT_NULL)
39 + /* Old versions of the proc server did not recreate the process
40 + port when reauthenticating, and passed MACH_PORT_NULL through
41 + the auth server. That must be what we're dealing with. */
43 + /* Set the owner of the process here too. */
44 + __mutex_lock (&_hurd_id.lock);
45 + if (!_hurd_check_ids ())
46 + HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
47 + __proc_setowner (port,
49 + ? _hurd_id.gen.uids[0] : 0),
50 + !_hurd_id.gen.nuids));
51 + __mutex_unlock (&_hurd_id.lock);
56 + err = __proc_reauthenticate_complete (newproc);
59 + __mach_port_deallocate (__mach_task_self (), newproc);
63 - /* Set the owner of the process here too. */
64 - __mutex_lock (&_hurd_id.lock);
65 - if (!_hurd_check_ids ())
66 - HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
67 - __proc_setowner (port,
69 - ? _hurd_id.gen.uids[0] : 0),
70 - !_hurd_id.gen.nuids));
71 - __mutex_unlock (&_hurd_id.lock);
72 + _hurd_port_set (&_hurd_ports[INIT_PORT_PROC], newproc);
74 (void) &reauth_proc; /* Silence compiler warning. */
76 Index: glibc-2.31/sysdeps/mach/hurd/spawni.c
77 ===================================================================
78 --- glibc-2.31.orig/sysdeps/mach/hurd/spawni.c
79 +++ glibc-2.31/sysdeps/mach/hurd/spawni.c
80 @@ -651,11 +651,29 @@ retry:
81 ref, MACH_MSG_TYPE_MAKE_SEND,
83 __mach_port_destroy (__mach_task_self (), ref);
86 - __mach_port_deallocate (__mach_task_self (), proc);
91 + if (newproc == MACH_PORT_NULL)
93 + /* Old versions of the proc server did not recreate the process
94 + port when reauthenticating, and passed MACH_PORT_NULL through
95 + the auth server. That must be what we're dealing with. Just
96 + keep the existing proc port in this case. */
100 + err = __proc_reauthenticate_complete (newproc);
103 + __mach_port_deallocate (__mach_task_self (), newproc);
108 + __mach_port_deallocate (__mach_task_self (), proc);
114 err = reauthenticate (INIT_PORT_CRDIR, &rcrdir);