diff --git a/core/presencemanager.lua b/core/presencemanager.lua index dbcb83d60..6e27752b0 100644 --- a/core/presencemanager.lua +++ b/core/presencemanager.lua @@ -21,7 +21,6 @@ local log = require "util.logger".init("presencemanager") -local tostring = tostring; local require = require; local pairs, ipairs = pairs, ipairs; local t_concat = table.concat; @@ -122,14 +121,6 @@ function handle_normal_presence(origin, stanza, core_route_stanza) else log("error", "presence recieved from client with no roster"); end - - if origin.conntimetotal then - local session = origin; - origin.log("BLAH", "***********\n\n\n\n\n\n****************"); - origin.send(st.stanza("message", { from = session.host, to=session.full_jid, type = "normal" }):body("Your login took "..tostring(session.conntimetotal).." seconds")); - origin.conntimetotal = nil; - end - end function send_presence_of_available_resources(user, host, jid, recipient_session, core_route_stanza) diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index bc48d2287..361116334 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -35,8 +35,6 @@ local uuid_generate = require "util.uuid".generate; local rm_load_roster = require "core.rostermanager".load_roster; local config_get = require "core.configmanager".get; -local gettime = require "socket".gettime; - local st = require "util.stanza"; local newproxy = newproxy; @@ -47,7 +45,7 @@ module "sessionmanager" local open_sessions = 0; function new_session(conn) - local session = { conn = conn, priority = 0, type = "c2s_unauthed", conntime = gettime() }; + local session = { conn = conn, priority = 0, type = "c2s_unauthed" }; if true then session.trace = newproxy(true); getmetatable(session.trace).__gc = function () open_sessions = open_sessions - 1; print("Session got collected, now "..open_sessions.." sessions are allocated") end; @@ -111,8 +109,6 @@ function bind_resource(session, resource) if session.resource then return nil, "cancel", "already-bound", "Cannot bind multiple resources on a single connection"; end -- We don't support binding multiple resources - session.conntimetotal = gettime()-session.conntime; - resource = resource or uuid_generate(); --FIXME: Randomly-generated resources must be unique per-user, and never conflict with existing diff --git a/net/server.lua b/net/server.lua index 7fdb32759..e01ddfb7b 100644 --- a/net/server.lua +++ b/net/server.lua @@ -501,24 +501,13 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss handler.starttls = function (now) if not now then out_put("server.lua: we need to do tls, but delaying until later"); handler.need_tls = true; return; end out_put( "server.lua: attempting to start tls on "..tostring(socket) ) - local oldsocket = socket; socket, err = ssl_wrap( socket, sslctx ) -- wrap socket out_put("sslwrapped socket is "..tostring(socket)); if err then out_put( "server.lua: ssl error: ", err ) return nil, nil, err -- fatal error end - socket:settimeout(0); - - -- Add the new socket to our system - socketlist[ socket ] = handler - readlen = readlen + 1 - readlist[ readlen ] = socket - - -- Remove traces of the old socket - readlen = removesocket( readlist, oldsocket, readlen ) - socketlist [ oldsocket ] = nil; - + socket:settimeout( 1 ) send = socket.send receive = socket.receive close = socket.close @@ -543,7 +532,7 @@ wraptlsclient = function( listener, socket, ip, serverport, clientport, mode, ss out_put( "server.lua: ssl handshake done" ) writelen = ( wrote and removesocket( writelist, socket, writelen ) ) or writelen handler.receivedata = handler._receivedata -- when handshake is done, replace the handshake function with regular functions - handler.dispatchdata = handler._dispatchdata + handler.dispatchdata = handler._dispatchdata; return true; else out_put( "server.lua: error during ssl handshake: ", err ) diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua index fe6ec57b4..22af2de4c 100644 --- a/net/xmppclient_listener.lua +++ b/net/xmppclient_listener.lua @@ -113,7 +113,7 @@ function xmppclient.listener(conn, data) if not session then session = sm_new_session(conn); sessions[conn] = session; - + -- Logging functions -- local mainlog, log = log; diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index 9b9fc2179..4ac3c5feb 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -33,7 +33,7 @@ function console:new_session(conn) local w = conn.write; local session = { conn = conn; send = function (t) w(tostring(t)); end; - print = function (t) w("| "..tostring(t).."\r\n"); end; + print = function (t) w("| "..tostring(t).."\n"); end; disconnect = function () conn.close(); end; }; session.env = setmetatable({}, default_env_mt); diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index d0ba85422..52ef68c7e 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -24,8 +24,6 @@ local sm_bind_resource = require "core.sessionmanager".bind_resource; local jid local base64 = require "util.encodings".base64; -local gettime = require "socket".gettime; - local usermanager_validate_credentials = require "core.usermanager".validate_credentials; local t_concat, t_insert = table.concat, table.insert; local tostring = tostring; @@ -66,14 +64,14 @@ local function handle_status(session, status) end end -local function password_callback(node, host, mechanism) +local function password_callback(node, host, mechanism, raw_host) local password = (datamanager.load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords local func = function(x) return x; end; if password then if mechanism == "PLAIN" then return func, password; elseif mechanism == "DIGEST-MD5" then - return func, md5(node..":"..host..":"..password); + return func, md5(node..":"..raw_host..":"..password); end end return func, nil; @@ -144,8 +142,6 @@ module:add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-bind", :tag("bind", { xmlns = xmlns_bind}) :tag("jid"):text(session.full_jid)); end - - session.log("******", "Connection took "..tostring(session.conntimetotal).." seconds"); end); module:add_iq_handler("c2s", "urn:ietf:params:xml:ns:xmpp-session",