(_hurd_msgport_receive): Unlock self sigstate lock after getting it.
[kopensolaris-gnu/glibc.git] / hurd / hurdauth.c
index c948cf3..b4e2cb8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,8 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
 Cambridge, MA 02139, USA.  */
 
 #include <hurd.h>
-#include "hurd/msg_server.h"
+#include <hurd/msg_server.h>
+#include <hurd/id.h>
 
 int
 _hurd_refport_secure_p (mach_port_t ref)
@@ -29,31 +30,36 @@ _hurd_refport_secure_p (mach_port_t ref)
   return 0;
 }
 
-error_t
+kern_return_t
 _S_add_auth (mach_port_t me,
             auth_t addauth)
 {
   error_t err;
   auth_t newauth;
 
-  if (err = __USEPORT (AUTH, __auth_combine (port, addauth, &newauth)))
+  if (err = __USEPORT (AUTH,
+                      __auth_makeauth (port,
+                                       &addauth, 1, MACH_MSG_TYPE_MOVE_SEND,
+                                       NULL, 0,
+                                       NULL, 0,
+                                       NULL, 0,
+                                       NULL, 0,
+                                       &newauth)))
     return err;
 
-  /* XXX clobbers errno. Need per-thread errno. */
   err = __setauth (newauth);
   __mach_port_deallocate (__mach_task_self (), newauth);
   if (err)
     return errno;
 
-  __mach_port_deallocate (__mach_task_self (), addauth);
   return 0;
 }
 
-error_t
+kern_return_t
 _S_del_auth (mach_port_t me,
             task_t task,
-            uid_t *uids, mach_msg_type_number_t nuids,
-            gid_t *gids, mach_msg_type_number_t ngids)
+            intarray_t uids, mach_msg_type_number_t nuids,
+            intarray_t gids, mach_msg_type_number_t ngids)
 {
   error_t err;
   auth_t newauth;
@@ -61,6 +67,7 @@ _S_del_auth (mach_port_t me,
   if (!_hurd_refport_secure_p (task))
     return EPERM;
 
+  HURD_CRITICAL_BEGIN;
   __mutex_lock (&_hurd_id.lock);
   err = _hurd_check_ids ();
 
@@ -100,6 +107,7 @@ _S_del_auth (mach_port_t me,
 
       err = __USEPORT (AUTH, __auth_makeauth
                       (port,
+                       NULL, 0, MACH_MSG_TYPE_COPY_SEND,
                        newu, nu,
                        _hurd_id.aux.uids, _hurd_id.aux.nuids,
                        newg, ng,
@@ -107,11 +115,12 @@ _S_del_auth (mach_port_t me,
                        &newauth));
     }
   __mutex_unlock (&_hurd_id.lock);
+  HURD_CRITICAL_END;
 
   if (err)
     return err;
 
-  err = __setauth (newauth);   /* XXX clobbers errno */
+  err = __setauth (newauth);
   __mach_port_deallocate (__mach_task_self (), newauth);
   if (err)
     return errno;