mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-14 02:22:03 +08:00
when combining multiple auth methods as primary, combine the name as well
This commit is contained in:
+16
-5
@@ -473,9 +473,14 @@ static void figure_auth_funcs(struct cfg_st *config, char **auth, unsigned auth_
|
|||||||
if (config->auth[0].amod == NULL)
|
if (config->auth[0].amod == NULL)
|
||||||
config->auth[0].amod = avail_auth_types[i].mod;
|
config->auth[0].amod = avail_auth_types[i].mod;
|
||||||
config->auth[0].type |= avail_auth_types[i].type;
|
config->auth[0].type |= avail_auth_types[i].type;
|
||||||
if (config->auth[0].name == NULL)
|
if (config->auth[0].name == NULL) {
|
||||||
config->auth[0].name = avail_auth_types[i].name;
|
config->auth[0].name = talloc_strdup(config, avail_auth_types[i].name);
|
||||||
fprintf(stderr, "Setting '%s' as primary authentication method\n", avail_auth_types[i].name);
|
} else {
|
||||||
|
char *tmp;
|
||||||
|
tmp = talloc_asprintf(config, "%s+%s", config->auth[0].name, avail_auth_types[i].name);
|
||||||
|
talloc_free(config->auth[0].name);
|
||||||
|
config->auth[0].name = tmp;
|
||||||
|
}
|
||||||
config->auth[0].enabled = 1;
|
config->auth[0].enabled = 1;
|
||||||
config->auth_methods = 1;
|
config->auth_methods = 1;
|
||||||
found = 1;
|
found = 1;
|
||||||
@@ -487,6 +492,7 @@ static void figure_auth_funcs(struct cfg_st *config, char **auth, unsigned auth_
|
|||||||
fprintf(stderr, "Unknown or unsupported auth method: %s\n", auth[j]);
|
fprintf(stderr, "Unknown or unsupported auth method: %s\n", auth[j]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr, "Setting '%s' as primary authentication method\n", config->auth[0].name);
|
||||||
talloc_free(auth[j]);
|
talloc_free(auth[j]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -499,8 +505,7 @@ static void figure_auth_funcs(struct cfg_st *config, char **auth, unsigned auth_
|
|||||||
if (avail_auth_types[i].get_brackets_string)
|
if (avail_auth_types[i].get_brackets_string)
|
||||||
config->auth[x].additional = avail_auth_types[i].get_brackets_string(config, auth[j]+avail_auth_types[i].name_size);
|
config->auth[x].additional = avail_auth_types[i].get_brackets_string(config, auth[j]+avail_auth_types[i].name_size);
|
||||||
|
|
||||||
if (config->auth[x].name == NULL)
|
config->auth[x].name = talloc_strdup(config, avail_auth_types[i].name);
|
||||||
config->auth[x].name = avail_auth_types[i].name;
|
|
||||||
fprintf(stderr, "Enabling '%s' as authentication method\n", avail_auth_types[i].name);
|
fprintf(stderr, "Enabling '%s' as authentication method\n", avail_auth_types[i].name);
|
||||||
|
|
||||||
config->auth[x].amod = avail_auth_types[i].mod;
|
config->auth[x].amod = avail_auth_types[i].mod;
|
||||||
@@ -641,8 +646,10 @@ unsigned prefix = 0, auto_select_group = 0;
|
|||||||
unsigned prefix4 = 0;
|
unsigned prefix4 = 0;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
unsigned force_cert_auth;
|
unsigned force_cert_auth;
|
||||||
|
#ifdef HAVE_GSSAPI
|
||||||
char **urlfw = NULL;
|
char **urlfw = NULL;
|
||||||
unsigned urlfw_size = 0;
|
unsigned urlfw_size = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
pov = configFileLoad(file);
|
pov = configFileLoad(file);
|
||||||
if (pov == NULL && file != NULL && strcmp(file, DEFAULT_CFG_FILE) == 0)
|
if (pov == NULL && file != NULL && strcmp(file, DEFAULT_CFG_FILE) == 0)
|
||||||
@@ -1114,6 +1121,10 @@ unsigned i;
|
|||||||
DEL(config->disconnect_script);
|
DEL(config->disconnect_script);
|
||||||
DEL(config->proxy_url);
|
DEL(config->proxy_url);
|
||||||
|
|
||||||
|
for (i=0;i<config->auth_methods;i++) {
|
||||||
|
if (config->auth[i].enabled)
|
||||||
|
talloc_free(config->auth[i].name);
|
||||||
|
}
|
||||||
#ifdef HAVE_GSSAPI
|
#ifdef HAVE_GSSAPI
|
||||||
for (i=0;i<config->kkdcp_size;i++) {
|
for (i=0;i<config->kkdcp_size;i++) {
|
||||||
unsigned j;
|
unsigned j;
|
||||||
|
|||||||
+1
-2
@@ -525,7 +525,7 @@ int set_module(sec_mod_st * sec, client_entry_st *e, unsigned auth_type)
|
|||||||
e->module = sec->config->auth[i].amod;
|
e->module = sec->config->auth[i].amod;
|
||||||
e->auth_type = sec->config->auth[i].type;
|
e->auth_type = sec->config->auth[i].type;
|
||||||
|
|
||||||
seclog(sec, LOG_INFO, "using '%s' authentication to authenticate user (%x)", sec->config->auth[i].name, auth_type);
|
seclog(sec, LOG_INFO, "using '%s' authentication to authenticate user (session: %s)", sec->config->auth[i].name, e->printable_sid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -579,7 +579,6 @@ int handle_sec_auth_init(int cfd, sec_mod_st * sec, const SecAuthInitMsg * req)
|
|||||||
}
|
}
|
||||||
e->groupname[sizeof(e->groupname) - 1] = 0;
|
e->groupname[sizeof(e->groupname) - 1] = 0;
|
||||||
|
|
||||||
/* a module is allowed to change the name of the user */
|
|
||||||
if (req->user_name != NULL) {
|
if (req->user_name != NULL) {
|
||||||
strlcpy(e->username, req->user_name, sizeof(e->username));
|
strlcpy(e->username, req->user_name, sizeof(e->username));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ struct vpn_st {
|
|||||||
#define MAX_KRB_REALMS 16
|
#define MAX_KRB_REALMS 16
|
||||||
|
|
||||||
typedef struct auth_struct_st {
|
typedef struct auth_struct_st {
|
||||||
const char *name;
|
char *name;
|
||||||
char *additional;
|
char *additional;
|
||||||
unsigned type;
|
unsigned type;
|
||||||
const struct auth_mod_st *amod;
|
const struct auth_mod_st *amod;
|
||||||
|
|||||||
Reference in New Issue
Block a user