Macros | Functions
setuid.c File Reference

Change the user ID after Tor has started (Unix only) More...

#include "orconfig.h"
#include "lib/process/setuid.h"
#include "lib/container/smartlist.h"
#include "lib/fs/userdb.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include <errno.h>
#include <string.h>

Go to the source code of this file.




static int log_credential_status (void)
int have_capability_support (void)
int switch_id (const char *user, const unsigned flags)

Detailed Description

Change the user ID after Tor has started (Unix only)

Definition in file setuid.c.

Function Documentation

◆ have_capability_support()

int have_capability_support ( void  )

Return true iff we were compiled with capability support, and capabilities seem to work.

Definition at line 149 of file setuid.c.

◆ log_credential_status()

static int log_credential_status ( void  )

Log details of current user and group credentials. Return 0 on success. Logs and return -1 on failure.

Log level to use when describing non-error UID/GID status.

Definition at line 51 of file setuid.c.

Referenced by switch_id().

◆ switch_id()

int switch_id ( const char *  user,
const unsigned  flags 

Call setuid and setgid to run as user and switch to their primary group. Return 0 on success. On failure, log and return -1.

If SWITCH_ID_KEEP_BINDLOW is set in 'flags', try to use the capability system to retain the abilitity to bind low ports.

If SWITCH_ID_WARN_IF_NO_CAPS is set in flags, also warn if we have don't have capability support.

Definition at line 230 of file setuid.c.