From e5f34cdd2da54f28d90889a3afd15fad2d6105ff Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 2 Oct 2014 12:09:34 +0200 Subject: vnc: track & limit connections Also track the number of connections in "connecting" and "shared" state (in addition to the "exclusive" state). Apply a configurable limit to these connections. The logic to apply the limit to connections in "shared" state is pretty simple: When the limit is reached no new connections are allowed. The logic to apply the limit to connections in "connecting" state (this is the state you are in *before* successful authentication) is slightly different: A new connect kicks out the oldest client which is still in "connecting" state. This avoids a easy DoS by unauthenticated users by simply opening connections until the limit is reached. Cc: Dr. David Alan Gilbert Signed-off-by: Gerd Hoffmann --- ui/vnc.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ui/vnc.h') diff --git a/ui/vnc.h b/ui/vnc.h index 6fe8278126..5e2b1a561e 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -150,7 +150,10 @@ typedef enum VncSharePolicy { struct VncDisplay { QTAILQ_HEAD(, VncState) clients; + int num_connecting; + int num_shared; int num_exclusive; + int connections_limit; VncSharePolicy share_policy; int lsock; #ifdef CONFIG_VNC_WS -- cgit v1.2.1