On 11/13/2017 01:16 PM, David Sommerseth wrote:
> CSV just looks structured - until the layout is changed.  While JSON
> (and even XML for that matter, _not_ saying we should have XML support!)
> is not strictly bound to the order of fields, so adding new fields is a
> no-brainer with JSON compared to CSV.  And before you say "We only
> append fields to CSV", some of those changes we have done in the past to
> --status 3 have even broken some users setup - because the CSV parser
> was stupid.  The risk of that happening to JSON is far less.

This is a very good point. This was one of the problems I had before
parsing OpenVPN's CSV when it changed (a little) between 2.3 and 2.4.

> Just a few words to the management interface vs --status file.  We
> should support JSON via both channels.  And implementing that shouldn't
> be rocket science as it should be the same function producing that result.

Agreed, also talked about with Gert (van Dijk) @ Hackathon.

> But we should consider if we want to make use of a JSON library
> producing the JSON streams.  The reason is to ensure the output is
> according to the specification and that escaping if contents is
> consistent and proper.  Imagine if someone puts a double-quote into the
> CN field of a certificate?
> 
>  CN="} Lets explode things, O=Hacktivist0
> 
> Or other characters which needs escaping.

Another very good point. I do have some experience with json-c [1],
would it be acceptable to add this as a project dependency? That is the
main reason I started out by just outputting a string and conveniently
forgot escaping issues...

So for now my plan is:

1. use json-c to generate (human readable) JSON;
2. also support --status (command line) in addition to "status" in
management interface
3. do not print "END" marker any longer

This is an excellent way for me to gain some more experience with
writing C (and OpenVPN), even if in the end the patch is not accepted. I
do think, like Steffan said, we need a good reason to support JSON,
especially if it adds an additional external dependency. The
future-proof-ness of the JSON format could be a good selling point,
maybe new fields would only be added to the JSON format and not to the
other status formats to promote adoption of the JSON format and slowly
phasing out the CSV format(s).

Cheers,
François

[1] https://github.com/json-c/json-c/

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to