aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-01-07 12:00:44 -0500
committerAdam Harrison <adamdharrison@gmail.com>2024-01-07 12:00:44 -0500
commitdd4119770bc2c90c198f92ed17c0272c2e5e7cd2 (patch)
treefcc4f7fe08ebeaeb453d0fcf1ba3539da4977319
parent1feceeabd86785c8edb291143edaeace9d2be22b (diff)
downloadlite-xl-plugin-manager-dd4119770bc2c90c198f92ed17c0272c2e5e7cd2.tar.gz
lite-xl-plugin-manager-dd4119770bc2c90c198f92ed17c0272c2e5e7cd2.zip
Added in changes from @parnikkapore to fix ssl certificates in a directory.
-rw-r--r--src/lpm.c8
-rw-r--r--src/lpm.lua4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/lpm.c b/src/lpm.c
index 2b6faf2..e614592 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -570,6 +570,14 @@ static int lpm_certs(lua_State* L) {
if (git_initialized)
git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, NULL, path);
strncpy(git_cert_path, path, MAX_PATH);
+ status = mbedtls_x509_crt_parse_path(&x509_certificate, path);
+ if (status < 0)
+ return luaL_mbedtls_error(L, status, "mbedtls_x509_crt_parse_path failed to parse all CA certificates in %s", path);
+ if (status > 0 && print_trace) {
+ fprintf(stderr, "[ssl] mbedtls_x509_crt_parse_path on %s failed to parse %d certificates, but still succeeded.\n", path, status);
+ fflush(stderr);
+ }
+ mbedtls_ssl_conf_ca_chain(&ssl_config, &x509_certificate, NULL);
if (print_trace) {
fprintf(stderr, "[ssl] SSL directory set to %s.\n", git_cert_path);
fflush(stderr);
diff --git a/src/lpm.lua b/src/lpm.lua
index 4222db5..db05a92 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -668,7 +668,7 @@ function Addon:unstub()
repo = Repository.url(self.remote):fetch_if_not_present()
local manifest = repo:parse_manifest(self.id)
local remote_entry = common.grep(manifest['addons'] or manifest['plugins'], function(e) return e.id == self.id end)[1]
- if not remote_entry then error("can't find " .. self.type .. " on " .. self.remote) end
+ if not remote_entry then error("can't find " .. self.type .. " " .. self.id .. " on " .. self.remote) end
local addon = Addon.new(repo, remote_entry)
-- merge in attribtues that are probably more accurate than the stub
@@ -770,7 +770,7 @@ end
function Addon:install(bottle, installing)
if self:is_installed(bottle) and not REINSTALL then error("addon " .. self.id .. " is already installed") return end
if self:is_stub() then self:unstub() end
- if self.inaccessible then error("addon " .. self.id .. " is inacessible: " .. self.inaccessible) end
+ if self.inaccessible then error("addon " .. self.id .. " is inaccessible: " .. self.inaccessible) end
local install_path = self:get_install_path(bottle)
if install_path:find(USERDIR, 1, true) ~= 1 and install_path:find(TMPDIR, 1, true) ~= 1 then error("invalid install path: " .. install_path) end
local temporary_install_path = TMPDIR .. PATHSEP .. install_path:sub(((install_path:find(TMPDIR, 1, true) == 1) and #TMPDIR or #USERDIR) + 2)