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)
 
void platform_user_set (const struct platform_state_user *state)
 
bool platform_group_get (const char *groupname, struct platform_state_group *state)
 
void platform_group_set (const struct platform_state_group *state)
 
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)
 
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 141 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 442 of file platform.c.

Referenced by plugin_init_item().

◆ platform_access()

int platform_access ( const char *  path,
int  mode 
)

Definition at line 244 of file platform.c.

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

Referenced by check_file_access(), and platform_state_group_gid().

◆ platform_chdir()

int platform_chdir ( const char *  dir)

◆ platform_chroot()

void platform_chroot ( const char *  path)

Definition at line 45 of file platform.c.

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

Referenced by do_uid_gid_chroot(), and platform_state_group_gid().

◆ platform_create_temp_file()

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.

Definition at line 342 of file platform.c.

References get_random(), M_ERRNO, M_WARN, msg, openvpn_snprintf(), PACKAGE, platform_gen_path(), platform_open(), S_IRUSR, and S_IWUSR.

Referenced by auth_set_client_reason(), init_static(), multi_connection_established(), tls_crypt_v2_verify_metadata(), verify_cert_export_cert(), and verify_user_pass_script().

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

◆ platform_group_get()

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

Definition at line 108 of file platform.c.

References CLEAR, M_ERR, M_FATAL, and msg.

Referenced by do_init_first_time(), man_settings_init(), and open_null().

◆ platform_group_set()

void platform_group_set ( const struct platform_state_group state)

Definition at line 130 of file platform.c.

References M_ERR, M_INFO, and msg.

Referenced by do_uid_gid_chroot().

◆ platform_mlockall()

void platform_mlockall ( bool  print_msg)

Definition at line 193 of file platform.c.

References M_ERRNO, M_INFO, M_WARN, and msg.

Referenced by do_genkey(), init_instance(), and platform_state_group_gid().

◆ platform_nice()

void platform_nice ( int  niceval)

Definition at line 156 of file platform.c.

References M_ERRNO, M_INFO, M_WARN, and msg.

Referenced by do_init_first_time(), and platform_state_group_gid().

◆ platform_open()

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

◆ platform_putenv()

int platform_putenv ( char *  string)

◆ platform_sleep_milliseconds()

void platform_sleep_milliseconds ( unsigned int  n)

Definition at line 260 of file platform.c.

Referenced by platform_state_group_gid(), and x_check_status().

◆ platform_sleep_until_signal()

void platform_sleep_until_signal ( void  )

Definition at line 276 of file platform.c.

References ASSERT.

Referenced by platform_state_group_gid().

◆ platform_stat()

int platform_stat ( const char *  path,
platform_stat_t buf 
)

Definition at line 328 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

◆ platform_state_user_uid()

static int platform_state_user_uid ( const struct platform_state_user s)
inlinestatic

Definition at line 89 of file platform.h.

Referenced by man_settings_init().

◆ platform_system_ok()

bool platform_system_ok ( int  stat)

Definition at line 234 of file platform.c.

Referenced by openvpn_execve_check(), and platform_state_group_gid().

◆ platform_test_file()

bool platform_test_file ( const char *  filename)

Return true if filename can be opened for read.

Definition at line 461 of file platform.c.

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

Referenced by multi_client_connect_post(), multi_connection_established(), 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 69 of file platform.c.

References CLEAR, M_ERR, M_FATAL, and msg.

Referenced by do_init_first_time(), man_settings_init(), and open_null().

◆ platform_user_set()

void platform_user_set ( const struct platform_state_user state)

Definition at line 91 of file platform.c.

References M_ERR, M_INFO, and msg.

Referenced by do_uid_gid_chroot().