OpenVPN
Data Structures | Typedefs | Functions
platform.h File Reference
#include "basic.h"
#include "buffer.h"
Include dependency graph for platform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  platform_state_user
 
struct  platform_state_group
 

Typedefs

typedef struct _stat platform_stat_t
 

Functions

bool platform_user_get (const char *username, struct platform_state_user *state)
 
bool platform_group_get (const char *groupname, struct platform_state_group *state)
 
void platform_user_group_set (const struct platform_state_user *user_state, const struct platform_state_group *group_state, struct context *c)
 
static int platform_state_user_uid (const struct platform_state_user *s)
 
static int platform_state_group_gid (const struct platform_state_group *s)
 
void platform_chroot (const char *path)
 
void platform_nice (int niceval)
 
unsigned int platform_getpid (void)
 
void platform_mlockall (bool print_msg)
 
int platform_chdir (const char *dir)
 
bool platform_system_ok (int stat)
 interpret the status code returned by execve() More...
 
int platform_ret_code (int stat)
 Return an exit code if valid and between 0 and 255, -1 otherwise. More...
 
int platform_access (const char *path, int mode)
 
void platform_sleep_milliseconds (unsigned int n)
 
void platform_sleep_until_signal (void)
 
bool platform_unlink (const char *filename)
 
int platform_putenv (char *string)
 
FILE * platform_fopen (const char *path, const char *mode)
 
int platform_open (const char *path, int flags, int mode)
 
int platform_stat (const char *path, platform_stat_t *buf)
 
const char * platform_create_temp_file (const char *directory, const char *prefix, struct gc_arena *gc)
 Create a temporary file in directory, returns the filename of the created file. More...
 
const char * platform_gen_path (const char *directory, const char *filename, struct gc_arena *gc)
 Put a directory and filename together. More...
 
bool platform_absolute_pathname (const char *pathname)
 Return true if pathname is absolute. More...
 
bool platform_test_file (const char *filename)
 Return true if filename can be opened for read. More...
 

Typedef Documentation

◆ platform_stat_t

typedef struct _stat platform_stat_t

Definition at line 146 of file platform.h.

Function Documentation

◆ platform_absolute_pathname()

bool platform_absolute_pathname ( const char *  pathname)

Return true if pathname is absolute.

Definition at line 654 of file platform.c.

Referenced by plugin_init_item().

◆ platform_access()

int platform_access ( const char *  path,
int  mode 
)

Definition at line 458 of file platform.c.

References gc_free(), gc_new(), and wide_string().

Referenced by check_file_access().

◆ platform_chdir()

int platform_chdir ( const char *  dir)

Definition at line 393 of file platform.c.

References gc_free(), gc_new(), and wide_string().

Referenced by add_option(), do_init_first_time(), and platform_chroot().

◆ platform_chroot()

void platform_chroot ( const char *  path)

Definition at line 55 of file platform.c.

References M_ERR, M_FATAL, M_INFO, msg, and platform_chdir().

Referenced by do_uid_gid_chroot().

◆ platform_create_temp_file()

const char* platform_create_temp_file ( const char *  directory,
const char *  prefix,
struct gc_arena gc 
)

◆ platform_fopen()

FILE* platform_fopen ( const char *  path,
const char *  mode 
)

◆ platform_gen_path()

const char* platform_gen_path ( const char *  directory,
const char *  filename,
struct gc_arena gc 
)

◆ platform_getpid()

unsigned int platform_getpid ( void  )

Definition at line 333 of file platform.c.

Referenced by man_dispatch_command(), setenv_settings(), and write_pid_file().

◆ platform_group_get()

bool platform_group_get ( const char *  groupname,
struct platform_state_group state 
)

Definition at line 123 of file platform.c.

References CLEAR, M_ERR, M_FATAL, and msg.

Referenced by do_init_first_time(), and man_settings_init().

◆ platform_mlockall()

void platform_mlockall ( bool  print_msg)

Definition at line 344 of file platform.c.

References M_ERRNO, M_FATAL, M_INFO, M_WARN, and msg.

Referenced by do_genkey(), and init_instance().

◆ platform_nice()

void platform_nice ( int  niceval)

Definition at line 311 of file platform.c.

References M_ERRNO, M_INFO, M_WARN, and msg.

Referenced by do_init_first_time().

◆ platform_open()

int platform_open ( const char *  path,
int  flags,
int  mode 
)

◆ platform_putenv()

int platform_putenv ( char *  string)

◆ platform_ret_code()

int platform_ret_code ( int  stat)

Return an exit code if valid and between 0 and 255, -1 otherwise.

Definition at line 425 of file platform.c.

Referenced by openvpn_execve_check().

◆ platform_sleep_milliseconds()

void platform_sleep_milliseconds ( unsigned int  n)

Definition at line 474 of file platform.c.

Referenced by x_check_status().

◆ platform_sleep_until_signal()

void platform_sleep_until_signal ( void  )

Definition at line 490 of file platform.c.

References ASSERT.

◆ platform_stat()

int platform_stat ( const char *  path,
platform_stat_t buf 
)

Definition at line 540 of file platform.c.

References gc_free(), gc_new(), and wide_string().

Referenced by buffer_read_from_file(), check_file_access(), and tls_ctx_reload_crl().

◆ platform_state_group_gid()

static int platform_state_group_gid ( const struct platform_state_group s)
inlinestatic

Definition at line 106 of file platform.h.

Referenced by man_settings_init().

◆ platform_state_user_uid()

static int platform_state_user_uid ( const struct platform_state_user s)
inlinestatic

Definition at line 97 of file platform.h.

Referenced by man_settings_init().

◆ platform_system_ok()

bool platform_system_ok ( int  stat)

interpret the status code returned by execve()

Definition at line 414 of file platform.c.

Referenced by openvpn_execve_check().

◆ platform_test_file()

bool platform_test_file ( const char *  filename)

Return true if filename can be opened for read.

Definition at line 673 of file platform.c.

References D_TEST_FILE, dmsg, M_ERRNO, M_WARN, msg, and platform_fopen().

Referenced by multi_client_connect_post(), multi_client_connect_source_ccd(), and verify_final_auth_checks().

◆ platform_unlink()

bool platform_unlink ( const char *  filename)

◆ platform_user_get()

bool platform_user_get ( const char *  username,
struct platform_state_user state 
)

Definition at line 79 of file platform.c.

References CLEAR, M_ERR, M_FATAL, and msg.

Referenced by do_init_first_time(), and man_settings_init().

◆ platform_user_group_set()

void platform_user_group_set ( const struct platform_state_user user_state,
const struct platform_state_group group_state,
struct context c 
)