aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2022-11-29 19:55:35 -0500
committerAdam Harrison <adamdharrison@gmail.com>2022-11-29 19:55:35 -0500
commit46060099915c98b629cbe01adc37ec2dfa07ac50 (patch)
tree79cbd5c232ab1009da92e84b5899f6ddd2efa316
parent31971b85c256158c731149c4ae9cd40dc086f908 (diff)
downloadlite-xl-plugin-manager-46060099915c98b629cbe01adc37ec2dfa07ac50.tar.gz
lite-xl-plugin-manager-46060099915c98b629cbe01adc37ec2dfa07ac50.zip
Fixed certificate conversion.
-rwxr-xr-xbuild.sh4
-rw-r--r--src/lpm.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 9abe8fb..cb44af5 100755
--- a/build.sh
+++ b/build.sh
@@ -32,7 +32,7 @@ if [[ "$@" != *"-llzma"* ]]; then
LDFLAGS="-Llib/liblzma/build -Llib/prefix/lib -l:liblzma.a $LDFLAGS" && CFLAGS="$CFLAGS -Ilib/prefix/include"
fi
if [[ "$@" != *"-larchive"* ]]; then
- [ ! -e "lib/libarchive/build-tmp" ] && cd lib/libarchive && mkdir build-tmp && cd build-tmp && cmake .. -G "Unix Makefiles" $ARCHIVE_CONFIGURE $CMAKE_DEFAULT_FLAGS -DZLIB_WINAPI_EXITCODE=0 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DENABLE_TEST=OFF -DZLIB_WINAPI_EXITCODE__TRYRUN_OUTPUT="test" -DENABLE_EXPAT=OFF -DENABLE_ACL=OFF -DENABLE_XATTR=OFF -DENABLE_CAT=OFF -DENABLE_CPIO=OFF -DENABLE_ZSTD=OFF -DENABLE_BZip2=OFF -DENABLE_OPENSSL=OFF -DENABLE_LIBXML2=OFF -DENABLE_PCREPOSIX=OFF && $MAKE -j $JOBS && $MAKE install && cd ../../../
+ [ ! -e "lib/libarchive/build-tmp" ] && cd lib/libarchive && mkdir build-tmp && cd build-tmp && cmake .. -G "Unix Makefiles" $ARCHIVE_CONFIGURE $CMAKE_DEFAULT_FLAGS -DENABLE_ICONV=OFF -DZLIB_WINAPI_EXITCODE=0 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DENABLE_TEST=OFF -DZLIB_WINAPI_EXITCODE__TRYRUN_OUTPUT="test" -DENABLE_EXPAT=OFF -DENABLE_ACL=OFF -DENABLE_XATTR=OFF -DENABLE_CAT=OFF -DENABLE_CPIO=OFF -DENABLE_ZSTD=OFF -DENABLE_BZip2=OFF -DENABLE_OPENSSL=OFF -DENABLE_LIBXML2=OFF -DENABLE_PCREPOSIX=OFF && $MAKE -j $JOBS && $MAKE install && cd ../../../
[ ! -e "lib/prefix/lib/libarchive.a" ] && cp -f lib/prefix/lib/libarchive_static.a lib/prefix/lib/libarchive.a
LDFLAGS="-Llib/libarchive/build-tmp -Llib/prefix/lib -l:libarchive.a $LDFLAGS" && CFLAGS="$CFLAGS -Ilib/prefix/include"
fi
@@ -44,7 +44,7 @@ fi
xxd -i src/lpm.luac > src/lpm.lua.c
[[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && LDFLAGS=" $LDFLAGS -ldl -pthread"
-[[ $OSTYPE == 'msys'* || $CC == *'mingw'* ]] && LDFLAGS="$LDFLAGS -lbcrypt -lws2_32 -lz -lwinhttp -lole32 -lcrypt32 -lrpcrt4 -liconv"
+[[ $OSTYPE == 'msys'* || $CC == *'mingw'* ]] && LDFLAGS="$LDFLAGS -lbcrypt -lws2_32 -lz -lwinhttp -lole32 -lcrypt32 -lrpcrt4"
[[ " $@" != *" -g"* && " $@" != *" -O"* ]] && CFLAGS="$CFLAGS -O3" && LDFLAGS="$LDFLAGS -s"
$CC $CFLAGS $SRCS $@ -o $BIN $LDFLAGS
diff --git a/src/lpm.c b/src/lpm.c
index fc9f352..5e5eac8 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -414,8 +414,8 @@ static int lpm_certs(lua_State* L) {
CryptBinaryToString(pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, CRYPT_STRING_BASE64HEADER, NULL, &size);
char* buffer = malloc(size);
CryptBinaryToString(pCertContext->pbCertEncoded, pCertContext->cbCertEncoded, CRYPT_STRING_BASE64HEADER, buffer, &size);
- free(buffer);
fwrite(buffer, sizeof(char), size, file);
+ free(buffer);
}
}
fclose(file);
@@ -426,7 +426,7 @@ static int lpm_certs(lua_State* L) {
}
git_libgit2_opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, path, NULL);
if ((status = mbedtls_x509_crt_parse_file(&x509_certificate, path)) != 0)
- return luaL_error(L, "mbedtls_x509_crt_parse_file failed to parse CA certificate (-0x%X)\n", -status);
+ return luaL_error(L, "mbedtls_x509_crt_parse_file failed to parse CA certificate %s: %d", path, -status);
mbedtls_ssl_conf_ca_chain(&ssl_config, &x509_certificate, NULL);
}
return 0;