Mercurial > prosody-modules
comparison mod_client_management/mod_client_management.lua @ 5878:13094c707414
mod_client_management: Prevent exception on missing client info
> attempt to index a nil value (local 'legacy_info')
Unsure how exactly this happens, perhaps by mixing SASL2/BIND2 with
legacy equivalents?
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 06 Apr 2024 13:04:35 +0200 |
| parents | e199f33f7a2e |
| children | 96dda21fba75 |
comparison
equal
deleted
inserted
replaced
| 5877:70fa3f8de249 | 5878:13094c707414 |
|---|---|
| 114 legacy = true; | 114 legacy = true; |
| 115 }; | 115 }; |
| 116 end | 116 end |
| 117 | 117 |
| 118 -- Update state | 118 -- Update state |
| 119 local legacy_info = session.client_management_info; | |
| 120 client_state.full_jid = session.full_jid; | 119 client_state.full_jid = session.full_jid; |
| 121 client_state.last_seen = now; | 120 client_state.last_seen = now; |
| 122 client_state.mechanisms[legacy_info.mechanism] = now; | 121 |
| 123 if legacy_info.fast_auth then | 122 local legacy_info = session.client_management_info; |
| 124 client_state.fast_auth = now; | 123 if legacy_info then |
| 125 end | 124 client_state.mechanisms[legacy_info.mechanism] = now; |
| 126 | 125 if legacy_info.fast_auth then |
| 127 local token_id = legacy_info.token_info and legacy_info.token_info.id; | 126 client_state.fast_auth = now; |
| 128 if token_id then | 127 end |
| 129 client_state.auth_token_id = token_id; | 128 |
| 129 local token_id = legacy_info.token_info and legacy_info.token_info.id; | |
| 130 if token_id then | |
| 131 client_state.auth_token_id = token_id; | |
| 132 end | |
| 133 else | |
| 134 session.log("warn", "Missing client management info") | |
| 130 end | 135 end |
| 131 | 136 |
| 132 -- Store updated state | 137 -- Store updated state |
| 133 client_store:set_key(session.username, client_state.id, client_state); | 138 client_store:set_key(session.username, client_state.id, client_state); |
| 134 | 139 |
