Mercurial > prosody-hg
comparison core/certmanager.lua @ 2997:6ccaefea80ec
Merge with tip.
| author | Tobias Markmann <tm@ayena.de> |
|---|---|
| date | Fri, 12 Mar 2010 18:41:05 +0100 |
| parents | 7339c2720b39 |
| children | 9bb2da325d4d 3976bad56640 |
comparison
equal
deleted
inserted
replaced
| 2996:b0515ed4d9d7 | 2997:6ccaefea80ec |
|---|---|
| 1 local configmanager = require "core.configmanager"; | 1 local configmanager = require "core.configmanager"; |
| 2 local log = require "util.logger".init("certmanager"); | 2 local log = require "util.logger".init("certmanager"); |
| 3 local ssl = ssl; | 3 local ssl = ssl; |
| 4 local ssl_newcontext = ssl and ssl.newcontext; | 4 local ssl_newcontext = ssl and ssl.newcontext; |
| 5 | 5 |
| 6 local setmetatable = setmetatable; | 6 local setmetatable, tostring = setmetatable, tostring; |
| 7 | 7 |
| 8 local prosody = prosody; | 8 local prosody = prosody; |
| 9 | 9 |
| 10 module "certmanager" | 10 module "certmanager" |
| 11 | 11 |
| 37 reason = "Check that the permissions allow Prosody to read this file."; | 37 reason = "Check that the permissions allow Prosody to read this file."; |
| 38 elseif reason == "No such file or directory" then | 38 elseif reason == "No such file or directory" then |
| 39 reason = "Check that the path is correct, and the file exists."; | 39 reason = "Check that the path is correct, and the file exists."; |
| 40 elseif reason == "system lib" then | 40 elseif reason == "system lib" then |
| 41 reason = "Previous error (see logs), or other system error."; | 41 reason = "Previous error (see logs), or other system error."; |
| 42 elseif reason == "(null)" or not reason then | |
| 43 reason = "Check that the file exists and the permissions are correct"; | |
| 42 else | 44 else |
| 43 reason = "Reason: "..tostring(reason or "unknown"):lower(); | 45 reason = "Reason: "..tostring(reason):lower(); |
| 44 end | 46 end |
| 45 log("error", "SSL/TLS: Failed to load %s: %s", file, reason); | 47 log("error", "SSL/TLS: Failed to load %s: %s", file, reason); |
| 46 else | 48 else |
| 47 log("error", "SSL/TLS: Error initialising for host %s: %s", host, err ); | 49 log("error", "SSL/TLS: Error initialising for host %s: %s", host, err ); |
| 48 end | 50 end |
| 52 end | 54 end |
| 53 return nil; | 55 return nil; |
| 54 end | 56 end |
| 55 | 57 |
| 56 function reload_ssl_config() | 58 function reload_ssl_config() |
| 57 default_ssl_config = config.get("*", "core", "ssl"); | 59 default_ssl_config = configmanager.get("*", "core", "ssl"); |
| 58 end | 60 end |
| 59 | 61 |
| 60 prosody.events.add_handler("config-reloaded", reload_ssl_config); | 62 prosody.events.add_handler("config-reloaded", reload_ssl_config); |
| 61 | 63 |
| 62 return _M; | 64 return _M; |
