summaryrefslogtreecommitdiff
path: root/test/data
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-01-12 16:52:58 +0000
committerSimon McVittie <smcv@collabora.com>2018-01-15 14:05:34 +0000
commitdd451777e30c64342dbdfb8566c685b4fb61d0b2 (patch)
tree9bc856a6684493588bd2f32efc7bdb4ef0dbf02d /test/data
parent8a4928af767c07b9d48b06f7b07ca445b428b9de (diff)
downloaddbus-dd451777e30c64342dbdfb8566c685b4fb61d0b2.tar.gz
test: Add a test-case for EXTERNAL auth rejecting usernames
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104588
Diffstat (limited to 'test/data')
-rw-r--r--test/data/auth/external-username.auth-script24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/data/auth/external-username.auth-script b/test/data/auth/external-username.auth-script
new file mode 100644
index 00000000..cd417f46
--- /dev/null
+++ b/test/data/auth/external-username.auth-script
@@ -0,0 +1,24 @@
+# Assert that EXTERNAL authentication accepts numeric uids, but not
+# login names.
+
+# This only works on Unix because USERNAME_HEX is unimplemented on Windows
+# (but no authentication mechanism uses usernames there anyway).
+UNIX_ONLY
+SERVER
+EXPECT_HAVE_NO_CREDENTIALS
+
+# C: "I claim that I am smcv"
+SEND 'AUTH EXTERNAL USERNAME_HEX'
+# S: (doesn't want to look up smcv in NSS or /etc/passwd)
+EXPECT_COMMAND REJECTED
+EXPECT_STATE WAITING_FOR_INPUT
+EXPECT_HAVE_NO_CREDENTIALS
+
+# C: "OK, how about I claim that I am uid 1000?"
+SEND 'AUTH EXTERNAL USERID_HEX'
+# S: (is happier)
+EXPECT_COMMAND OK
+EXPECT_STATE WAITING_FOR_INPUT
+SEND 'BEGIN'
+EXPECT_STATE AUTHENTICATED
+EXPECT_HAVE_SOME_CREDENTIALS