[patch] replace base64 with hex in the auth protocol

Kristian Høgsberg krh at bitplanet.net
Tue Apr 27 00:39:28 EST 2004


On Sun, 2004-04-18 at 20:35, Kristian Høgsberg wrote:
> On Sat, 2004-04-17 at 05:54, Jon Trowbridge wrote:
> > As suggested by the TODO, this patch:
> > (1) replaces base64 encoding with hex encoding in the auth protocol
> > (2) removes the base64 implementation

I've been working a little more with this patch, and there's a few more
issues: unlike the base64 decoding, the hex decoding can actually fail
for other reasons than OOM -- base64 just ignores charaters outside the
base64 charset.  The auth process would think it was out of memory on
invalid hex encoded data and then retry a little later.

I've added a new DBusError, DBUS_ERROR_INVALID_HEX_ENCODING and added a
DBusError argument to dbus_string_hex_decode() so it's possible to
distinguish between OOM errors and invalid hex encoding.  Also, I
changed the auth process to return 'ERROR "Invalid hex encoding"' for
invalid hex data, and the keyring parser to just skip lines with invalid
encoded keys.

Finally, I've attached a small test case for the keyring parser that
exercises most of the error paths in the parser.

Kristian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hex-instead-of-base64.patch
Type: text/x-patch
Size: 38960 bytes
Desc: not available
Url : http://freedesktop.org/pipermail/dbus/attachments/20040426/33874493/hex-instead-of-base64-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keyring-parser-test.patch
Type: text/x-patch
Size: 3411 bytes
Desc: not available
Url : http://freedesktop.org/pipermail/dbus/attachments/20040426/33874493/keyring-parser-test-0001.bin


More information about the dbus mailing list