Skip to content

Commit

Permalink
Add UserGroup option
Browse files Browse the repository at this point in the history
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Mar 31, 2009
1 parent 8bfafe2 commit 7e6fde6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
12 changes: 10 additions & 2 deletions main.c
Expand Up @@ -52,6 +52,7 @@ static struct option long_options[] = {
{"cookie", 1, 0, 'C'},
{"deflate", 0, 0, 'd'},
{"no-deflate", 0, 0, 'D'},
{"usergroup", 1, 0, 'g'},
{"help", 0, 0, 'h'},
{"interface", 1, 0, 'i'},
{"mtu", 1, 0, 'm'},
Expand Down Expand Up @@ -88,6 +89,7 @@ void usage(void)
printf(" --cookie-on-stdin Read cookie from standard input\n");
printf(" -d, --deflate Enable compression (default)\n");
printf(" -D, --no-deflate Disable compression\n");
printf(" -g, --usergroup=GROUP Set login usergroup\n");
printf(" -h, --help Display help text\n");
printf(" -i, --interface=IFNAME Use IFNAME for tunnel interface\n");
printf(" -l, --syslog Use syslog for progress messages\n");
Expand Down Expand Up @@ -159,6 +161,7 @@ int main(int argc, char **argv)
vpninfo->max_qlen = 10;
vpninfo->reconnect_interval = RECONNECT_INTERVAL_MIN;
vpninfo->reconnect_timeout = 300;
vpninfo->urlpath = strdup("/");

if (RAND_bytes(vpninfo->dtls_secret, sizeof(vpninfo->dtls_secret)) != 1) {
fprintf(stderr, "Failed to initialise DTLS secret\n");
Expand All @@ -169,7 +172,7 @@ int main(int argc, char **argv)
else
vpninfo->localname = "localhost";

while ((opt = getopt_long(argc, argv, "C:c:Ddhi:k:lp:Q:qSs:tU:u:Vvx:",
while ((opt = getopt_long(argc, argv, "C:c:Ddg:hi:k:lp:Q:qSs:tU:u:Vvx:",
long_options, NULL))) {
if (opt < 0)
break;
Expand Down Expand Up @@ -218,6 +221,12 @@ int main(int argc, char **argv)
case 'D':
vpninfo->deflate = 0;
break;
case 'g':
printf("optarg %s\n", optarg);
free(vpninfo->urlpath);
vpninfo->urlpath = malloc(strlen(optarg)+2);
sprintf(vpninfo->urlpath, "/%s", optarg);
break;
case 'h':
usage();
case 'i':
Expand Down Expand Up @@ -306,7 +315,6 @@ int main(int argc, char **argv)

if (!vpninfo->hostname)
vpninfo->hostname = strdup(argv[optind]);
vpninfo->urlpath = strdup("/");

#ifdef SSL_UI
set_openssl_ui();
Expand Down
9 changes: 9 additions & 0 deletions openconnect.8
Expand Up @@ -25,6 +25,10 @@ openconnect \- Connect to Cisco AnyConnect VPN
.B -D,--no-deflate
]
[
.B -g,--usergroup
.I GROUP
]
[
.B -h,--help
]
[
Expand Down Expand Up @@ -148,6 +152,11 @@ Enable compression (default)
.B -D,--no-deflate
Disable compression
.TP
.B -g,--usergroup=GROUP
Use
.I GROUP
as login UserGroup
.TP
.B -h,--help
Display help text
.TP
Expand Down

0 comments on commit 7e6fde6

Please sign in to comment.