Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow auth group selection to be set on command line
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed May 7, 2009
1 parent 864b033 commit fc06ade
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions auth.c
Expand Up @@ -405,6 +405,25 @@ static int process_auth_form(struct openconnect_info *vpninfo,
if (!select_opt->nr_choices)
continue;

if (vpninfo->authgroup &&
!strcmp(opt->name, "group_list")) {
int i;
for (i = 0; i < select_opt->nr_choices; i++) {
choice = &select_opt->choices[i];

if (!strcmp(vpninfo->authgroup,
choice->label)) {
opt->value = choice->name;
break;
}
}
if (opt->value)
continue;

vpninfo->progress(vpninfo, PRG_ERR,
"Auth choice \"%s\" not available\n",
vpninfo->authgroup);
}
/* FIXME: Let the user choose */
choice = &select_opt->choices[select_opt->nr_choices-1];
opt->value = choice->name;
Expand Down
5 changes: 5 additions & 0 deletions main.c
Expand Up @@ -80,6 +80,7 @@ static struct option long_options[] = {
{"no-passwd", 0, 0, '6'},
{"reconnect-timeout", 1, 0, '7'},
{"dtls-ciphers", 1, 0, '8'},
{"authgroup", 1, 0, '9'},
{NULL, 0, 0, 0},
};

Expand Down Expand Up @@ -110,6 +111,7 @@ void usage(void)
printf(" -V, --version Report version number\n");
printf(" -v, --verbose More output\n");
printf(" -x, --xmlconfig=CONFIG XML config file\n");
printf(" --authgroup=GROUP Choose authentication login selection\n");
printf(" --cookieonly Fetch webvpn cookie only; don't connect\n");
printf(" --printcookie Print webvpn cookie before connecting\n");
printf(" --cafile=FILE Cert file for server verification\n");
Expand Down Expand Up @@ -214,6 +216,9 @@ int main(int argc, char **argv)
case '8':
vpninfo->dtls_ciphers = optarg;
break;
case '9':
vpninfo->authgroup = optarg;
break;
case 'b':
background = 1;
break;
Expand Down
7 changes: 7 additions & 0 deletions openconnect.8
Expand Up @@ -88,6 +88,10 @@ openconnect \- Connect to Cisco AnyConnect VPN
.I CONFIG
]
[
.B --authgroup
.I GROUP
]
[
.B --cookieonly
]
[
Expand Down Expand Up @@ -223,6 +227,9 @@ More output
.B -x,--xmlconfig=CONFIG
XML config file
.TP
.B --authgroup=GROUP
Choose authentication login selection
.TP
.B --cookieonly
Fetch webvpn cookie only; don't connect
.TP
Expand Down
1 change: 1 addition & 0 deletions openconnect.h
Expand Up @@ -142,6 +142,7 @@ struct openconnect_info {
char xmlsha1[(SHA_DIGEST_LENGTH * 2) + 1];
char *username;
char *password;
char *authgroup;
int nopasswd;
char *dtls_ciphers;

Expand Down

0 comments on commit fc06ade

Please sign in to comment.