Reply-To: openvpn-devel@lists.sourceforge.net References: <63ccd0e3-491f-3fb3-e611-9b6674d3d501@...2298...> <20171112214244.GI958@...1296...> <34a7cc97-16e2-becc-4f97-ff8dbf8ecb0a@...2318...> <4ea94797-c52a-da17-b5ba-c7f8d9411326@...2181...> <4717a1f2-b8c6-26ae-2cf4-42ae5f34c3eb@...1435...> <6ad9db3e-63b5-78fe-0105-81c92746feb2@...2080...> <20171114083134.GV958@...1296...> <10ef4327-7cc1-9bd7-7307-af8b90c66962@...2080...> <20171114110244.GW958@...1296...> From: David Sommerseth Message-ID: Date: Tue, 14 Nov 2017 13:40:04 +0100 MIME-Version: 1.0 In-Reply-To: <20171114110244.GW958@...1296...> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="W5cHqXVpxB0H9J99EpcRBAkg53uCu4ClN" Subject: Re: [Openvpn-devel] [PATCH] Implement "status 4" (JSON) for management interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gert Doering , openvpn-devel@lists.sourceforge.net This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --W5cHqXVpxB0H9J99EpcRBAkg53uCu4ClN Content-Type: multipart/mixed; boundary="DtI8xQR6VoKN81qArMFrUH3LM794wsXuN"; protected-headers="v1" From: David Sommerseth Reply-To: openvpn-devel@lists.sourceforge.net To: Gert Doering , openvpn-devel@lists.sourceforge.net Message-ID: Subject: Re: [Openvpn-devel] [PATCH] Implement "status 4" (JSON) for management interface References: <63ccd0e3-491f-3fb3-e611-9b6674d3d501@...2298...> <20171112214244.GI958@...1296...> <34a7cc97-16e2-becc-4f97-ff8dbf8ecb0a@...2318...> <4ea94797-c52a-da17-b5ba-c7f8d9411326@...2181...> <4717a1f2-b8c6-26ae-2cf4-42ae5f34c3eb@...1435...> <6ad9db3e-63b5-78fe-0105-81c92746feb2@...2080...> <20171114083134.GV958@...1296...> <10ef4327-7cc1-9bd7-7307-af8b90c66962@...2080...> <20171114110244.GW958@...1296...> In-Reply-To: <20171114110244.GW958@...1296...> --DtI8xQR6VoKN81qArMFrUH3LM794wsXuN Content-Language: en-GB Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable On 14/11/17 12:02, Gert Doering wrote: > JSON is very trivial to produce (unlike XML, or netlink). The escaping > rules on producing are also very easy - basically, encode things in double > quotes, and escape the set of { BS, FF, NL, CR, Tab, Backslash, Quote } > with a single backslash before the corresponding character. > > Right, all those are single byte characters - and that's fairly simple ... but that ignores various quirks which easily appears with multi-byte characters - especially when "looping" through a value, byte by byte. We support UTF-8 in certificate subject fields. So this escaper needs to handle those classes the stackoverflow mentions, plus beware of multi-byte strings (so we need to use the plethora of mb* related functions). In a clean 8-bit ASCII only-world, things are less complicated. Heiko and I have looked into the "simple" world of revamping the argv parser (to avoid our own "homebrewed" printf-like processing and base it on what is in the C library) and even this pre-parsing we need to do have popped up with surprises. The argv caller scope mostly covers parsing strings which is defined by us developers so the variations are not as broad, and luckily format strings is not expected to contain UTF-8 chars. But I do not for a second think processing certificate subject strings will as easy as those values we need to parse (typically CN) are not generated by us but a broad range of users. Who knows what kind of funny tricks they'll throw at our code? But sure, we can start with our own string parser to escape JSON and see how it works and then revisit using a library if the maintenance gets too annoying. --=20 kind regards, David Sommerseth OpenVPN, Inc --DtI8xQR6VoKN81qArMFrUH3LM794wsXuN-- --W5cHqXVpxB0H9J99EpcRBAkg53uCu4ClN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBCgAGBQJaCuQkAAoJEIbPlEyWcf3ygnwP/3QoQyI+/vp39IFknvxyVU1/ 2PErla7qP9QknIGCQU9+I5JKL9Mzb/j7F12BqmdsgQGvc83pUOWRSsdQvtSziTOp wXHjSnqKWya9ClZJmsXDgdGeu8tTVCETJ9ZM7mLwA0zmCg7EIr/5UokzLogrYLqK LSmrvPavHsqqeiFcLCUeGqolS0g6WRRecuIsJGb4m6qbNpOIurVtinTT66X3LJQc OVGF5VRO0lk7NZzqMnKTYTbWG5SqZA2Zyw5qbm/MRs8aHolevip3WhVsfR7lTmz0 o9f0ySPDJNqxEYefA1/4Jdmgqi5QNsUVoK8M1w1EBBkYEJANBl2BV3Oi7kVw7pK/ NmFsj7o2Ftg2fiSGyC46yxCRpK1EVMCpEzniw6ccHKIhO0lzazhShRXw8Mk7KlsQ RyKaEsaTZFK/sUDegSdWd/TwkfCyCqbv+1bs3N/hPuljRtob+FlQ/atCzXbrMwwi sWTCRbu/kDGF7Pdg4bYVO3H72NT/e0TZcl+08Bjc8s9yryqSFpjZPcKW2T/3N291 fpqCUErHGakfAUslBMiIeI0FVbCK+mSYl5o5u6t0IruQp0gm91BRFvcjiQayOaEW AE/HnaQw3oWjctz50kfz94DScNJbVA1Np2C0PSqTX/sDywx5jUOFHDimx+MDx/pJ 5dDYA/2EOFVymm5t+gA6 =+zmz -----END PGP SIGNATURE----- --W5cHqXVpxB0H9J99EpcRBAkg53uCu4ClN--