Tor  0.4.7.0-alpha-dev
Macros | Functions
setuid.h File Reference

Header for setuid.c. More...

Go to the source code of this file.

Macros

#define SWITCH_ID_KEEP_BINDLOW   (1<<0)
 
#define SWITCH_ID_WARN_IF_NO_CAPS   (1<<1)
 

Functions

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

Detailed Description

Header for setuid.c.

Definition in file setuid.h.

Macro Definition Documentation

◆ SWITCH_ID_KEEP_BINDLOW

#define SWITCH_ID_KEEP_BINDLOW   (1<<0)

Flag for switch_id; see switch_id() for documentation

Definition at line 17 of file setuid.h.

◆ SWITCH_ID_WARN_IF_NO_CAPS

#define SWITCH_ID_WARN_IF_NO_CAPS   (1<<1)

Flag for switch_id; see switch_id() for documentation

Definition at line 19 of file setuid.h.

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.

◆ 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.