Patch against xml.c -- grab some more fields from the xml config file

David Woodhouse dwmw2 at infradead.org
Mon Feb 22 10:10:27 EST 2010


On Fri, 2010-02-19 at 00:02 +0100, Jonas Kölker wrote:
> Hello, everybody.
> 
> I've been monkeying a bit with xml.c, such that I can use openconnect
> non-interactively, i.e. such that it reads all the input I'd otherwise have to
> type in manually from the xml config file.

Hrm, the XML config file is Cisco's invention -- does it normally
support the AuthGroup, UserName and PassWord options? I'm reluctant to
add our own 'speshul' options in the XML file, especially since the XML
file is normally downloaded from the server.

The three options you've added can all be passed on the command line (or
stdin, for the password), so you can have a non-interactive openconnect
even without changing the XML file.

> In the process, I redecorated a few loops: "if(x) { ... }" became "if (!x)
> continue; ...", such that the indentation doesn't as deep---IMO, it makes the
> code easier to read.

Yeah, that's a nice cleanup; thanks.

It also makes it a bit more obvious that this will only ever work if the
<HostName> tag is the first child of the <HostEntry>, which is perhaps a
little more fragile than necessary.

Perhaps we should have a single loop which checks for a HostName match,
then just pass the 'vpninfo' and the parent xml_node to a separate
function which will extract all the options.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation




More information about the openconnect-devel mailing list