Mercurial > prosody-hg
comparison plugins/mod_saslauth.lua @ 4395:d322c4553f97
mod_saslauth: Never send empty <mechanisms/>, for real this time.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 13 Oct 2011 00:24:09 +0500 |
| parents | d2a7a44d68c5 |
| children | 0a4781f165e3 |
comparison
equal
deleted
inserted
replaced
| 4394:676b0845eae4 | 4395:d322c4553f97 |
|---|---|
| 246 if not origin.username then | 246 if not origin.username then |
| 247 if secure_auth_only and not origin.secure then | 247 if secure_auth_only and not origin.secure then |
| 248 return; | 248 return; |
| 249 end | 249 end |
| 250 origin.sasl_handler = usermanager_get_sasl_handler(module.host); | 250 origin.sasl_handler = usermanager_get_sasl_handler(module.host); |
| 251 local mechanisms = origin.sasl_handler:mechanisms(); | 251 local mechanisms = st.stanza("mechanisms", mechanisms_attr); |
| 252 if not next(mechanisms) then return; end | 252 for mechanism in pairs(origin.sasl_handler:mechanisms()) do |
| 253 features:tag("mechanisms", mechanisms_attr); | |
| 254 for mechanism in pairs(mechanisms) do | |
| 255 if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then | 253 if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then |
| 256 features:tag("mechanism"):text(mechanism):up(); | 254 mechanisms:tag("mechanism"):text(mechanism):up(); |
| 257 end | 255 end |
| 258 end | 256 end |
| 259 features:up(); | 257 if mechanisms[1] then features:add_child(mechanisms); end |
| 260 else | 258 else |
| 261 features:tag("bind", bind_attr):tag("required"):up():up(); | 259 features:tag("bind", bind_attr):tag("required"):up():up(); |
| 262 features:tag("session", xmpp_session_attr):tag("optional"):up():up(); | 260 features:tag("session", xmpp_session_attr):tag("optional"):up():up(); |
| 263 end | 261 end |
| 264 end); | 262 end); |
