mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 16:57:00 +08:00
added sanity checks in auth methods
This commit is contained in:
@@ -44,11 +44,12 @@ static void acct_radius_global_init(void *pool, const char *server_name, void *a
|
||||
{
|
||||
radius_cfg_st *config = additional;
|
||||
|
||||
if (config == NULL)
|
||||
goto fail;
|
||||
|
||||
rh = rc_read_config(config->config);
|
||||
if (rh == NULL) {
|
||||
fprintf(stderr, "radius initialization error\n");
|
||||
exit(1);
|
||||
}
|
||||
if (rh == NULL)
|
||||
goto fail;
|
||||
|
||||
if (server_name)
|
||||
strlcpy(nas_identifier, server_name, sizeof(nas_identifier));
|
||||
@@ -61,6 +62,10 @@ static void acct_radius_global_init(void *pool, const char *server_name, void *a
|
||||
}
|
||||
|
||||
return;
|
||||
fail:
|
||||
fprintf(stderr, "radius acct initialization error\n");
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
static void acct_radius_global_deinit(void)
|
||||
|
||||
@@ -345,7 +345,8 @@ static void pam_group_list(void *pool, void *_additional, char ***groupname, uns
|
||||
struct pam_cfg_st *config = _additional;
|
||||
gid_t min = 0;
|
||||
|
||||
min = config->gid_min;
|
||||
if (config)
|
||||
min = config->gid_min;
|
||||
|
||||
setgrent();
|
||||
|
||||
|
||||
@@ -53,9 +53,14 @@ static void plain_global_init(void *pool, const char *server_name, void *additio
|
||||
{
|
||||
struct plain_cfg_st *config = additional;
|
||||
|
||||
if (config == NULL) {
|
||||
fprintf(stderr, "plain: no configuration passed!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
password_file = talloc_strdup(pool, config->passwd);
|
||||
if (password_file == NULL) {
|
||||
fprintf(stderr, "memory error\n");
|
||||
fprintf(stderr, "plain: memory error\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,10 +45,12 @@ static void radius_global_init(void *pool, const char *server_name, void *additi
|
||||
{
|
||||
radius_cfg_st *config = additional;
|
||||
|
||||
if (config == NULL)
|
||||
goto fail;
|
||||
|
||||
rh = rc_read_config(config->config);
|
||||
if (rh == NULL) {
|
||||
fprintf(stderr, "radius initialization error\n");
|
||||
exit(1);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (config->nas_identifier) {
|
||||
@@ -66,6 +68,9 @@ static void radius_global_init(void *pool, const char *server_name, void *additi
|
||||
}
|
||||
|
||||
return;
|
||||
fail:
|
||||
fprintf(stderr, "radius initialization error\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void radius_global_deinit()
|
||||
|
||||
Reference in New Issue
Block a user