Software /
code /
prosody
Comparison
util/sasl.lua @ 799:b7ea802f3527
Adding inital support for ANONYMOUS mechanism in SASL.
author | Tobias Markmann <tm@ayena.de> |
---|---|
date | Sat, 14 Feb 2009 18:57:50 +0100 |
parent | 760:90ce865eebd8 |
child | 801:d29febc977fc |
comparison
equal
deleted
inserted
replaced
797:6ea01e05b004 | 799:b7ea802f3527 |
---|---|
1 -- sasl.lua v0.2 | 1 -- sasl.lua v0.3 |
2 -- Copyright (C) 2008-2009 Tobias Markmann | 2 -- Copyright (C) 2008-2009 Tobias Markmann |
3 -- | 3 -- |
4 -- All rights reserved. | 4 -- All rights reserved. |
5 -- | 5 -- |
6 -- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | 6 -- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
233 end | 233 end |
234 end | 234 end |
235 return object | 235 return object |
236 end | 236 end |
237 | 237 |
238 local function new_anonymous(realm, password_handler) | |
239 local object = { mechanism = "ANONYMOUS", realm = realm, password_handler = password_handler} | |
240 function object.feed(self, message) | |
241 return "success" | |
242 end | |
243 object["username"] = generate_uuid() | |
244 return object | |
245 end | |
246 | |
247 | |
238 function new(mechanism, realm, password_handler) | 248 function new(mechanism, realm, password_handler) |
239 local object | 249 local object |
240 if mechanism == "PLAIN" then object = new_plain(realm, password_handler) | 250 if mechanism == "PLAIN" then object = new_plain(realm, password_handler) |
241 elseif mechanism == "DIGEST-MD5" then object = new_digest_md5(realm, password_handler) | 251 elseif mechanism == "DIGEST-MD5" then object = new_digest_md5(realm, password_handler) |
252 elseif mechanism == "ANONYMOUS" then object = new_anonymous(realm, password_handler) | |
242 else | 253 else |
243 log("debug", "Unsupported SASL mechanism: "..tostring(mechanism)); | 254 log("debug", "Unsupported SASL mechanism: "..tostring(mechanism)); |
244 return nil | 255 return nil |
245 end | 256 end |
246 return object | 257 return object |