From 5cc27a86ad2a50f7c49f85616f7413ffe150777d Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Mon, 14 Sep 2015 19:38:12 +0900 Subject: [PATCH] Don't add clients to the broadcast set until they're authenticated. Note that actual, real auth is not checked yet. --- lib/units/device/plugins/vnc/index.js | 8 +++++--- lib/units/device/plugins/vnc/util/connection.js | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/units/device/plugins/vnc/index.js b/lib/units/device/plugins/vnc/index.js index 7593e962..8ae2b69a 100644 --- a/lib/units/device/plugins/vnc/index.js +++ b/lib/units/device/plugins/vnc/index.js @@ -110,9 +110,11 @@ module.exports = syrup.serial() connState.sentFrameTime = connState.lastFrameTime } - screenStream.broadcastSet.insert(id, { - onStart: vncStartListener - , onFrame: vncFrameListener + conn.on('authenticated', function() { + screenStream.broadcastSet.insert(id, { + onStart: vncStartListener + , onFrame: vncFrameListener + }) }) conn.on('fbupdaterequest', function() { diff --git a/lib/units/device/plugins/vnc/util/connection.js b/lib/units/device/plugins/vnc/util/connection.js index 5041c675..270bcc98 100644 --- a/lib/units/device/plugins/vnc/util/connection.js +++ b/lib/units/device/plugins/vnc/util/connection.js @@ -253,6 +253,7 @@ VncConnection.prototype._read = function() { } debug('client security', this._clientSecurity) this._writeSecurityResult(VncConnection.SECURITYRESULT_OK) + this.emit('authenticated') this._changeState(VncConnection.STATE_NEED_CLIENT_INIT) } break