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) |
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) |
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 148 of file platform.h.
bool platform_absolute_pathname | ( | const char * | pathname | ) |
Return true if pathname is absolute.
Definition at line 503 of file platform.c.
Referenced by plugin_init_item().
int platform_access | ( | const char * | path, |
int | mode | ||
) |
Definition at line 307 of file platform.c.
References gc_free(), gc_new(), wide_string(), and X_OK.
Referenced by check_file_access(), and platform_state_group_gid().
int platform_chdir | ( | const char * | dir | ) |
Definition at line 242 of file platform.c.
References gc_free(), gc_new(), and wide_string().
Referenced by add_option(), do_init_first_time(), platform_chroot(), and platform_state_group_gid().
void platform_chroot | ( | const char * | path | ) |
Definition at line 49 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().
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 403 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 ccs_gen_config_file(), ccs_gen_deferred_ret_file(), init_static(), key_state_gen_auth_control_files(), tls_crypt_v2_verify_metadata(), verify_cert_export_cert(), and verify_user_pass_script().
FILE* platform_fopen | ( | const char * | path, |
const char * | mode | ||
) |
Definition at line 363 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(), man_record_peer_info(), platform_state_group_gid(), 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 456 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 182 of file platform.c.
Referenced by man_dispatch_command(), platform_state_group_gid(), setenv_settings(), and write_pid_file().
bool platform_group_get | ( | const char * | groupname, |
struct platform_state_group * | state | ||
) |
Definition at line 112 of file platform.c.
References CLEAR, M_ERR, M_FATAL, and msg.
Referenced by do_init_first_time(), man_settings_init(), and open_null().
void platform_group_set | ( | const struct platform_state_group * | state | ) |
Definition at line 134 of file platform.c.
References M_ERR, M_INFO, and msg.
Referenced by do_uid_gid_chroot().
void platform_mlockall | ( | bool | print_msg | ) |
Definition at line 193 of file platform.c.
References M_ERRNO, M_FATAL, M_INFO, M_WARN, and msg.
Referenced by do_genkey(), init_instance(), and platform_state_group_gid().
void platform_nice | ( | int | niceval | ) |
Definition at line 160 of file platform.c.
References M_ERRNO, M_INFO, M_WARN, and msg.
Referenced by do_init_first_time(), and platform_state_group_gid().
int platform_open | ( | const char * | path, |
int | flags, | ||
int | mode | ||
) |
Definition at line 376 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(), platform_state_group_gid(), status_open(), and verify_check_crl_dir().
int platform_putenv | ( | char * | string | ) |
Referenced by platform_state_group_gid().
int platform_ret_code | ( | int | stat | ) |
Return an exit code if valid and between 0 and 255, -1 otherwise.
Definition at line 274 of file platform.c.
References platform_ret_code(), and status.
Referenced by openvpn_execve_check(), platform_ret_code(), and platform_state_group_gid().
void platform_sleep_milliseconds | ( | unsigned int | n | ) |
Definition at line 323 of file platform.c.
Referenced by platform_state_group_gid(), and x_check_status().
void platform_sleep_until_signal | ( | void | ) |
Definition at line 339 of file platform.c.
References ASSERT.
Referenced by platform_state_group_gid().
int platform_stat | ( | const char * | path, |
platform_stat_t * | buf | ||
) |
Definition at line 389 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 105 of file platform.h.
References flags, platform_access(), platform_chdir(), platform_chroot(), platform_fopen(), platform_getpid(), platform_mlockall(), platform_nice(), platform_open(), platform_putenv(), platform_ret_code(), platform_sleep_milliseconds(), platform_sleep_until_signal(), platform_system_ok(), and platform_unlink().
Referenced by man_settings_init().
|
inlinestatic |
Definition at line 93 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 263 of file platform.c.
Referenced by openvpn_execve_check(), and platform_state_group_gid().
bool platform_test_file | ( | const char * | filename | ) |
Return true if filename can be opened for read.
Definition at line 522 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_client_connect_source_ccd(), and verify_final_auth_checks().
bool platform_unlink | ( | const char * | filename | ) |
Definition at line 350 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(), platform_state_group_gid(), remove_pid_file(), tls_crypt_v2_verify_metadata(), verify_cert_call_command(), verify_cert_export_cert(), and verify_user_pass_script().
bool platform_user_get | ( | const char * | username, |
struct platform_state_user * | state | ||
) |
Definition at line 73 of file platform.c.
References CLEAR, M_ERR, M_FATAL, and msg.
Referenced by do_init_first_time(), man_settings_init(), and open_null().
void platform_user_set | ( | const struct platform_state_user * | state | ) |
Definition at line 95 of file platform.c.
References M_ERR, M_INFO, and msg.
Referenced by do_uid_gid_chroot().