diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2017-02-01 22:11:40 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2017-02-02 12:29:11 +0100 |
commit | 7d2d823707a2199cebe6c67ba18bbc535bf359be (patch) | |
tree | fb5a8b5090dd633e9c60e2b65a3dd4fa47e3ae1a /dbus/dbus-auth.c | |
parent | b16eb872fb4ba1e9292104be085ed48072a467e5 (diff) | |
download | dbus-7d2d823707a2199cebe6c67ba18bbc535bf359be.tar.gz |
Do not mention disallowed auth mechanisms in REJECTED message
Previously, all implemented mechanisms were included, even if the
sysadmin had configured them not to be allowed.
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99621
Diffstat (limited to 'dbus/dbus-auth.c')
-rw-r--r-- | dbus/dbus-auth.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c index 9a1de97e..37d8d4c9 100644 --- a/dbus/dbus-auth.c +++ b/dbus/dbus-auth.c @@ -1485,9 +1485,14 @@ send_rejected (DBusAuth *auth) "REJECTED")) goto nomem; - i = 0; - while (all_mechanisms[i].mechanism != NULL) + for (i = 0; all_mechanisms[i].mechanism != NULL; i++) { + /* skip mechanisms that aren't allowed */ + if (auth->allowed_mechs != NULL && + !_dbus_string_array_contains ((const char**)auth->allowed_mechs, + all_mechanisms[i].mechanism)) + continue; + if (!_dbus_string_append (&command, " ")) goto nomem; @@ -1495,8 +1500,6 @@ send_rejected (DBusAuth *auth) if (!_dbus_string_append (&command, all_mechanisms[i].mechanism)) goto nomem; - - ++i; } if (!_dbus_string_append (&command, "\r\n")) |