mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-14 02:22:03 +08:00
Fail if authentication modules are changed on reload
This commit is contained in:
+15
-6
@@ -1157,7 +1157,6 @@ void reload_cfg_file(void *pool, struct cfg_st* config)
|
||||
|
||||
/* authentication methods can't change on reload */
|
||||
memcpy(bak, config->auth, sizeof(config->auth));
|
||||
memset(config->auth, 0, sizeof(config->auth));
|
||||
bak_size = config->auth_methods;
|
||||
|
||||
clear_cfg_file(config);
|
||||
@@ -1166,17 +1165,27 @@ void reload_cfg_file(void *pool, struct cfg_st* config)
|
||||
|
||||
parse_cfg_file(cfg_file, config, 1);
|
||||
|
||||
/* reset the auth methods */
|
||||
/* check if the authentication methods remained the same */
|
||||
if (config->auth_methods != bak_size) {
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
for (i=0;i<config->auth_methods;i++) {
|
||||
if (config->auth[i].enabled)
|
||||
DEL(config->auth[i].additional);
|
||||
if (config->auth[i].enabled != bak[i].enabled) {
|
||||
goto auth_fail;
|
||||
}
|
||||
|
||||
if (config->auth[i].type != bak[i].type) {
|
||||
goto auth_fail;
|
||||
}
|
||||
}
|
||||
memcpy(config->auth, bak, sizeof(config->auth));
|
||||
config->auth_methods = bak_size;
|
||||
|
||||
check_cfg(config);
|
||||
|
||||
return;
|
||||
auth_fail:
|
||||
syslog(LOG_ERR, "you cannot switch authentication methods on reload");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void write_pid_file(void)
|
||||
|
||||
Reference in New Issue
Block a user