Software /
code /
prosody
Comparison
util/prosodyctl/cert.lua @ 12169:866d06644956
util.prosodyctl.cert: Fix boolean logic bug
Boolean logic, never correct on the first try.
We want to skip copying the same cert if it _has_ been imported already,
not if it has not.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Jan 2022 21:47:04 +0100 |
parent | 12107:8a5a9c1adb90 |
child | 12199:12eaa2fdd75b |
comparison
equal
deleted
inserted
replaced
12168:33e856c65033 | 12169:866d06644956 |
---|---|
221 cm.index_certs(dir, files_by_name); | 221 cm.index_certs(dir, files_by_name); |
222 end | 222 end |
223 local imported = {}; | 223 local imported = {}; |
224 for _, host in ipairs(hostnames) do | 224 for _, host in ipairs(hostnames) do |
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 not 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 copy(paths.certificate, cert_basedir .. "/" .. host .. ".crt", nil, owner, group); |
231 copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group); | 231 copy(paths.key, cert_basedir .. "/" .. host .. ".key", "0377", owner, group); |