diff options
author | Kristian Høgsberg <krh@redhat.com> | 2004-05-17 22:19:04 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2004-05-17 22:19:04 +0000 |
commit | d86fc4071ccb8590d922e3456c5c80c0f7bb9d6f (patch) | |
tree | 7ed880494686d9290ad1f9ded6230459e2e7269a /dbus/dbus-auth-script.c | |
parent | 91605d6899e8f21a6adf7f2fc87cfe07d399875f (diff) |
2004-05-17 Kristian Høgsberg <krh@redhat.com>
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.
Diffstat (limited to 'dbus/dbus-auth-script.c')
-rw-r--r-- | dbus/dbus-auth-script.c | 22 |
1 files changed, 11 insertions, 11 deletions
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; |