225 local paths = cm.find_cert_in_index(files_by_name, host); |
225 local paths = cm.find_cert_in_index(files_by_name, host); |
226 if paths and imported[paths.certificate] then |
226 if paths and imported[paths.certificate] then |
227 -- One certificate, many mames! |
227 -- One certificate, many mames! |
228 table.insert(imported, host); |
228 table.insert(imported, host); |
229 elseif paths then |
229 elseif paths then |
230 copy(paths.certificate, cert_basedir .. "/" .. host .. ".crt", nil, owner, group); |
230 local c = copy(paths.certificate, cert_basedir .. "/" .. host .. ".crt", nil, owner, group); |
231 copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group); |
231 local k = copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group); |
232 table.insert(imported, host); |
232 if c and k then |
233 imported[paths.certificate] = true; |
233 table.insert(imported, host); |
|
234 imported[paths.certificate] = true; |
|
235 else |
|
236 if not c then pctl.show_warning("Could not copy certificate '%s'", paths.certificate); end |
|
237 if not k then pctl.show_warning("Could not copy key '%s'", paths.key); end |
|
238 end |
234 else |
239 else |
235 -- TODO Say where we looked |
240 -- TODO Say where we looked |
236 pctl.show_warning("No certificate for host %s found :(", host); |
241 pctl.show_warning("No certificate for host %s found :(", host); |
237 end |
242 end |
238 -- TODO Additional checks |
243 -- TODO Additional checks |