|
OpenVPN
|
#include <stdio.h>#include <string.h>#include <unistd.h>#include <stdlib.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/wait.h>#include <fcntl.h>#include <signal.h>#include <syslog.h>#include <errno.h>#include <err.h>#include <openvpn-plugin.h>
Go to the source code of this file.
Data Structures | |
| struct | down_root_context |
Macros | |
| #define | DEBUG(verb) ((verb) >= 7) |
| #define | COMMAND_RUN_SCRIPT 1 |
| #define | COMMAND_EXIT 2 |
| #define | RESPONSE_INIT_SUCCEEDED 10 |
| #define | RESPONSE_INIT_FAILED 11 |
| #define | RESPONSE_SCRIPT_SUCCEEDED 12 |
| #define | RESPONSE_SCRIPT_FAILED 13 |
Functions | |
| static void | down_root_server (const int fd, char *const *argv, char *const *envp, const int verb) |
| static const char * | get_env (const char *name, const char *envp[]) |
| static size_t | string_array_len (const char *array[]) |
| static int | recv_control (int fd) |
| static ssize_t | send_control (int fd, int code) |
| static void | daemonize (const char *envp[]) |
| static void | close_fds_except (int keep) |
| static void | set_signals (void) |
| static void | free_context (struct down_root_context *context) |
| static int | run_script (char *const *argv, char *const *envp) |
| OPENVPN_EXPORT openvpn_plugin_handle_t | openvpn_plugin_open_v1 (unsigned int *type_mask, const char *argv[], const char *envp[]) |
| OPENVPN_EXPORT int | openvpn_plugin_func_v1 (openvpn_plugin_handle_t handle, const int type, const char *argv[], const char *envp[]) |
| OPENVPN_EXPORT void | openvpn_plugin_close_v1 (openvpn_plugin_handle_t handle) |
| OPENVPN_EXPORT void | openvpn_plugin_abort_v1 (openvpn_plugin_handle_t handle) |
| #define COMMAND_EXIT 2 |
Definition at line 51 of file down-root.c.
| #define COMMAND_RUN_SCRIPT 1 |
Definition at line 50 of file down-root.c.
| #define DEBUG | ( | verb | ) | ((verb) >= 7) |
Definition at line 47 of file down-root.c.
| #define RESPONSE_INIT_FAILED 11 |
Definition at line 55 of file down-root.c.
| #define RESPONSE_INIT_SUCCEEDED 10 |
Definition at line 54 of file down-root.c.
| #define RESPONSE_SCRIPT_FAILED 13 |
Definition at line 57 of file down-root.c.
| #define RESPONSE_SCRIPT_SUCCEEDED 12 |
Definition at line 56 of file down-root.c.
|
static |
|
static |
Definition at line 163 of file down-root.c.
References daemon(), and get_env().
Referenced by openvpn_plugin_func_v1(), and openvpn_plugin_open_v3().
|
static |
Definition at line 494 of file down-root.c.
References COMMAND_EXIT, COMMAND_RUN_SCRIPT, DEBUG, recv_control(), RESPONSE_INIT_SUCCEEDED, RESPONSE_SCRIPT_FAILED, RESPONSE_SCRIPT_SUCCEEDED, run_script(), send_control(), and down_root_context::verb.
Referenced by openvpn_plugin_func_v1().
|
static |
Definition at line 235 of file down-root.c.
Referenced by openvpn_plugin_close_v1(), and openvpn_plugin_open_v1().
|
static |
Definition at line 86 of file down-root.c.
References i.
Referenced by daemonize(), and openvpn_plugin_open_v1().
| OPENVPN_EXPORT void openvpn_plugin_abort_v1 | ( | openvpn_plugin_handle_t | handle | ) |
Definition at line 477 of file down-root.c.
References COMMAND_EXIT, and send_control().
| OPENVPN_EXPORT void openvpn_plugin_close_v1 | ( | openvpn_plugin_handle_t | handle | ) |
Definition at line 446 of file down-root.c.
References COMMAND_EXIT, DEBUG, free_context(), and send_control().
| OPENVPN_EXPORT int openvpn_plugin_func_v1 | ( | openvpn_plugin_handle_t | handle, |
| const int | type, | ||
| const char * | argv[], | ||
| const char * | envp[] | ||
| ) |
Definition at line 345 of file down-root.c.
References close_fds_except(), COMMAND_RUN_SCRIPT, daemonize(), down_root_server(), recv_control(), RESPONSE_INIT_SUCCEEDED, RESPONSE_SCRIPT_SUCCEEDED, send_control(), set_signals(), and status.
| OPENVPN_EXPORT openvpn_plugin_handle_t openvpn_plugin_open_v1 | ( | unsigned int * | type_mask, |
| const char * | argv[], | ||
| const char * | envp[] | ||
| ) |
Definition at line 280 of file down-root.c.
References free_context(), get_env(), i, and string_array_len().
|
static |
Definition at line 128 of file down-root.c.
References read.
Referenced by down_root_server(), and openvpn_plugin_func_v1().
|
static |
Definition at line 249 of file down-root.c.
Referenced by down_root_server().
|
static |
Definition at line 143 of file down-root.c.
References write.
Referenced by down_root_server(), openvpn_plugin_abort_v1(), openvpn_plugin_close_v1(), and openvpn_plugin_func_v1().
|
static |
Definition at line 222 of file down-root.c.
Referenced by openvpn_plugin_func_v1().
|
static |