OpenVPN
|
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 struct _stat platform_stat_t |
Definition at line 146 of file platform.h.
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().
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().
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().
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().
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 554 of file platform.c.
References get_random(), M_ERRNO, M_WARN, msg, PACKAGE, platform_gen_path(), and platform_open().
Referenced by ccs_gen_config_file(), ccs_gen_deferred_ret_file(), crypto_pem_encode_certificate(), init_static(), key_state_gen_auth_control_files(), tls_crypt_v2_verify_metadata(), verify_cert(), verify_crresponse_script(), and verify_user_pass_script().
FILE* platform_fopen | ( | const char * | path, |
const char * | mode | ||
) |
Definition at line 514 of file platform.c.
References http-client::f, gc_free(), gc_new(), and wide_string().
Referenced by buffer_list_file(), buffer_read_from_file(), get_user_pass_cr(), platform_test_file(), read_config_file(), tls_ctx_load_pkcs12(), and write_pid_file().
const char* platform_gen_path | ( | const char * | directory, |
const char * | filename, | ||
struct gc_arena * | gc | ||
) |
Put a directory and filename together.
Definition at line 607 of file platform.c.
References alloc_buf_gc(), BSTR, buf_printf(), CC_ASTERISK, CC_BACKSLASH, CC_COLON, CC_DOUBLE_QUOTE, CC_GREATER_THAN, CC_LESS_THAN, CC_PIPE, CC_PRINT, CC_QUESTION_MARK, CC_SLASH, PATH_SEPARATOR, string_mod_const(), and win_safe_filename().
Referenced by multi_client_connect_source_ccd(), platform_create_temp_file(), and verify_final_auth_checks().
unsigned int platform_getpid | ( | void | ) |
Definition at line 333 of file platform.c.
Referenced by man_dispatch_command(), setenv_settings(), and write_pid_file().
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().
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().
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().
int platform_open | ( | const char * | path, |
int | flags, | ||
int | mode | ||
) |
Definition at line 527 of file platform.c.
References gc_free(), gc_new(), and wide_string().
Referenced by buffer_write_file(), packet_id_persist_load(), platform_create_temp_file(), status_open(), and verify_check_crl_dir().
int platform_putenv | ( | char * | string | ) |
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().
void platform_sleep_milliseconds | ( | unsigned int | n | ) |
Definition at line 474 of file platform.c.
Referenced by x_check_status().
void platform_sleep_until_signal | ( | void | ) |
Definition at line 490 of file platform.c.
References ASSERT.
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().
|
inlinestatic |
Definition at line 106 of file platform.h.
Referenced by man_settings_init().
|
inlinestatic |
Definition at line 97 of file platform.h.
Referenced by man_settings_init().
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().
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().
bool platform_unlink | ( | const char * | filename | ) |
Definition at line 501 of file platform.c.
References gc_free(), gc_new(), and wide_string().
Referenced by ccs_delete_config_file(), ccs_delete_deferred_ret_file(), key_state_rm_auth_control_files(), key_state_rm_auth_pending_file(), remove_pid_file(), tls_crypt_v2_verify_metadata(), and verify_user_pass_script().
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().
void platform_user_group_set | ( | const struct platform_state_user * | user_state, |
const struct platform_state_group * | group_state, | ||
struct context * | c | ||
) |
Definition at line 217 of file platform.c.
References M_ERR, M_ERRNO, M_FATAL, M_INFO, M_NONFATAL, msg, need_keep_caps(), platform_group_set(), and platform_user_set().
Referenced by do_uid_gid_chroot().