[Pkg-javascript-commits] [ltx] 84/469: router: nameprep all domains from network or user
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:06 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 b801768202f3603323355ec468db7b30c9f267ac
Author: Astro <astro at spaceboyz.net>
Date: Mon Sep 6 01:22:28 2010 +0200
router: nameprep all domains from network or user
Often we use JID which namepreps already.
---
lib/xmpp/router.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index d1e8c1c..a7a60bf 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -2,6 +2,8 @@ var net = require('net');
var Server = require('./server');
var JID = require('./jid');
var StreamShaper = require('./../stream_shaper');
+var StringPrep = require('node-stringprep').StringPrep;
+var nameprep = new StringPrep('nameprep');
dbgStream = function(tag, stream) {
@@ -215,7 +217,6 @@ DomainContext.prototype.receive = function(stanza) {
/**
* TODO:
- * * nameprep
* * timeouts
* * keepAlive
* * TLS
@@ -244,11 +245,15 @@ Router.prototype.acceptConnection = function(inStream) {
// incoming server wants to verify an outgoing connection of ours
inStream.addListener('dialbackVerify', function(from, to, id, key) {
+ from = nameprep(from);
+ to = nameprep(to);
var isValid = self.verifyDialback(from, to, id, key);
inStream.send(Server.dialbackVerified(to, from, id, isValid));
});
// incoming connection wants to get verified
inStream.addListener('dialbackKey', function(from, to, key) {
+ from = nameprep(from);
+ to = nameprep(to);
var destDomain = to;
if (self.hasContext(to)) {
var ctx = self.getContext(to);
@@ -259,6 +264,8 @@ Router.prototype.acceptConnection = function(inStream) {
// these are needed before for removeListener()
var onVerified, onClose;
onVerified = function(from, to, id, isValid) {
+ from = nameprep(from);
+ to = nameprep(to);
if (to !== destDomain ||
id != inStream.streamId) // not for us
return;
@@ -294,6 +301,7 @@ Router.prototype.acceptConnection = function(inStream) {
* Create domain context & register a stanza listener callback
*/
Router.prototype.register = function(domain, listener) {
+ domain = nameprep(domain);
this.getContext(domain).stanzaListener = listener;
};
--
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