diff --git a/changelog b/changelog index 9fbf4be6..b14fecd7 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +Wed Oct 16 17:19 2013 CDT + * lib/channel.js, lib/user.js: Only kick users on permissions + violations. Fail silently on bad packets. + Mon Oct 14 18:13 2013 CDT * lib/channel.js, lib/database.js: Add a separate database query for saving ranks on login (insert only, do nothing if the name diff --git a/lib/channel.js b/lib/channel.js index 62cd9be2..4e8c05e0 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -1320,11 +1320,9 @@ Channel.prototype.tryQueue = function(user, data) { return; } if(typeof data.pos !== "string") { - user.kick("Bad queue packet"); return; } if(typeof data.id !== "string" && data.id !== false) { - user.kick("Bad queue packet"); return; } @@ -1584,7 +1582,6 @@ Channel.prototype.tryQueuePlaylist = function(user, data) { if(typeof data.name !== "string" || typeof data.pos !== "string") { - user.kick("Bad queuePlaylist packet"); return; } @@ -1644,7 +1641,6 @@ Channel.prototype.trySetTemp = function(user, data) { return; } if(typeof data.uid != "number" || typeof data.temp != "boolean") { - user.kick("Bad setTemp packet"); return; } @@ -1674,7 +1670,6 @@ Channel.prototype.tryDequeue = function(user, data) { return; if(typeof data !== "number") { - user.kick("Bad delete packet"); return; } @@ -1690,7 +1685,6 @@ Channel.prototype.tryUncache = function(user, data) { return; } if(typeof data.id != "string") { - user.kick("Bad uncache packet"); return; } if (!self.registered) @@ -1732,7 +1726,6 @@ Channel.prototype.tryJumpTo = function(user, data) { } if(typeof data !== "number") { - user.kick("Bad jumpTo packet"); return; } @@ -1791,7 +1784,6 @@ Channel.prototype.tryUpdate = function(user, data) { } if(typeof data.id !== "string" || typeof data.currentTime !== "number") { - user.kick("Bad mediaUpdate packet"); return; } @@ -1846,7 +1838,6 @@ Channel.prototype.tryMove = function(user, data) { } if(typeof data.from !== "number" || (typeof data.after !== "number" && typeof data.after !== "string")) { - user.kick("Bad moveMedia packet"); return; } @@ -1861,7 +1852,6 @@ Channel.prototype.tryOpenPoll = function(user, data) { } if(typeof data.title !== "string" || !(data.opts instanceof Array)) { - user.kick("Invalid newPoll packet"); return; } @@ -1894,7 +1884,6 @@ Channel.prototype.tryVote = function(user, data) { return; } if(typeof data.option !== "number") { - user.kick("Bad vote packet"); return; } @@ -2014,7 +2003,6 @@ Channel.prototype.tryUpdateFilter = function(user, f) { if (typeof f.source !== "string" || typeof f.flags !== "string" || typeof f.replace !== "string") { - user.kick("Bad updateFilter packet"); return; } @@ -2058,7 +2046,6 @@ Channel.prototype.tryMoveFilter = function(user, data) { } if(typeof data.to !== "number" || typeof data.from !== "number") { - user.kick("Bad moveFilter packet"); return; } this.moveFilter(data); @@ -2120,7 +2107,6 @@ Channel.prototype.trySetCSS = function(user, data) { } if (typeof data.css !== "string") { - user.kick("Bad setChannelCSS packet"); return; } var css = data.css || ""; @@ -2141,7 +2127,6 @@ Channel.prototype.trySetJS = function(user, data) { return; } if (typeof data.js !== "string") { - user.kick("Bad setChannelJS packet"); return; } @@ -2178,7 +2163,6 @@ Channel.prototype.tryUpdateMotd = function(user, data) { } if (typeof data.motd !== "string") { - user.kick("Bad setMotd packet"); return; } @@ -2295,7 +2279,6 @@ Channel.prototype.trySetRank = function(user, data) { } if(typeof data.user !== "string" || typeof data.rank !== "number") { - user.kick("Bad setChannelRank packet"); return; } @@ -2394,7 +2377,6 @@ Channel.prototype.tryChangeLeader = function(user, data) { } if(typeof data.name !== "string") { - user.kick("Bad assignLeader packet"); return; } diff --git a/lib/user.js b/lib/user.js index c6e5a041..1ddf6351 100644 --- a/lib/user.js +++ b/lib/user.js @@ -137,7 +137,6 @@ User.prototype.initCallbacks = function () { if (self.inChannel()) return; if (typeof data.name != "string") { - self.kick("Bad joinChannel packet"); return; } if (!data.name.match(/^[\w-_]{1,30}$/)) { @@ -216,10 +215,6 @@ User.prototype.initCallbacks = function () { data = (typeof data !== "object") ? {} : data; if (self.inChannel()) { if (typeof data.msg !== "string") { - self.socket.emit("kick", { - reason: "Invalid chatMsg packet" - }); - self.socket.disconnect(true); return; } if (data.msg.indexOf("/afk") !== 0) { @@ -324,7 +319,6 @@ User.prototype.initCallbacks = function () { data = (typeof data !== "object") ? {} : data; if (self.inChannel()) { if (typeof data.query !== "string") { - self.kick("Bad searchMedia packet"); return; } if (data.source === "yt") { @@ -497,7 +491,6 @@ User.prototype.initCallbacks = function () { self.socket.on("savePlaylist", function (data) { data = (typeof data !== "object") ? {} : data; if (typeof data.name !== "string") { - self.kick("Bad savePlaylist packet"); return; } if (self.rank < 1) { @@ -559,7 +552,6 @@ User.prototype.initCallbacks = function () { self.socket.on("deletePlaylist", function (data) { data = (typeof data !== "object") ? {} : data; if (typeof data.name != "string") { - self.kick("Bad deletePlaylist packet"); return; }