aboutsummaryrefslogtreecommitdiff
path: root/src/lpm.c
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2022-12-31 16:26:29 -0500
committerAdam Harrison <adamdharrison@gmail.com>2022-12-31 16:26:29 -0500
commite27fa61bd6592a8160177f179a8a3de77674399a (patch)
tree4acf21ef47bd4a0ab2877036a6d594c2b73f6e51 /src/lpm.c
parent71e1d5f3534ea1663d136fef238f7d4786ed15bd (diff)
downloadlite-xl-plugin-manager-e27fa61bd6592a8160177f179a8a3de77674399a.tar.gz
lite-xl-plugin-manager-e27fa61bd6592a8160177f179a8a3de77674399a.zip
Updating things to work with 0.9.
Diffstat (limited to 'src/lpm.c')
-rw-r--r--src/lpm.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lpm.c b/src/lpm.c
index 7d1b4a9..21012ca 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -352,9 +352,7 @@ static int lpm_init(lua_State* L) {
return 0;
}
-static int no_verify_ssl = 0;
-static int has_setup_ssl = 0;
-static int print_trace = 0;
+static int no_verify_ssl, has_setup_ssl, print_trace;
static mbedtls_x509_crt x509_certificate;
static mbedtls_entropy_context entropy_context;
static mbedtls_ctr_drbg_context drbg_context;
@@ -362,7 +360,7 @@ static mbedtls_ssl_config ssl_config;
static mbedtls_ssl_context ssl_context;
static int lpm_git_transport_certificate_check_cb(struct git_cert *cert, int valid, const char *host, void *payload) {
- return 0;
+ return 0; // If no_verify_ssl is enabled, basically always return 0 when this is set as callback.
}
static int lpm_fetch(lua_State* L) {
@@ -425,8 +423,7 @@ static void lpm_libgit2_debug(git_trace_level_t level, const char *msg) {
}
static int lpm_trace(lua_State* L) {
- int trace = lua_toboolean(L, 1);
- print_trace = trace ? 1 : 0;
+ print_trace = lua_toboolean(L, 1) ? 1 : 0;
return 0;
}
@@ -818,12 +815,12 @@ static int lpm_get(lua_State* L) {
}
lua_newtable(L);
cleanup:
- if (ssl_ctx) {
+ if (ssl_ctx)
mbedtls_ssl_free(ssl_ctx);
+ if (net_ctx)
mbedtls_net_free(net_ctx);
- } else if (s != -2) {
+ if (s != -2)
close(s);
- }
if (err[0])
return luaL_error(L, "%s", err);
return 2;