summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-13 04:11:57 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-13 04:11:57 +0000
commit5970d04af540af4825958272cba950c0b7dff15d (patch)
treee06f9e7a8d0e93f851a2b4d6da3bc7c46f1cb685 /test
parentc9ea8fac502c6109713aa372c4c8cfafd0b86858 (diff)
downloaddbus-5970d04af540af4825958272cba950c0b7dff15d.tar.gz
2003-02-13 Havoc Pennington <hp@pobox.com>
* dbus/dbus-auth.c (handle_server_data_external_mech): args to dbus_credentials_match were backward * dbus/dbus-auth-script.c (_dbus_auth_script_run): support NO_CREDENTIALS and ROOT_CREDENTIALS * dbus/dbus-auth.c (_dbus_auth_do_work): move get_state() routine into here. Never process more commands after we've reached an end state; store further data as unused bytes. * test/data/auth/*: add more auth tests * dbus/dbus-auth-script.c (_dbus_auth_script_run): support EXPECT command to match exact string and EXPECT_UNUSED to match unused bytes * test/Makefile.am (dist-hook): fix to dist all the test stuff
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am18
-rw-r--r--test/data/auth/external-failed.auth-script8
-rw-r--r--test/data/auth/external-root.auth-script10
-rw-r--r--test/data/auth/external-silly.auth-script8
-rw-r--r--test/data/auth/external-successful.auth-script9
-rw-r--r--test/data/auth/extra-bytes.auth-script10
6 files changed, 54 insertions, 9 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 972d67cf..4ff6c49d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -37,13 +37,13 @@ unbase64_LDADD=$(TEST_LIBS)
break_loader_LDADD= $(TEST_LIBS)
bus_test_LDADD=$(TEST_LIBS) $(top_builddir)/bus/libdbus-daemon.la
-dist-hook:
- DIRS="data data/valid-messages data/invalid-messages data/incomplete-messages" ; \
- for D in $$DIRS; do \
- test -d $(distdir)/$$D || mkdir $(distdir)/$$D ; \
- done ; \
- FILES=`find -name "*.message"` ; \
- for F in $$FILES; do \
- echo '-- Disting file '$$F ; \
- cp $$F $(distdir)/$$F ; \
+dist-hook: \
+ DIRS="data data/valid-messages data/invalid-messages data/incomplete-messages data/auth" ; \
+ for D in $$DIRS; do \
+ test -d $(distdir)/$$D || mkdir $(distdir)/$$D ; \
+ done ; \
+ FILES=`find -name "*.message" -o -name "*.message-raw" -o -name "*.auth-script"` ; \
+ for F in $$FILES; do \
+ echo '-- Disting file '$$F ; \
+ cp $$F $(distdir)/$$F ; \
done
diff --git a/test/data/auth/external-failed.auth-script b/test/data/auth/external-failed.auth-script
new file mode 100644
index 00000000..f5723521
--- /dev/null
+++ b/test/data/auth/external-failed.auth-script
@@ -0,0 +1,8 @@
+## this tests that auth of type EXTERNAL without credentials will fail
+
+SERVER
+NO_CREDENTIALS
+SEND 'AUTH EXTERNAL USERNAME_BASE64'
+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
new file mode 100644
index 00000000..720b7e51
--- /dev/null
+++ b/test/data/auth/external-root.auth-script
@@ -0,0 +1,10 @@
+## this tests we can auth EXTERNAL as ourselves, with root credentials
+
+SERVER
+ROOT_CREDENTIALS
+SEND 'AUTH EXTERNAL USERNAME_BASE64'
+EXPECT_COMMAND OK
+EXPECT_STATE WAITING_FOR_INPUT
+SEND 'BEGIN'
+EXPECT_STATE AUTHENTICATED
+
diff --git a/test/data/auth/external-silly.auth-script b/test/data/auth/external-silly.auth-script
new file mode 100644
index 00000000..3e12c153
--- /dev/null
+++ b/test/data/auth/external-silly.auth-script
@@ -0,0 +1,8 @@
+## this tests we can't auth with silly credentials
+
+SERVER
+SILLY_CREDENTIALS
+SEND 'AUTH EXTERNAL USERNAME_BASE64'
+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
new file mode 100644
index 00000000..1b380802
--- /dev/null
+++ b/test/data/auth/external-successful.auth-script
@@ -0,0 +1,9 @@
+## this tests a successful auth of type EXTERNAL
+
+SERVER
+SEND 'AUTH EXTERNAL USERNAME_BASE64'
+EXPECT_COMMAND OK
+EXPECT_STATE WAITING_FOR_INPUT
+SEND 'BEGIN'
+EXPECT_STATE AUTHENTICATED
+
diff --git a/test/data/auth/extra-bytes.auth-script b/test/data/auth/extra-bytes.auth-script
new file mode 100644
index 00000000..df8df52b
--- /dev/null
+++ b/test/data/auth/extra-bytes.auth-script
@@ -0,0 +1,10 @@
+## this tests that we have the expected extra bytes at the end
+
+SERVER
+SEND 'AUTH EXTERNAL USERNAME_BASE64'
+EXPECT_COMMAND OK
+EXPECT_STATE WAITING_FOR_INPUT
+SEND 'BEGIN\r\nHello'
+EXPECT_STATE AUTHENTICATED_WITH_UNUSED_BYTES
+EXPECT_UNUSED 'Hello\r\n'
+EXPECT_STATE AUTHENTICATED