Mercurial > prosody-hg
comparison plugins/mod_saslauth.lua @ 1725:fb3137652ea6
Uncertain merge with 0.5's SASL
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 20 Aug 2009 13:57:50 +0100 |
| parents | 0914d128c55e 1dcfb2c64302 |
| children | 5acbf4318715 |
comparison
equal
deleted
inserted
replaced
| 1719:cf103398e643 | 1725:fb3137652ea6 |
|---|---|
| 1 -- Prosody IM | 1 -- Prosody IM |
| 2 -- Copyright (C) 2008-2009 Matthew Wild | 2 -- Copyright (C) 2008-2009 Matthew Wild |
| 3 -- Copyright (C) 2008-2009 Waqas Hussain | 3 -- Copyright (C) 2008-2009 Waqas Hussain |
| 4 -- | 4 -- |
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 | 9 |
| 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 | 15 |
| 16 local nodeprep = require "util.encodings".stringprep.nodeprep; | |
| 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 usermanager_get_supported_methods = require "core.usermanager".get_supported_methods; | 19 local usermanager_get_supported_methods = require "core.usermanager".get_supported_methods; |
| 19 local usermanager_user_exists = require "core.usermanager".user_exists; | 20 local usermanager_user_exists = require "core.usermanager".user_exists; |
| 20 local usermanager_get_password = require "core.usermanager".get_password; | 21 local usermanager_get_password = require "core.usermanager".get_password; |
| 68 end | 69 end |
| 69 | 70 |
| 70 local function credentials_callback(mechanism, ...) | 71 local function credentials_callback(mechanism, ...) |
| 71 if mechanism == "PLAIN" then | 72 if mechanism == "PLAIN" then |
| 72 local username, hostname, password = ...; | 73 local username, hostname, password = ...; |
| 74 username = nodeprep(username); | |
| 75 if not username then | |
| 76 return false; | |
| 77 end | |
| 73 local response = usermanager_validate_credentials(hostname, username, password, mechanism); | 78 local response = usermanager_validate_credentials(hostname, username, password, mechanism); |
| 74 if response == nil then | 79 if response == nil then |
| 75 return false; | 80 return false; |
| 76 else | 81 else |
| 77 return response; | 82 return response; |
