vici: Return authentication rounds with unique names
To simplify handling of authentication rounds in dictionaries/hashtables on the client side, we assign unique names to each authentication round when listing connection.
This commit is contained in:
parent
d1ad65f7b2
commit
94bb26fae3
|
@ -508,11 +508,14 @@ static void build_auth_cfgs(peer_cfg_t *peer_cfg, bool local, vici_builder_t *b)
|
||||||
certificate_t *cert;
|
certificate_t *cert;
|
||||||
char *str;
|
char *str;
|
||||||
} v;
|
} v;
|
||||||
|
char buf[32];
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
enumerator = peer_cfg->create_auth_cfg_enumerator(peer_cfg, local);
|
enumerator = peer_cfg->create_auth_cfg_enumerator(peer_cfg, local);
|
||||||
while (enumerator->enumerate(enumerator, &auth))
|
while (enumerator->enumerate(enumerator, &auth))
|
||||||
{
|
{
|
||||||
b->begin_section(b, local ? "local" : "remote");
|
snprintf(buf, sizeof(buf), "%s-%d", local ? "local" : "remote", ++i);
|
||||||
|
b->begin_section(b, buf);
|
||||||
|
|
||||||
rules = auth->create_enumerator(auth);
|
rules = auth->create_enumerator(auth);
|
||||||
while (rules->enumerate(rules, &rule, &v))
|
while (rules->enumerate(rules, &rule, &v))
|
||||||
|
|
|
@ -103,7 +103,7 @@ CALLBACK(conn_sn, int,
|
||||||
{
|
{
|
||||||
return vici_parse_cb(res, children_sn, NULL, NULL, NULL);
|
return vici_parse_cb(res, children_sn, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
if (streq(name, "local") || streq(name, "remote"))
|
if (strpfx(name, "local") || strpfx(name, "remote"))
|
||||||
{
|
{
|
||||||
hashtable_t *auth;
|
hashtable_t *auth;
|
||||||
|
|
||||||
|
@ -112,7 +112,8 @@ CALLBACK(conn_sn, int,
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
printf(" %s %s authentication:\n",
|
printf(" %s %s authentication:\n",
|
||||||
name, auth->get(auth, "class") ?: "unspecified");
|
strpfx(name, "local") ? "local" : "remote",
|
||||||
|
auth->get(auth, "class") ?: "unspecified");
|
||||||
if (auth->get(auth, "id"))
|
if (auth->get(auth, "id"))
|
||||||
{
|
{
|
||||||
printf(" id: %s\n", auth->get(auth, "id"));
|
printf(" id: %s\n", auth->get(auth, "id"));
|
||||||
|
|
Loading…
Reference in New Issue