mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-14 02:22:03 +08:00
HUP signal reloads configuration
This commit is contained in:
+37
-1
@@ -34,6 +34,7 @@
|
||||
#define DEFAULT_CFG_FILE "/etc/ocserv.conf"
|
||||
|
||||
static void write_pid_file(const char* pid_file);
|
||||
static const char* cfg_file = DEFAULT_CFG_FILE;
|
||||
|
||||
#define MAX_ENTRIES 64
|
||||
|
||||
@@ -233,7 +234,6 @@ static void check_cfg( struct cfg_st *config)
|
||||
|
||||
int cmd_parser (int argc, char **argv, struct cfg_st* config)
|
||||
{
|
||||
const char* cfg_file = DEFAULT_CFG_FILE;
|
||||
|
||||
memset(config, 0, sizeof(*config));
|
||||
|
||||
@@ -263,6 +263,42 @@ int cmd_parser (int argc, char **argv, struct cfg_st* config)
|
||||
|
||||
}
|
||||
|
||||
#define DEL(x) free(x);x=NULL
|
||||
void reload_cfg_file(struct cfg_st* config)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
DEL(config->name);
|
||||
DEL(config->cert);
|
||||
DEL(config->key);
|
||||
DEL(config->ca);
|
||||
DEL(config->crl);
|
||||
DEL(config->cert_user_oid);
|
||||
DEL(config->priorities);
|
||||
DEL(config->chroot_dir);
|
||||
DEL(config->cookie_db_name);
|
||||
DEL(config->connect_script);
|
||||
DEL(config->disconnect_script);
|
||||
|
||||
DEL(config->network.name);
|
||||
DEL(config->network.ipv4);
|
||||
DEL(config->network.ipv4_netmask);
|
||||
DEL(config->network.ipv4_dns);
|
||||
DEL(config->network.ipv6);
|
||||
DEL(config->network.ipv6_netmask);
|
||||
DEL(config->network.ipv6_dns);
|
||||
for (i=0;i<config->network.routes_size;i++)
|
||||
DEL(config->network.routes[i]);
|
||||
DEL(config->network.routes);
|
||||
memset(config, 0, sizeof(*config));
|
||||
|
||||
parse_cfg_file(cfg_file, config);
|
||||
|
||||
check_cfg(config);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void write_pid_file(const char* pid_file)
|
||||
{
|
||||
FILE* fp;
|
||||
|
||||
Reference in New Issue
Block a user