Skip to content

Commit

Permalink
fix uninitialised cookieonly var, add 'printcookie' option
Browse files Browse the repository at this point in the history
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 2, 2008
1 parent 077d4ed commit bb52891
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.c
Expand Up @@ -54,6 +54,7 @@ static struct option long_options[] = {
{"cafile", 1, 0, '0'},
{"no-dtls", 0, 0, '1'},
{"cookieonly", 0, 0, '2'},
{"printcookie", 0, 0, '3'},
{"xmlconfig", 1, 0, 'x'},
};

Expand All @@ -76,6 +77,7 @@ void usage(void)
printf(" -v, --verbose More output\n");
printf(" -x, --xmlconfig=CONFIG XML config file\n");
printf(" --fetchcookie 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");
printf(" --no-dtls Disable DTLS\n");
exit(1);
Expand All @@ -85,7 +87,7 @@ int main(int argc, char **argv)
{
struct anyconnect_info *vpninfo;
struct utsname utsbuf;
int cookieonly;
int cookieonly = 0;
int opt;

vpn_init_openssl();
Expand Down Expand Up @@ -129,6 +131,9 @@ int main(int argc, char **argv)
case '2':
cookieonly = 1;
break;
case '3':
cookieonly = 2;
break;
case 'C':
vpninfo->cookie = optarg;
break;
Expand Down Expand Up @@ -211,7 +216,9 @@ int main(int argc, char **argv)

if (cookieonly) {
printf("%s\n", vpninfo->cookie);
exit(0);
if (cookieonly == 1)
/* We use cookieonly=2 for 'print it and continue' */
exit(0);
}

if (make_ssl_connection(vpninfo)) {
Expand Down

0 comments on commit bb52891

Please sign in to comment.