From 78c5abdb3e3236520b485a269d178bf382da0eeb Mon Sep 17 00:00:00 2001 From: Rui Rafael Date: Tue, 7 May 2024 14:05:25 +0100 Subject: [PATCH 1/4] Removed http_init() from child process. --- upload-queue.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/upload-queue.c b/upload-queue.c index fb5435ff..8c03ec3a 100644 --- a/upload-queue.c +++ b/upload-queue.c @@ -373,11 +373,6 @@ static void upload_queue_run(const struct session *session, unsigned const char signal(SIGALRM, upload_queue_cleanup); setvbuf(stdout, NULL, _IOLBF, 0); - if (http_init()) { - lpass_log(LOG_ERROR, "UQ: unable to restart curl\n"); - _exit(EXIT_FAILURE); - } - lpass_log(LOG_DEBUG, "UQ: starting queue run\n"); upload_queue_upload_all(session, key); lpass_log(LOG_DEBUG, "UQ: queue run complete\n"); From 6269518fdf5144d2a78f9a10257fae3f995942fc Mon Sep 17 00:00:00 2001 From: Rui Rafael Date: Wed, 8 May 2024 08:48:06 +0100 Subject: [PATCH 2/4] Temporary commented curl_easy_cleanup --- http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http.c b/http.c index c6b62b97..b6b8016b 100644 --- a/http.c +++ b/http.c @@ -316,7 +316,7 @@ char *http_post_lastpass_v_noexit(const char *server, const char *page, const st unset_interrupt_detect(); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, http_code); - curl_easy_cleanup(curl); + //curl_easy_cleanup(curl); *curl_ret = ret; if (ret != CURLE_OK) { From 354f9b9d9dd86e7f61400cbc1da5078834a7ef33 Mon Sep 17 00:00:00 2001 From: Rui Rafael Date: Mon, 13 May 2024 09:07:16 +0100 Subject: [PATCH 3/4] Updated CMakeLists to link with homebrew libraries --- CMakeLists.txt | 69 +++++++++++++++++++++++++++++++++++++++++--------- http.c | 2 +- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e30d9fd7..7540b314 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,15 @@ -IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.1) +if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.1) set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake > 2.8.4 is required cmake_minimum_required(VERSION 2.8) -ELSE() +else() cmake_minimum_required(VERSION 3.1) -ENDIF() +endif() project(lpass) include(GNUInstallDirs) find_package(PkgConfig REQUIRED) -IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.4) +if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.4) # pkg_get_variable is not available until CMake >= 3.4.0 # Debian oldstable still packages CMake 3.0.2 function(pkg_get_variable _output_name _pkg _name) @@ -25,19 +25,64 @@ IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.4) set(BASH_COMPLETION_FOUND TRUE) endif() -ELSE() +else() include(FindPkgConfig) pkg_search_module(BASH_COMPLETION bash-completion) -ENDIF() - -if((APPLE) AND (NOT DEFINED OPENSSL_ROOT_DIR)) - set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl") endif() -if((APPLE)) - set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/curl/lib/pkgconfig") +if(APPLE) + find_program(BREW_INSTALLED BREW) + + if(BREW_INSTALLED) + function(get_brew_packageconfig_path _package_name _output_variable) + execute_process(COMMAND brew --cellar ${_package_name} + RESULT_VARIABLE _result_var_cellar + OUTPUT_VARIABLE _output_variable_cellar + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(_result_var_cellar AND NOT STATUS EQUAL 0) + message(STATUS "Unable to obtain homebrew cellar location for package ${_package_name}. Error: ${_result_var_cellar}") + else() + execute_process(COMMAND find "${_output_variable_cellar}/" -type d -name pkgconfig + COMMAND tr -d '\n' + COMMAND tr -s '/' + RESULT_VARIABLE _brew_pkgconfig_c + OUTPUT_VARIABLE _brew_pkgconfig_cellar + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + + execute_process(COMMAND brew --prefix ${_package_name} + RESULT_VARIABLE _result_var_prefix + OUTPUT_VARIABLE _output_variable_prefix + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(_result_var_prefix AND NOT STATUS EQUAL 0) + message(STATUS "Unable to obtain homebrew prefix location for package ${_package_name}. Error: ${_result_var_cellar}") + else() + execute_process(COMMAND find "${_output_variable_prefix}/" -type d -name pkgconfig + COMMAND tr -d '\n' + COMMAND tr -s '/' + RESULT_VARIABLE _brew_pkgconfig_p + OUTPUT_VARIABLE _brew_pkgconfig_prefix + OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + + set("${_output_variable}" "${_brew_pkgconfig_cellar}:${_brew_pkgconfig_prefix}" CACHE STRING "pkg-config homebrew locations for ${_package_name}") + + endfunction() + + # Get pkg-config paths for curl/openssl installed via homebrew + get_brew_packageconfig_path("curl" BREW_CURL) + get_brew_packageconfig_path("openssl" BREW_OPENSSL) + + set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl:${BREW_CURL}:${BREW_OPENSSL}") + message(STATUS "PKG_CONFIG_PATH: $ENV{PKG_CONFIG_PATH}") + else() + set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/openssl") + endif() + endif() find_package(LibXml2 REQUIRED) @@ -136,4 +181,4 @@ add_custom_target(doc-man DEPENDS lpass.1) add_custom_target(doc-html DEPENDS lpass.1.html) # See https://cmake.org/pipermail/cmake/2009-January/026520.html add_custom_target(install-doc COMMAND ${CMAKE_COMMAND} -DMANDIR=${CMAKE_INSTALL_FULL_MANDIR} -P ${CMAKE_SOURCE_DIR}/cmake_extras/install_doc.cmake DEPENDS doc-man) -add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -DPROJECT_NAME=${PROJECT_NAME} -DMANDIR=${CMAKE_INSTALL_FULL_MANDIR} -P ${CMAKE_SOURCE_DIR}/cmake_extras/uninstall.cmake) +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -DPROJECT_NAME=${PROJECT_NAME} -DMANDIR=${CMAKE_INSTALL_FULL_MANDIR} -P ${CMAKE_SOURCE_DIR}/cmake_extras/uninstall.cmake) \ No newline at end of file diff --git a/http.c b/http.c index b6b8016b..c6b62b97 100644 --- a/http.c +++ b/http.c @@ -316,7 +316,7 @@ char *http_post_lastpass_v_noexit(const char *server, const char *page, const st unset_interrupt_detect(); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, http_code); - //curl_easy_cleanup(curl); + curl_easy_cleanup(curl); *curl_ret = ret; if (ret != CURLE_OK) { From 737e7ce02cc35093f22f2628ba278608b285f889 Mon Sep 17 00:00:00 2001 From: Rui Rafael Date: Tue, 14 May 2024 10:33:18 +0100 Subject: [PATCH 4/4] Readded line reak --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7540b314..efc6ba04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,4 +181,4 @@ add_custom_target(doc-man DEPENDS lpass.1) add_custom_target(doc-html DEPENDS lpass.1.html) # See https://cmake.org/pipermail/cmake/2009-January/026520.html add_custom_target(install-doc COMMAND ${CMAKE_COMMAND} -DMANDIR=${CMAKE_INSTALL_FULL_MANDIR} -P ${CMAKE_SOURCE_DIR}/cmake_extras/install_doc.cmake DEPENDS doc-man) -add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -DPROJECT_NAME=${PROJECT_NAME} -DMANDIR=${CMAKE_INSTALL_FULL_MANDIR} -P ${CMAKE_SOURCE_DIR}/cmake_extras/uninstall.cmake) \ No newline at end of file +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -DPROJECT_NAME=${PROJECT_NAME} -DMANDIR=${CMAKE_INSTALL_FULL_MANDIR} -P ${CMAKE_SOURCE_DIR}/cmake_extras/uninstall.cmake)