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 /test/data | |
parent | 91605d6899e8f21a6adf7f2fc87cfe07d399875f (diff) | |
download | dbus-d86fc4071ccb8590d922e3456c5c80c0f7bb9d6f.tar.gz |
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 'test/data')
-rw-r--r-- | test/data/auth/cancel.auth-script | 4 | ||||
-rw-r--r-- | test/data/auth/external-failed.auth-script | 2 | ||||
-rw-r--r-- | test/data/auth/external-root.auth-script | 2 | ||||
-rw-r--r-- | test/data/auth/external-silly.auth-script | 2 | ||||
-rw-r--r-- | test/data/auth/external-successful.auth-script | 2 | ||||
-rw-r--r-- | test/data/auth/extra-bytes.auth-script | 2 | ||||
-rw-r--r-- | test/data/auth/fail-after-n-attempts.auth-script | 12 | ||||
-rw-r--r-- | test/data/auth/invalid-hex-encoding.auth-script | 6 |
8 files changed, 19 insertions, 13 deletions
diff --git a/test/data/auth/cancel.auth-script b/test/data/auth/cancel.auth-script index a99c6128..f2c519aa 100644 --- a/test/data/auth/cancel.auth-script +++ b/test/data/auth/cancel.auth-script @@ -1,7 +1,7 @@ ## this tests canceling EXTERNAL SERVER -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND OK EXPECT_STATE WAITING_FOR_INPUT SEND 'CANCEL' @@ -9,7 +9,7 @@ EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT ## now start over and see if it works -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND OK EXPECT_STATE WAITING_FOR_INPUT SEND 'BEGIN' diff --git a/test/data/auth/external-failed.auth-script b/test/data/auth/external-failed.auth-script index 8f0d1aa9..b11ee9c5 100644 --- a/test/data/auth/external-failed.auth-script +++ b/test/data/auth/external-failed.auth-script @@ -2,7 +2,7 @@ SERVER NO_CREDENTIALS -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT diff --git a/test/data/auth/external-root.auth-script b/test/data/auth/external-root.auth-script index c126067c..b0189719 100644 --- a/test/data/auth/external-root.auth-script +++ b/test/data/auth/external-root.auth-script @@ -2,7 +2,7 @@ SERVER ROOT_CREDENTIALS -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND OK EXPECT_STATE WAITING_FOR_INPUT SEND 'BEGIN' diff --git a/test/data/auth/external-silly.auth-script b/test/data/auth/external-silly.auth-script index cbfef8fd..8ac0688a 100644 --- a/test/data/auth/external-silly.auth-script +++ b/test/data/auth/external-silly.auth-script @@ -2,7 +2,7 @@ SERVER SILLY_CREDENTIALS -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT diff --git a/test/data/auth/external-successful.auth-script b/test/data/auth/external-successful.auth-script index 02ecdc08..128d3294 100644 --- a/test/data/auth/external-successful.auth-script +++ b/test/data/auth/external-successful.auth-script @@ -1,7 +1,7 @@ ## this tests a successful auth of type EXTERNAL SERVER -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND OK EXPECT_STATE WAITING_FOR_INPUT SEND 'BEGIN' diff --git a/test/data/auth/extra-bytes.auth-script b/test/data/auth/extra-bytes.auth-script index 0bd705dc..cd1e01d2 100644 --- a/test/data/auth/extra-bytes.auth-script +++ b/test/data/auth/extra-bytes.auth-script @@ -1,7 +1,7 @@ ## this tests that we have the expected extra bytes at the end SERVER -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND OK EXPECT_STATE WAITING_FOR_INPUT SEND 'BEGIN\r\nHello' diff --git a/test/data/auth/fail-after-n-attempts.auth-script b/test/data/auth/fail-after-n-attempts.auth-script index ae3b907a..a56f182b 100644 --- a/test/data/auth/fail-after-n-attempts.auth-script +++ b/test/data/auth/fail-after-n-attempts.auth-script @@ -4,30 +4,30 @@ SERVER NO_CREDENTIALS # 1 -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT # 2 -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT # 3 -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT # 4 -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT # 5 -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_COMMAND REJECTED EXPECT_STATE WAITING_FOR_INPUT # 6 -SEND 'AUTH EXTERNAL USERID_BASE64' +SEND 'AUTH EXTERNAL USERID_HEX' EXPECT_STATE NEED_DISCONNECT diff --git a/test/data/auth/invalid-hex-encoding.auth-script b/test/data/auth/invalid-hex-encoding.auth-script new file mode 100644 index 00000000..1f15c436 --- /dev/null +++ b/test/data/auth/invalid-hex-encoding.auth-script @@ -0,0 +1,6 @@ +## this tests an invalid hex encoding followed by successful authentication + +SERVER +SEND 'AUTH EXTERNAL willy' +EXPECT_COMMAND ERROR +EXPECT_STATE WAITING_FOR_INPUT |