aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2023-07-05 15:16:31 -0400
committerAdam Harrison <adamdharrison@gmail.com>2023-07-05 15:16:31 -0400
commit57092d80cb07fa1a84873769fa92165426196054 (patch)
treed772b6459496751f0a88462c59ccd8c2806e7ba0
parent1bb58d8e1c3b6396eafcc6f8b069cc75650cc19e (diff)
downloadlite-xl-plugin-manager-57092d80cb07fa1a84873769fa92165426196054.tar.gz
lite-xl-plugin-manager-57092d80cb07fa1a84873769fa92165426196054.zip
Added in better traceability.
-rwxr-xr-xbuild.sh2
-rw-r--r--src/lpm.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index d05008a..01844a3 100755
--- a/build.sh
+++ b/build.sh
@@ -7,7 +7,7 @@
: ${JOBS=4}
SRCS="src/*.c"
-CFLAGS="$CFLAGS -Ilib/prefix/include"
+CFLAGS="$CFLAGS -DMBEDTLS_DEBUG_C -Ilib/prefix/include"
LDFLAGS="$LDFLAGS -lm -Llib/prefix/lib"
[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/libzip/build lib/mbedtls-2.27.0/build lib/prefix lua $BIN *.exe src/lpm.luac src/lpm.lua.c && exit 0
diff --git a/src/lpm.c b/src/lpm.c
index dbe01bf..c557542 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -543,6 +543,10 @@ static int lpm_certs(lua_State* L) {
if (strcmp(type, "noverify") == 0) {
no_verify_ssl = 1;
mbedtls_ssl_conf_authmode(&ssl_config, MBEDTLS_SSL_VERIFY_OPTIONAL);
+ if (print_trace) {
+ fprintf(stderr, "[ssl] SSL verify set to optional.\n");
+ fflush(stderr);
+ }
} else {
const char* path = luaL_checkstring(L, 2);
if (strcmp(type, "dir") == 0) {
@@ -550,6 +554,10 @@ 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);
+ if (print_trace) {
+ fprintf(stderr, "[ssl] SSL directory set to %s.\n", git_cert_path);
+ fflush(stderr);
+ }
} else {
if (strcmp(type, "system") == 0) {
#if _WIN32
@@ -578,6 +586,10 @@ static int lpm_certs(lua_State* L) {
}
fclose(file);
CertCloseStore(hSystemStore, 0);
+ if (print_trace) {
+ fprintf(stderr, "[ssl] SSL file pulled from system store and written to %s.\n", path);
+ fflush(stderr);
+ }
#elif __APPLE__ // https://developer.apple.com/forums/thread/691009; see also curl's mac version
return luaL_error(L, "can't use system on mac yet");
#else
@@ -591,6 +603,10 @@ static int lpm_certs(lua_State* L) {
if ((status = mbedtls_x509_crt_parse_file(&x509_certificate, path)) != 0)
return luaL_mbedtls_error(L, status, "mbedtls_x509_crt_parse_file failed to parse CA certificate %s", path);
mbedtls_ssl_conf_ca_chain(&ssl_config, &x509_certificate, NULL);
+ if (print_trace) {
+ fprintf(stderr, "[ssl] SSL file set to %s.\n", path);
+ fflush(stderr);
+ }
}
}
return 0;