[PATCH v2] Allow specifying server in configuration file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 2018-04-03 at 20:03 -0400, Max Rees wrote:
> 
> +???????????????case OPT_SERVER:
> +???????????????????????if (openconnect_parse_url(vpninfo, config_arg))
> +???????????????????????????????exit(1);
> +???????????????????????break;

Here you *only* accept a bare URL, not the name of one of the servers
which is found in the XML config file (see config_lookup_host). So the
--server option isn't the same as the bare command line argument.


> ????????????????case OPT_JUNIPER:
> ????????????????????????fprintf(stderr, "WARNING: Juniper Network Connect support is experimental.\n");
> ????????????????????????fprintf(stderr, "It will probably be superseded by Junos Pulse support.\n");
> @@ -1457,7 +1463,7 @@ int main(int argc, char **argv)
> ????????if (optind < argc - 1) {
> ????????????????fprintf(stderr, _("Too many arguments on command line\n"));
> ????????????????usage();
> -???????} else if (optind > argc - 1) {
> +???????} else if (optind > argc - 1 && !vpninfo->hostname) {
> ????????????????fprintf(stderr, _("No server specified\n"));
> ????????????????usage();
> ????????}

OK, except...

> @@ -1513,7 +1519,10 @@ int main(int argc, char **argv)
> ????????if (config_lookup_host(vpninfo, argv[optind]))
> ????????????????exit(1);

Isn't that going to crash, since it's using argv[optind]?
?
> -???????if (!vpninfo->hostname) {
> +???????/* The last argument without a corresponding --option is taken
> +??????? * to be the server URL and overrides any --server option on the
> +??????? * command line or from a --config */
> +???????if (!vpninfo->hostname || optind < argc) {

.. and isn't that redundant??
> ????????????????char *url = strdup(argv[optind]);
> ?
> ????????????????if (openconnect_parse_url(vpninfo, url))

I'd try something like this... and it needs the help text in usage()
and the man page updated too.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-specifying-server-in-configuration-file.patch
Type: text/x-patch
Size: 2766 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20180529/b025fe59/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5213 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20180529/b025fe59/attachment-0001.bin>


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux