summaryrefslogtreecommitdiff
path: root/bus/config-parser.c
diff options
context:
space:
mode:
authorAlban Crequy <alban.crequy@collabora.co.uk>2014-07-21 17:34:08 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-09-15 12:29:30 +0100
commitbbf11cd5f92064c7c8af61ad4d9ff41f3a039abc (patch)
tree0af92fe58a66363f1c608d8e6f81f18a861a6970 /bus/config-parser.c
parent8ad179a8dad789fc6a5402780044bc0ec3d41115 (diff)
downloaddbus-bbf11cd5f92064c7c8af61ad4d9ff41f3a039abc.tar.gz
config: add new limit: pending_fd_timeout
This is one of four commits needed to address CVE-2014-3637. When a file descriptor is passed to dbus-daemon, the associated D-Bus message might not be fully sent to dbus-daemon yet. Dbus-daemon keeps the file descriptor in the DBusMessageLoader of the connection, waiting for the rest of the message. If the client stops sending the remaining bytes, dbus-daemon will wait forever and keep that file descriptor. This patch adds pending_fd_timeout (milliseconds) in the configuration to disconnect a connection after a timeout when a file descriptor was sent but not the remaining message. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80559 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'bus/config-parser.c')
-rw-r--r--bus/config-parser.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/bus/config-parser.c b/bus/config-parser.c
index 814725a1..7bc9c019 100644
--- a/bus/config-parser.c
+++ b/bus/config-parser.c
@@ -439,6 +439,11 @@ bus_config_parser_new (const DBusString *basedir,
* password) is allowed, then potentially it has to be quite long.
*/
parser->limits.auth_timeout = 5000; /* 5 seconds */
+
+ /* Do not allow a fd to stay forever in dbus-daemon
+ * https://bugs.freedesktop.org/show_bug.cgi?id=80559
+ */
+ parser->limits.pending_fd_timeout = 150000; /* 2.5 minutes */
parser->limits.max_incomplete_connections = 64;
parser->limits.max_connections_per_user = 256;
@@ -1902,6 +1907,12 @@ set_limit (BusConfigParser *parser,
must_be_int = TRUE;
parser->limits.auth_timeout = value;
}
+ else if (strcmp (name, "pending_fd_timeout") == 0)
+ {
+ must_be_positive = TRUE;
+ must_be_int = TRUE;
+ parser->limits.pending_fd_timeout = value;
+ }
else if (strcmp (name, "reply_timeout") == 0)
{
must_be_positive = TRUE;
@@ -3108,6 +3119,7 @@ limits_equal (const BusLimits *a,
|| a->max_message_unix_fds == b->max_message_unix_fds
|| a->activation_timeout == b->activation_timeout
|| a->auth_timeout == b->auth_timeout
+ || a->pending_fd_timeout == b->pending_fd_timeout
|| a->max_completed_connections == b->max_completed_connections
|| a->max_incomplete_connections == b->max_incomplete_connections
|| a->max_connections_per_user == b->max_connections_per_user