From d86fc4071ccb8590d922e3456c5c80c0f7bb9d6f Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 17 May 2004 22:19:04 +0000 Subject: 2004-05-17 Kristian Høgsberg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove base64 encoding, replace with hex encoding. Original patch from trow@ximian.com, added error handling. * dbus/dbus-string.c (_dbus_string_base64_encode) (_dbus_string_base64_decode): Remove. (_dbus_string_hex_decode): Add end_return argument so we can distinguish between OOM and invalid hex encoding. (_dbus_string_test): Remove base64 tests and add test case for invalid hex. * dbus/dbus-keyring.c, dbus/dbus-auth-script.c, dbus/dbus-auth.c: Replace base64 with hex. * test/data/auth/invalid-hex-encoding.auth-script: New test case for invalid hex encoded data in auth protocol. --- dbus/dbus-auth-script.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'dbus/dbus-auth-script.c') diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index f3154c92..0c6426db 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -366,12 +366,12 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } - /* Replace USERID_BASE64 with our username in base64 */ + /* Replace USERID_HEX with our username in hex */ { int where; if (_dbus_string_find (&to_send, 0, - "USERID_BASE64", &where)) + "USERID_HEX", &where)) { DBusString username; @@ -391,12 +391,12 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } - _dbus_string_delete (&to_send, where, strlen ("USERID_BASE64")); + _dbus_string_delete (&to_send, where, strlen ("USERID_HEX")); - if (!_dbus_string_base64_encode (&username, 0, - &to_send, where)) + if (!_dbus_string_hex_encode (&username, 0, + &to_send, where)) { - _dbus_warn ("no memory to subst USERID_BASE64\n"); + _dbus_warn ("no memory to subst USERID_HEX\n"); _dbus_string_free (&username); _dbus_string_free (&to_send); goto out; @@ -405,7 +405,7 @@ _dbus_auth_script_run (const DBusString *filename) _dbus_string_free (&username); } else if (_dbus_string_find (&to_send, 0, - "USERNAME_BASE64", &where)) + "USERNAME_HEX", &where)) { DBusString username; const DBusString *u; @@ -427,12 +427,12 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } - _dbus_string_delete (&to_send, where, strlen ("USERNAME_BASE64")); + _dbus_string_delete (&to_send, where, strlen ("USERNAME_HEX")); - if (!_dbus_string_base64_encode (&username, 0, - &to_send, where)) + if (!_dbus_string_hex_encode (&username, 0, + &to_send, where)) { - _dbus_warn ("no memory to subst USERNAME_BASE64\n"); + _dbus_warn ("no memory to subst USERNAME_HEX\n"); _dbus_string_free (&username); _dbus_string_free (&to_send); goto out; -- cgit