Software /
code /
prosody
Comparison
util/sasl.lua @ 16:ba8e796f9f94
* missing base64 decode of SASL response
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Tue, 26 Aug 2008 01:01:13 +0200 |
parent | 15:c0d754774db2 |
child | 17:9a2685f39f9f |
comparison
equal
deleted
inserted
replaced
15:c0d754774db2 | 16:ba8e796f9f94 |
---|---|
6 local challenge = base64.encode(""); | 6 local challenge = base64.encode(""); |
7 onWrite(stanza.stanza("challenge", {xmlns = "urn:ietf:params:xml:ns:xmpp-sasl"}):text(challenge)) | 7 onWrite(stanza.stanza("challenge", {xmlns = "urn:ietf:params:xml:ns:xmpp-sasl"}):text(challenge)) |
8 object.feed = function(self, stanza) | 8 object.feed = function(self, stanza) |
9 if (stanza.name ~= "response") then self.onFail() end | 9 if (stanza.name ~= "response") then self.onFail() end |
10 if (stanza.attr.xmlns ~= "urn:ietf:params:xml:ns:xmpp-sasl") then self.onFail() end | 10 if (stanza.attr.xmlns ~= "urn:ietf:params:xml:ns:xmpp-sasl") then self.onFail() end |
11 local response = stanza.tag[1] | 11 local response = base64.decode(stanza.tag[1]) |
12 local authorization = string.match(response, [[([^&\0]+)]]) | 12 local authorization = string.match(response, [[([^&\0]+)]]) |
13 local authentication = string.match(response, [[\0([^&\0]+)\0]]) | 13 local authentication = string.match(response, [[\0([^&\0]+)\0]]) |
14 local password = string.match(response, [[\0[^&\0]+\0([^&\0]+)]]) | 14 local password = string.match(response, [[\0[^&\0]+\0([^&\0]+)]]) |
15 if self.onAuth(authorization, password) == true then | 15 if self.onAuth(authorization, password) == true then |
16 self.onWrite(stanza.stanza("success", {xmlns = "urn:ietf:params:xml:ns:xmpp-sasl"})) | 16 self.onWrite(stanza.stanza("success", {xmlns = "urn:ietf:params:xml:ns:xmpp-sasl"})) |