Diff

core/sessionmanager.lua @ 3240:9782a222e941

Merge 0.7->trunk
author Matthew Wild <mwild1@gmail.com>
date Sat, 12 Jun 2010 02:39:18 +0100
parent 3145:675241be2935
parent 3239:5ea90ee96022
child 3437:1e93b4d46d92
line wrap: on
line diff
--- a/core/sessionmanager.lua	Fri Jun 11 20:45:00 2010 +0500
+++ b/core/sessionmanager.lua	Sat Jun 12 02:39:18 2010 +0100
@@ -25,6 +25,7 @@
 local config_get = require "core.configmanager".get;
 local nameprep = require "util.encodings".stringprep.nameprep;
 local resourceprep = require "util.encodings".stringprep.resourceprep;
+local nodeprep = require "util.encodings".stringprep.nodeprep;
 
 local initialize_filters = require "util.filters".initialize;
 local fire_event = require "core.eventmanager".fire_event;
@@ -122,6 +123,8 @@
 end
 
 function make_authenticated(session, username)
+	username = nodeprep(username);
+	if not username or #username == 0 then return nil, "Invalid username"; end
 	session.username = username;
 	if session.type == "c2s_unauthed" then
 		session.type = "c2s";