Mercurial > prosody-hg
comparison util/openssl.lua @ 5290:befb1923527d
util.openssl: Cleanup; remove some unused variables.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 07 Jan 2013 04:07:25 +0100 |
| parents | a61e78b4a2b3 |
| children | 27de7cc94111 |
comparison
equal
deleted
inserted
replaced
| 5289:ec50ad93e280 | 5290:befb1923527d |
|---|---|
| 70 | 70 |
| 71 local function ia5string(s) | 71 local function ia5string(s) |
| 72 return s_format("IA5STRING:%s", s); | 72 return s_format("IA5STRING:%s", s); |
| 73 end | 73 end |
| 74 | 74 |
| 75 local util = {}; | |
| 76 _M.util = { | 75 _M.util = { |
| 77 utf8string = utf8string, | 76 utf8string = utf8string, |
| 78 ia5string = ia5string, | 77 ia5string = ia5string, |
| 79 }; | 78 }; |
| 80 | |
| 81 local function xmppAddr(t, host) | |
| 82 end | |
| 83 | 79 |
| 84 function ssl_config:add_dNSName(host) | 80 function ssl_config:add_dNSName(host) |
| 85 t_insert(self.subject_alternative_name.DNS, idna_to_ascii(host)); | 81 t_insert(self.subject_alternative_name.DNS, idna_to_ascii(host)); |
| 86 end | 82 end |
| 87 | 83 |
| 93 function ssl_config:add_xmppAddr(host) | 89 function ssl_config:add_xmppAddr(host) |
| 94 t_insert(self.subject_alternative_name.otherName, | 90 t_insert(self.subject_alternative_name.otherName, |
| 95 s_format("%s;%s", oid_xmppaddr, utf8string(host))); | 91 s_format("%s;%s", oid_xmppaddr, utf8string(host))); |
| 96 end | 92 end |
| 97 | 93 |
| 98 function ssl_config:from_prosody(hosts, config, certhosts, raw) | 94 function ssl_config:from_prosody(hosts, config, certhosts) |
| 99 -- TODO Decide if this should go elsewhere | 95 -- TODO Decide if this should go elsewhere |
| 100 local found_matching_hosts = false; | 96 local found_matching_hosts = false; |
| 101 for i = 1,#certhosts do | 97 for i = 1,#certhosts do |
| 102 local certhost = certhosts[i]; | 98 local certhost = certhosts[i]; |
| 103 for name, host in pairs(hosts) do | 99 for name in pairs(hosts) do |
| 104 if name == certhost or name:sub(-1-#certhost) == "."..certhost then | 100 if name == certhost or name:sub(-1-#certhost) == "."..certhost then |
| 105 found_matching_hosts = true; | 101 found_matching_hosts = true; |
| 106 self:add_dNSName(name); | 102 self:add_dNSName(name); |
| 107 --print(name .. "#component_module: " .. (config.get(name, "core", "component_module") or "nil")); | 103 --print(name .. "#component_module: " .. (config.get(name, "core", "component_module") or "nil")); |
| 108 if config.get(name, "core", "component_module") == nil then | 104 if config.get(name, "core", "component_module") == nil then |
| 135 if v ~= true then | 131 if v ~= true then |
| 136 t_insert(r, ("'%s'"):format(shell_escape(tostring(v)))); | 132 t_insert(r, ("'%s'"):format(shell_escape(tostring(v)))); |
| 137 end | 133 end |
| 138 end | 134 end |
| 139 end | 135 end |
| 140 for k,v in ipairs(o) do | 136 for _,v in ipairs(o) do |
| 141 t_insert(r, ("'%s'"):format(shell_escape(tostring(v)))); | 137 t_insert(r, ("'%s'"):format(shell_escape(tostring(v)))); |
| 142 end | 138 end |
| 143 return t_concat(r, " "); | 139 return t_concat(r, " "); |
| 144 end | 140 end |
| 145 | 141 |
| 146 local os_execute = os.execute; | 142 local os_execute = os.execute; |
| 147 setmetatable(_M, { | 143 setmetatable(_M, { |
| 148 __index=function(self,f) | 144 __index=function(_,f) |
| 149 return function(opts) | 145 return function(opts) |
| 150 return 0 == os_execute(serialize(f, type(opts) == "table" and opts or {})); | 146 return 0 == os_execute(serialize(f, type(opts) == "table" and opts or {})); |
| 151 end; | 147 end; |
| 152 end; | 148 end; |
| 153 }); | 149 }); |
