Software / code / prosody
Comparison
plugins/mod_admin_shell.lua @ 13517:4bf889e94831
mod_admin_shell: Prevent traceback due to type error
Here too
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 26 Aug 2024 22:26:59 +0200 |
| parent | 13489:ae65f199f408 |
| child | 13540:cc67109ce502 |
comparison
equal
deleted
inserted
replaced
| 13516:078780f262d5 | 13517:4bf889e94831 |
|---|---|
| 976 elseif cert_status then | 976 elseif cert_status then |
| 977 -- basically only "valid" | 977 -- basically only "valid" |
| 978 return capitalize(cert_status); | 978 return capitalize(cert_status); |
| 979 end | 979 end |
| 980 -- no certificate status, | 980 -- no certificate status, |
| 981 if session.cert_chain_errors then | 981 if type(session.cert_chain_errors) == "table" then |
| 982 local cert_errors = set.new(session.cert_chain_errors[1]); | 982 local cert_errors = set.new(session.cert_chain_errors[1]); |
| 983 if cert_errors:contains("certificate has expired") then | 983 if cert_errors:contains("certificate has expired") then |
| 984 return "Expired"; | 984 return "Expired"; |
| 985 elseif cert_errors:contains("self signed certificate") then | 985 elseif cert_errors:contains("self signed certificate") then |
| 986 return "Self-signed"; | 986 return "Self-signed"; |
| 987 end | 987 end |
| 988 -- Some other cert issue, or something up the chain | 988 -- Some other cert issue, or something up the chain |
| 989 -- TODO borrow more logic from mod_s2s/friendly_cert_error() | 989 -- TODO borrow more logic from mod_s2s/friendly_cert_error() |
| 990 return "Untrusted"; | 990 return "Untrusted"; |
| 991 end | 991 end |
| 992 -- TODO cert_chain_errors can be a string, handle that | |
| 992 return "Unknown"; | 993 return "Unknown"; |
| 993 end; | 994 end; |
| 994 }; | 995 }; |
| 995 sni = { | 996 sni = { |
| 996 title = "SNI"; | 997 title = "SNI"; |