Comparison

core/certmanager.lua @ 7319:afa83f3ccaad

certmanager: Explicitly tonumber() version number segments before doing arithmetic and avoid relying on implicit coercion (thanks David Favro)
author Matthew Wild <mwild1@gmail.com>
date Sat, 26 Mar 2016 19:55:08 +0000
parent 7160:5c1ee8c06235
child 7531:2db68d1a6eeb
comparison
equal deleted inserted replaced
7317:a2dce746599b 7319:afa83f3ccaad
34 local prosody = prosody; 34 local prosody = prosody;
35 local resolve_path = require"util.paths".resolve_relative_path; 35 local resolve_path = require"util.paths".resolve_relative_path;
36 local config_path = prosody.paths.config; 36 local config_path = prosody.paths.config;
37 37
38 local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)"); 38 local luasec_major, luasec_minor = ssl._VERSION:match("^(%d+)%.(%d+)");
39 local luasec_version = luasec_major * 100 + luasec_minor; 39 local luasec_version = tonumber(luasec_major) * 100 + tonumber(luasec_minor);
40 local luasec_has = { 40 local luasec_has = {
41 -- TODO If LuaSec ever starts exposing these things itself, use that instead 41 -- TODO If LuaSec ever starts exposing these things itself, use that instead
42 cipher_server_preference = luasec_version >= 2; 42 cipher_server_preference = luasec_version >= 2;
43 no_ticket = luasec_version >= 4; 43 no_ticket = luasec_version >= 4;
44 no_compression = luasec_version >= 5; 44 no_compression = luasec_version >= 5;