[Pkg-javascript-commits] [ltx] 74/469: router: acceptConnection() dialback checks

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit 75d41ec74bc54955304ade5f76d4cbafee9f229d
Author: Astro <astro at spaceboyz.net>
Date:   Sun Sep 5 20:14:28 2010 +0200

    router: acceptConnection() dialback checks
---
 lib/xmpp/router.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index 40f11c7..366415f 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -221,7 +221,6 @@ function Router(s2sPort) {
 }
 exports.Router = Router;
 
-// TODO: don't use from & to supplied by remote all over the place
 Router.prototype.acceptConnection = function(inStream) {
     var self = this;
 
@@ -236,6 +235,7 @@ Router.prototype.acceptConnection = function(inStream) {
     });
     // incoming connection wants to get verified
     inStream.addListener('dialbackKey', function(from, to, key) {
+	var destDomain = to;
 	if (self.hasContext(to)) {
 	    var ctx = self.getContext(to);
 	    var outStream = ctx.sendRaw(Server.dialbackVerify(to, from, inStream.streamId, key),
@@ -244,6 +244,10 @@ Router.prototype.acceptConnection = function(inStream) {
 	    // TODO: hook inStream close
 	    var onVerified, onClose;
 	    onVerified = function(from, to, id, isValid) {
+		if (to !== destDomain ||
+		    id != inStream.streamId)  // not for us
+		    return;
+
 		inStream.send(Server.dialbackResult(to, from, isValid));
 
 		if (isValid && self.hasContext(to)) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list