Tor
0.4.7.0-alpha-dev
|
Access the POSIX user database. More...
#include "lib/fs/userdb.h"
#include "lib/malloc/malloc.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
#include <pwd.h>
#include <stddef.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | tor_passwd_free(pw) FREE_AND_NULL(struct passwd, tor_passwd_free_, (pw)) |
Functions | |
static struct passwd * | tor_passwd_dup (const struct passwd *pw) |
static void | tor_passwd_free_ (struct passwd *pw) |
const struct passwd * | tor_getpwnam (const char *username) |
const struct passwd * | tor_getpwuid (uid_t uid) |
char * | get_user_homedir (const char *username) |
Variables | |
static struct passwd * | passwd_cached = NULL |
Access the POSIX user database.
Definition in file userdb.c.
char* get_user_homedir | ( | const char * | username | ) |
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().
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.
|
static |
|
static |
|
static |
Cached struct from the last getpwname() call we did successfully.
Definition at line 24 of file userdb.c.
Referenced by tor_getpwuid().