Mercurial > prosody-hg
comparison plugins/mod_saslauth.lua @ 1452:0ae8787e4e7d
Merged with trunk
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 02 Jul 2009 00:47:21 +0500 |
| parents | 6a90316a81c3 |
| children | 80e4f1d731c2 |
comparison
equal
deleted
inserted
replaced
| 1451:cc0aa9470775 | 1452:0ae8787e4e7d |
|---|---|
| 10 | 10 |
| 11 local st = require "util.stanza"; | 11 local st = require "util.stanza"; |
| 12 local sm_bind_resource = require "core.sessionmanager".bind_resource; | 12 local sm_bind_resource = require "core.sessionmanager".bind_resource; |
| 13 local sm_make_authenticated = require "core.sessionmanager".make_authenticated; | 13 local sm_make_authenticated = require "core.sessionmanager".make_authenticated; |
| 14 local base64 = require "util.encodings".base64; | 14 local base64 = require "util.encodings".base64; |
| 15 local to_unicode = require "util.encodings".idna.to_unicode; | |
| 15 | 16 |
| 16 local datamanager_load = require "util.datamanager".load; | 17 local datamanager_load = require "util.datamanager".load; |
| 17 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; | 18 local usermanager_validate_credentials = require "core.usermanager".validate_credentials; |
| 18 local t_concat, t_insert = table.concat, table.insert; | 19 local t_concat, t_insert = table.concat, table.insert; |
| 19 local tostring = tostring; | 20 local tostring = tostring; |
| 63 session:reset_stream(); | 64 session:reset_stream(); |
| 64 end | 65 end |
| 65 end | 66 end |
| 66 | 67 |
| 67 local function password_callback(node, hostname, realm, mechanism, decoder) | 68 local function password_callback(node, hostname, realm, mechanism, decoder) |
| 68 local password = (datamanager_load(node, hostname, "accounts") or {}).password; -- FIXME handle hashed passwords | 69 local password = (datamanager_load(node, to_unicode(hostname), "accounts") or {}).password; -- FIXME handle hashed passwords |
| 69 local func = function(x) return x; end; | 70 local func = function(x) return x; end; |
| 70 if password then | 71 if password then |
| 71 if mechanism == "PLAIN" then | 72 if mechanism == "PLAIN" then |
| 72 return func, password; | 73 return func, password; |
| 73 elseif mechanism == "DIGEST-MD5" then | 74 elseif mechanism == "DIGEST-MD5" then |
