Tor  0.4.7.0-alpha-dev
Functions
userdb.h File Reference

Header for userdb.c. More...

#include "orconfig.h"
#include <sys/types.h>

Go to the source code of this file.

Functions

const struct passwd * tor_getpwnam (const char *username)
 
const struct passwd * tor_getpwuid (uid_t uid)
 
char * get_user_homedir (const char *username)
 

Detailed Description

Header for userdb.c.

Definition in file userdb.h.

Function Documentation

◆ get_user_homedir()

char* get_user_homedir ( const char *  username)

Allocate and return a string containing the home directory for the user username. Only works on posix-like systems.

Definition at line 127 of file userdb.c.

◆ tor_getpwnam()

const struct passwd* tor_getpwnam ( const char *  username)

Wrapper around getpwnam() that caches result. Used so that we don't need to give the sandbox access to /etc/passwd.

The following fields alone will definitely be copied in the output: pw_uid, pw_gid, pw_name, pw_dir. Other fields are not present in cached values.

When called with a NULL argument, this function clears storage associated with static variables it uses.

Definition at line 70 of file userdb.c.

Referenced by get_user_homedir().

◆ tor_getpwuid()

const struct passwd* tor_getpwuid ( uid_t  uid)

Wrapper around getpwnam() that can use cached result from tor_getpwnam(). Used so that we don't need to give the sandbox access to /etc/passwd.

The following fields alone will definitely be copied in the output: pw_uid, pw_gid, pw_name, pw_dir. Other fields are not present in cached values.

Definition at line 106 of file userdb.c.