diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.com> | 2011-10-07 11:25:00 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2013-08-23 01:48:23 +0200 |
commit | 22fc03d274f186a788efbdbe6b6dfcff1ad474df (patch) | |
tree | b4a3441cd2d8d14debc12348933ee576fa2e0f06 | |
parent | 541063a3ab568db8302fbce3c15b22cdff154517 (diff) | |
download | dbus-22fc03d274f186a788efbdbe6b6dfcff1ad474df.tar.gz |
Enable anonymous authorization for tests
Now that authorization is in SASL mechs, enable anonymous authorizations
when we are testing anonymous mechs functionality
Bug: http://bugs.freedesktop.org/show_bug.cgi?id=39720
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | dbus/dbus-auth-script.c | 9 | ||||
-rw-r--r-- | test/data/auth/anonymous-server-successful.auth-script | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index 445452c7..107c92b2 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -398,8 +398,8 @@ _dbus_auth_script_run (const DBusString *filename) _dbus_credentials_unref (creds); } - else if (_dbus_string_starts_with_c_str (&line, - "SERVER")) + else if (_dbus_string_starts_with_c_str (&line, "SERVER") || + _dbus_string_starts_with_c_str (&line, "SERVER_ANONYMOUS")) { DBusCredentials *creds; DBusAuthorization *authorization; @@ -417,6 +417,11 @@ _dbus_auth_script_run (const DBusString *filename) _dbus_warn ("no memory to create DBusAuthorization\n"); goto out; } + /* if we are testing an anonymous server, we need to enable + * anonymous authorization, or the mech will REJECT */ + if (_dbus_string_starts_with_c_str (&line, "SERVER_ANONYMOUS")) + _dbus_authorization_set_allow_anonymous (authorization, TRUE); + auth = _dbus_auth_server_new (&guid, authorization); /* DBusAuth owns it, or finalized on OOM */ _dbus_authorization_unref (authorization); diff --git a/test/data/auth/anonymous-server-successful.auth-script b/test/data/auth/anonymous-server-successful.auth-script index 172ae9de..c53b30f9 100644 --- a/test/data/auth/anonymous-server-successful.auth-script +++ b/test/data/auth/anonymous-server-successful.auth-script @@ -1,6 +1,7 @@ ## this tests the server side in a successful auth of type ANONYMOUS -SERVER +## Act as a server that accepts anonymous authorization +SERVER_ANONYMOUS ## verify that prior to doing anything, we haven't authed as anyone EXPECT_HAVE_NO_CREDENTIALS SEND 'AUTH ANONYMOUS 442d42757320312e312e31' |