Back to index

glibc  2.9
Functions
seteuids.c File Reference
#include <hurd.h>
#include <hurd/id.h>

Go to the source code of this file.

Functions

int seteuids (int n, const uid_t *uids)

Function Documentation

int seteuids ( int  n,
const uid_t uids 
)

Definition at line 24 of file seteuids.c.

{
  error_t err;
  auth_t newauth;
  int i;
  gid_t new[n];

  /* Fault before taking locks.  */
  for (i = 0; i < n; ++i)
    new[i] = uids[i];

  HURD_CRITICAL_BEGIN;
  __mutex_lock (&_hurd_id.lock);
  err = _hurd_check_ids ();
  if (! err)
    {
      /* Get a new auth port using those IDs.  */
      err = __USEPORT (AUTH,
                     __auth_makeauth (port, NULL, 0, 0,
                                   new, n,
                                   _hurd_id.aux.uids, _hurd_id.aux.nuids,
                                   _hurd_id.gen.gids, _hurd_id.gen.ngids,
                                   _hurd_id.aux.gids, _hurd_id.aux.ngids,
                                   &newauth));
    }
  __mutex_unlock (&_hurd_id.lock);
  HURD_CRITICAL_END;

  if (err)
    return __hurd_fail (err);

  /* Install the new auth port and reauthenticate everything.  */
  err = __setauth (newauth);
  __mach_port_deallocate (__mach_task_self (), newauth);
  return err;
}

Here is the call graph for this function: