0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-19 20:02:18 +02:00

Refactor: Move to simple default builds

* Remove individual feature flags in favor of a single `KPXC_MINIMAL` flag that removes advanced features from the build. Basic features are no longer guarded by feature flags.
* Basic features: Auto-Type, Yubikey, KeeShare
* Advanced features include: Browser (and passkeys), SSH Agent, and Secret Service
* Networking, Documentation, and Update Checking remain as feature flags to accommodate various distro requirements.

This change also cleans up the main CMakeLists.txt by re-arranging some content and placing macros into a dedicated include file. The minimum CMake version was bumped to 3.16.0 to conform to our minimum Ubuntu support of Focal (20.04). This also allows us to default to C++20, we fall back to C++17 for Qt versions less than 5.15.0 due to lack of support.

Lastly this change removes the KEEPASSXC_BUILD_TYPE="PreRelease" which is never used. We only support "Snapshot" and "Release" now.
This commit is contained in:
Jonathan White 2024-06-24 07:43:59 -04:00
parent e48ef80e9c
commit a5af525936
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
76 changed files with 743 additions and 1138 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2024 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
#
# This program is free software: you can redistribute it and/or modify
@ -14,119 +14,80 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.10.0)
cmake_minimum_required(VERSION 3.16.0)
project(KeePassXC)
set(APP_ID "org.keepassxc.${PROJECT_NAME}")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo Profile"
FORCE)
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug" OR CMAKE_BUILD_TYPE_LOWER STREQUAL "relwithdebinfo")
set(IS_DEBUG_BUILD TRUE)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Support Visual Studio Code
include(CMakeToolsHelpers OPTIONAL)
include(FeatureSummary)
include(KPXCMacDeployHelpers)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
option(WITH_TESTS "Enable building of unit tests" ON)
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
option(WITH_DEV_BUILD "Use only for development. Disables/warns about deprecated methods." OFF)
option(WITH_ASAN "Enable address sanitizer checks (Linux / macOS only)" OFF)
option(WITH_COVERAGE "Use to build with coverage tests (GCC only)." OFF)
option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON)
option(WITH_CCACHE "Use ccache for build" OFF)
set(WITH_XC_ALL OFF CACHE BOOL "Build in all available plugins")
option(WITH_XC_AUTOTYPE "Include Auto-Type." ON)
option(WITH_XC_NETWORKING "Include networking code (e.g. for downloading website icons)." OFF)
option(WITH_XC_BROWSER "Include browser integration with keepassxc-browser." OFF)
option(WITH_XC_BROWSER_PASSKEYS "Passkeys support for browser integration." OFF)
option(WITH_XC_YUBIKEY "Include YubiKey support." OFF)
option(WITH_XC_SSHAGENT "Include SSH agent support." OFF)
option(WITH_XC_KEESHARE "Sharing integration with KeeShare" OFF)
option(WITH_XC_UPDATECHECK "Include automatic update checks; disable for controlled distributions" ON)
if(UNIX AND NOT APPLE)
option(WITH_XC_FDOSECRETS "Implement freedesktop.org Secret Storage Spec server side API." OFF)
endif()
option(WITH_XC_DOCS "Enable building of documentation" ON)
set(WITH_XC_X11 ON CACHE BOOL "Enable building with X11 deps")
if(APPLE)
# Perform the platform checks before applying the stricter compiler flags.
# Otherwise the kSecAccessControlTouchIDCurrentSet deprecation warning will result in an error.
try_compile(XC_APPLE_COMPILER_SUPPORT_BIOMETRY
${CMAKE_CURRENT_BINARY_DIR}/tiometry_test/
${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_biometry_support.mm)
message(STATUS "Biometry compiler support: ${XC_APPLE_COMPILER_SUPPORT_BIOMETRY}")
try_compile(XC_APPLE_COMPILER_SUPPORT_TOUCH_ID
${CMAKE_CURRENT_BINARY_DIR}/touch_id_test/
${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_touch_id_support.mm)
message(STATUS "Touch ID compiler support: ${XC_APPLE_COMPILER_SUPPORT_TOUCH_ID}")
try_compile(XC_APPLE_COMPILER_SUPPORT_WATCH
${CMAKE_CURRENT_BINARY_DIR}/tiometry_test/
${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler-checks/macos/control_watch_support.mm)
message(STATUS "Apple watch compiler support: ${XC_APPLE_COMPILER_SUPPORT_WATCH}")
endif()
if(WITH_CCACHE)
# Use the Compiler Cache (ccache) program
# (install with: sudo apt get ccache)
find_program(CCACHE_FOUND ccache)
if(NOT CCACHE_FOUND)
message(FATAL_ERROR "ccache requested but cannot be found.")
endif()
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
endif()
if(WITH_XC_ALL)
# Enable all options (except update check and docs)
set(WITH_XC_AUTOTYPE ON)
set(WITH_XC_NETWORKING ON)
set(WITH_XC_BROWSER ON)
set(WITH_XC_BROWSER_PASSKEYS ON)
set(WITH_XC_YUBIKEY ON)
set(WITH_XC_SSHAGENT ON)
set(WITH_XC_KEESHARE ON)
if(UNIX AND NOT APPLE)
set(WITH_XC_FDOSECRETS ON)
endif()
endif()
# Prefer WITH_XC_NETWORKING setting over WITH_XC_UPDATECHECK
if(NOT WITH_XC_NETWORKING AND WITH_XC_UPDATECHECK)
message(STATUS "Disabling WITH_XC_UPDATECHECK because WITH_XC_NETWORKING is disabled")
set(WITH_XC_UPDATECHECK OFF)
endif()
if(UNIX AND NOT APPLE AND NOT WITH_XC_X11)
message(STATUS "Disabling WITH_XC_AUTOTYPE because WITH_XC_X11 is disabled")
set(WITH_XC_AUTOTYPE OFF)
endif()
# Version Number
set(KEEPASSXC_VERSION_MAJOR "2")
set(KEEPASSXC_VERSION_MINOR "8")
set(KEEPASSXC_VERSION_PATCH "0")
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION_MAJOR}.${KEEPASSXC_VERSION_MINOR}.${KEEPASSXC_VERSION_PATCH}")
set(OVERRIDE_VERSION "" CACHE STRING "Override the KeePassXC Version for Snapshot builds")
set(KEEPASSXC_BUILD_TYPE "Snapshot" CACHE STRING "Set KeePassXC build type to distinguish between stable releases and snapshots")
set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRelease)
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
# CMake Modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CMakeToolsHelpers OPTIONAL) # Support Visual Studio Code
include(FeatureSummary)
include(KPXCMacDeployHelpers)
include(CLangFormat)
include(CompilerFlags)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
# Build Scope
option(WITH_TESTS "Enable building of unit tests" ON)
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
option(WITH_WARN_DEPRECATED "Development only: warn about deprecated methods, including Qt." OFF)
option(WITH_ASAN "Enable address sanitizer checks (Linux / macOS only)" OFF)
option(WITH_COVERAGE "Use to build with coverage tests (GCC only)." OFF)
option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON)
option(WITH_CCACHE "Use ccache for build" OFF)
option(WITH_X11 "Enable building with X11 dependencies" ON)
# Advanced Features Control
option(KPXC_MINIMAL "Build KeePassXC with the minimal feature set required for basic usage" OFF)
option(KPXC_FEATURE_BROWSER "Browser integration and passkeys support" ON)
option(KPXC_FEATURE_SSHAGENT "SSH Agent integration" ON)
option(KPXC_FEATURE_FDOSECRETS "freedesktop.org Secret Service integration; replace system keyring" ON)
if(KPXC_MINIMAL)
# Disable advanced features in minimal mode
set(KPXC_FEATURE_BROWSER OFF)
set(KPXC_FEATURE_SSHAGENT OFF)
set(KPXC_FEATURE_FDOSECRETS OFF)
endif()
# Minor Feature Flags
option(KPXC_FEATURE_NETWORK "Include code that reaches out to external networks (e.g. downloading icons)" ON)
option(KPXC_FEATURE_UPDATES "Include automatic update checks; disable for managed distributions" ON)
option(KPXC_FEATURE_DOCS "Build offline documentation; requires asciidoctor tool" ON)
# Reconcile update feature with overall network feature
if(NOT KPXC_FEATURE_NETWORK AND KPXC_FEATURE_UPDATES)
message(STATUS "Disabling KPXC_FEATURE_UPDATES because KPXC_FEATURE_NETWORK is disabled")
set(KPXC_FEATURE_UPDATES OFF)
endif()
# FDO Secrets is only available on Linux
if(NOT UNIX OR APPLE OR HAIKU)
set(KPXC_FEATURE_FDOSECRETS OFF)
endif()
# Define feature summaries
add_feature_info("Browser" KPXC_FEATURE_BROWSER "Browser integration and passkeys support")
add_feature_info("SSH Agent" KPXC_FEATURE_SSHAGENT "SSH Agent integration")
if(UNIX AND NOT APPLE)
add_feature_info("Secret Service" KPXC_FEATURE_FDOSECRETS "Replace system keyring with freedesktop.org Secret Service integration")
endif()
add_feature_info("Networking" KPXC_FEATURE_NETWORK "Code that can reach out to external networks is included (e.g. downloading icons)")
add_feature_info("Update Checks" KPXC_FEATURE_UPDATES "Periodic update checks can be performed")
add_feature_info("Documentation" KPXC_FEATURE_DOCS "Offline documentation")
# Retrieve git HEAD revision hash
set(GIT_HEAD_OVERRIDE "" CACHE STRING "Manually set the Git HEAD hash when missing (eg, when no .git folder exists)")
@ -142,7 +103,12 @@ elseif(EXISTS ${CMAKE_SOURCE_DIR}/.gitrev)
endif()
message(STATUS "Found Git HEAD Revision: ${GIT_HEAD}\n")
# Check if on a tag, if so build as a release
# KeePassXC Versioning and Build Type
set(OVERRIDE_VERSION "" CACHE STRING "Override the KeePassXC Version for Snapshot builds")
set(KEEPASSXC_BUILD_TYPE "Snapshot" CACHE STRING "Set KeePassXC build type to distinguish between stable releases and snapshots")
set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release)
# Check if on a tag or has .version file, if so build as a release
execute_process(COMMAND git tag --points-at HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG
@ -157,67 +123,103 @@ endif()
string(REGEX REPLACE "(\r?\n)+" "" OVERRIDE_VERSION "${OVERRIDE_VERSION}")
if(OVERRIDE_VERSION)
if(OVERRIDE_VERSION MATCHES "^[\\.0-9]+-beta[0-9]*")
set(KEEPASSXC_BUILD_TYPE "PreRelease")
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
if(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
set(KEEPASSXC_BUILD_TYPE "Release")
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
else()
set(KEEPASSXC_BUILD_TYPE "Snapshot")
set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
endif()
else()
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease")
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
endif()
endif()
if(KEEPASSXC_BUILD_TYPE STREQUAL "Release")
set(KEEPASSXC_BUILD_TYPE_RELEASE ON)
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease")
set(KEEPASSXC_BUILD_TYPE_PRE_RELEASE ON)
else()
set(KEEPASSXC_BUILD_TYPE_SNAPSHOT ON)
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")
endif()
message(STATUS "Setting up build for KeePassXC v${KEEPASSXC_VERSION}\n")
# Distribution info
set(KEEPASSXC_DIST ON)
set(KEEPASSXC_DIST_TYPE "Other" CACHE STRING "KeePassXC Distribution Type")
set_property(CACHE KEEPASSXC_DIST_TYPE PROPERTY STRINGS Snap AppImage Flatpak Other)
set(KEEPASSXC_DIST_TYPE "Native" CACHE STRING "KeePassXC Distribution Type")
set_property(CACHE KEEPASSXC_DIST_TYPE PROPERTY STRINGS Snap AppImage Flatpak Native)
if(KEEPASSXC_DIST_TYPE STREQUAL "Snap")
set(KEEPASSXC_DIST_SNAP ON)
elseif(KEEPASSXC_DIST_TYPE STREQUAL "AppImage")
set(KEEPASSXC_DIST_APPIMAGE ON)
elseif(KEEPASSXC_DIST_TYPE STREQUAL "Flatpak")
set(KEEPASSXC_DIST_FLATPAK ON)
elseif(KEEPASSXC_DIST_TYPE STREQUAL "Other")
unset(KEEPASSXC_DIST)
endif()
# Standards
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Compiler Features
if(APPLE)
# Perform the platform checks before applying the stricter compiler flags.
# Otherwise the kSecAccessControlTouchIDCurrentSet deprecation warning will result in an error.
try_compile(XC_APPLE_COMPILER_SUPPORT_BIOMETRY
${CMAKE_BINARY_DIR}/macos-trycompile/
${CMAKE_SOURCE_DIR}/cmake/compiler-checks/control_biometry_support.mm)
message(STATUS "Biometry compiler support: ${XC_APPLE_COMPILER_SUPPORT_BIOMETRY}")
try_compile(XC_APPLE_COMPILER_SUPPORT_TOUCH_ID
${CMAKE_BINARY_DIR}/macos-trycompile/
${CMAKE_SOURCE_DIR}/cmake/compiler-checks/control_touch_id_support.mm)
message(STATUS "Touch ID compiler support: ${XC_APPLE_COMPILER_SUPPORT_TOUCH_ID}")
try_compile(XC_APPLE_COMPILER_SUPPORT_WATCH
${CMAKE_BINARY_DIR}/macos-trycompile/
${CMAKE_SOURCE_DIR}/cmake/compiler-checks/control_watch_support.mm)
message(STATUS "Apple watch compiler support: ${XC_APPLE_COMPILER_SUPPORT_WATCH}")
try_compile(HAVE_PT_DENY_ATTACH
${CMAKE_BINARY_DIR}/macos-trycompile/
${CMAKE_SOURCE_DIR}/cmake/compiler-checks/ptrace_deny_attach.cpp)
endif()
if(UNIX)
check_cxx_source_compiles("#include <sys/prctl.h>
int main() { prctl(PR_SET_DUMPABLE, 0); return 0; }"
HAVE_PR_SET_DUMPABLE)
check_cxx_source_compiles("#include <malloc.h>
int main() { return 0; }"
HAVE_MALLOC_H)
check_cxx_source_compiles("#include <malloc.h>
int main() { malloc_usable_size(NULL); return 0; }"
HAVE_MALLOC_USABLE_SIZE)
check_cxx_source_compiles("#include <sys/resource.h>
int main() {
struct rlimit limit;
limit.rlim_cur = 0;
limit.rlim_max = 0;
setrlimit(RLIMIT_CORE, &limit);
return 0;
}" HAVE_RLIMIT_CORE)
endif()
# ccache support
if(WITH_CCACHE)
find_program(CCACHE_FOUND ccache)
if(NOT CCACHE_FOUND)
message(FATAL_ERROR "ccache requested but cannot be found.")
endif()
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
endif()
# Create position independent code for shared libraries and executables
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0")
cmake_policy(SET CMP0083 NEW)
include(CheckPIESupported)
check_pie_supported()
endif()
# Find Botan early since the version affects subsequent compiler options
find_package(Botan REQUIRED)
if(BOTAN_VERSION VERSION_GREATER_EQUAL "3.0.0")
set(WITH_XC_BOTAN3 TRUE)
elseif(BOTAN_VERSION VERSION_LESS "2.11.0")
# Check for minimum Botan version
message(FATAL_ERROR "Botan 2.11.0 or higher is required")
endif()
include_directories(SYSTEM ${BOTAN_INCLUDE_DIR})
# Create position independent code for shared libraries and executables
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(IS_32BIT TRUE)
endif()
@ -235,66 +237,7 @@ if("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$"
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
macro(add_gcc_compiler_cxxflags FLAGS)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
endif()
endmacro(add_gcc_compiler_cxxflags)
macro(add_gcc_compiler_cflags FLAGS)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
endif()
endmacro(add_gcc_compiler_cflags)
macro(add_gcc_compiler_flags FLAGS)
add_gcc_compiler_cxxflags("${FLAGS}")
add_gcc_compiler_cflags("${FLAGS}")
endmacro(add_gcc_compiler_flags)
# Copies of above macros that first ensure the compiler understands a given flag
# Because check_*_compiler_flag() sets -D with name, need to provide "safe" FLAGNAME
macro(check_add_gcc_compiler_cxxflag FLAG FLAGNAME)
check_cxx_compiler_flag("${FLAG}" CXX_HAS${FLAGNAME})
if(CXX_HAS${FLAGNAME})
add_gcc_compiler_cxxflags("${FLAG}")
endif()
endmacro(check_add_gcc_compiler_cxxflag)
macro(check_add_gcc_compiler_cflag FLAG FLAGNAME)
check_c_compiler_flag("${FLAG}" CC_HAS${FLAGNAME})
if(CC_HAS${FLAGNAME})
add_gcc_compiler_cflags("${FLAG}")
endif()
endmacro(check_add_gcc_compiler_cflag)
# This is the "front-end" for the above macros
# Optionally takes additional parameter(s) with language to check (currently "C" or "CXX")
macro(check_add_gcc_compiler_flag FLAG)
string(REGEX REPLACE "[-=]" "_" FLAGNAME "${FLAG}")
set(check_lang_spec ${ARGN})
list(LENGTH check_lang_spec num_extra_args)
set(langs C CXX)
if(num_extra_args GREATER 0)
set(langs "${check_lang_spec}")
endif()
if("C" IN_LIST langs)
check_add_gcc_compiler_cflag("${FLAG}" "${FLAGNAME}")
endif()
if("CXX" IN_LIST langs)
check_add_gcc_compiler_cxxflag("${FLAG}" "${FLAGNAME}")
endif()
endmacro(check_add_gcc_compiler_flag)
add_definitions(-DQT_NO_EXCEPTIONS -DQT_STRICT_ITERATORS -DQT_NO_CAST_TO_ASCII)
if(NOT IS_DEBUG_BUILD)
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()
if(WITH_APP_BUNDLE)
add_definitions(-DWITH_APP_BUNDLE)
endif()
# Compiler Flags
add_gcc_compiler_flags("-fno-common")
find_package(OpenMP)
if(OpenMP_FOUND)
@ -310,10 +253,8 @@ if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
check_add_gcc_compiler_flag("-Wshadow-compatible-local")
check_add_gcc_compiler_flag("-Wshadow-local")
add_gcc_compiler_flags("-Werror")
# This is needed since compiling against Botan3 requires compiling against C++20
if(WITH_XC_BOTAN3)
add_gcc_compiler_cxxflags("-Wno-error=deprecated-enum-enum-conversion -Wno-error=deprecated")
endif()
# C++20 marks enum arithmetic as deprecated, but we use it in Botan and Qt5
add_gcc_compiler_cxxflags("-Wno-deprecated-enum-enum-conversion -Wno-error=deprecated ")
endif()
if (NOT HAIKU)
@ -358,14 +299,6 @@ if(UNIX AND NOT APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
endif()
set(CMAKE_C_STANDARD 99)
if(WITH_XC_BOTAN3)
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
check_cxx_compiler_flag("-fsized-deallocation" CXX_HAS_fsized_deallocation)
if(CXX_HAS_fsized_deallocation)
# Do additional check: the deallocation functions must be there too.
@ -383,7 +316,7 @@ if(APPLE AND CMAKE_COMPILER_IS_CLANGXX)
add_gcc_compiler_cxxflags("-stdlib=libc++")
endif()
if(WITH_DEV_BUILD)
if(WITH_WARN_DEPRECATED)
add_definitions(-DQT_DEPRECATED_WARNINGS)
else()
add_definitions(-DQT_NO_DEPRECATED_WARNINGS)
@ -392,54 +325,36 @@ endif()
# MSVC specific options
if (MSVC)
if(MSVC_TOOLSET_VERSION LESS 141)
message(FATAL_ERROR "Only Microsoft Visual Studio 17 and newer are supported!")
if(MSVC_TOOLSET_VERSION LESS 142)
message(FATAL_ERROR "Only Microsoft Visual Studio 2019 and newer are supported!")
endif()
add_compile_options(/permissive- /utf-8 /MP)
if(IS_DEBUG_BUILD)
add_compile_options(/Zf)
if(MSVC_TOOLSET_VERSION GREATER 141)
add_compile_definitions(/fsanitize=address)
endif()
# Turn on multi-processor support and faster PDB generation (/Zf)
add_compile_options(/permissive- /utf-8 /MP /Zf)
# Enable built-in ASAN
add_compile_definitions(/fsanitize=address)
# Enable high entropy ASLR on release builds
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
add_compile_options(/guard:cf)
add_link_options(/DYNAMICBASE /HIGHENTROPYVA /GUARD:CF)
endif()
elseif(MINGW)
# Enable high entropy ASLR on release builds
if(CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--nxcompat -Wl,--dynamicbase -Wl,--high-entropy-va")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--nxcompat -Wl,--dynamicbase -Wl,--high-entropy-va")
endif()
endif()
if(WIN32)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
if(MINGW)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
endif()
if(NOT IS_DEBUG_BUILD)
if(MSVC)
# By default MSVC enables NXCOMPAT
add_compile_options(/guard:cf)
add_link_options(/DYNAMICBASE /HIGHENTROPYVA /GUARD:CF)
else(MINGW)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--nxcompat -Wl,--dynamicbase")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--nxcompat -Wl,--dynamicbase")
# Enable high entropy ASLR for 64-bit builds
if(NOT IS_32BIT)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--high-entropy-va")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--high-entropy-va")
endif()
endif()
endif()
endif()
if(APPLE AND WITH_APP_BUNDLE OR WIN32)
set(PROGNAME KeePassXC)
else()
set(PROGNAME keepassxc)
endif()
if(WIN32)
set(CLI_INSTALL_DIR ".")
set(PROXY_INSTALL_DIR ".")
set(BIN_INSTALL_DIR ".")
set(PLUGIN_INSTALL_DIR ".")
set(DATA_INSTALL_DIR "share")
elseif(APPLE AND WITH_APP_BUNDLE)
set(PROGNAME KeePassXC)
set(BUNDLE_INSTALL_DIR "${PROGNAME}.app/Contents")
set(CMAKE_INSTALL_MANDIR "${BUNDLE_INSTALL_DIR}/Resources/man")
set(CLI_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/MacOS")
@ -447,9 +362,10 @@ elseif(APPLE AND WITH_APP_BUNDLE)
set(BIN_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/MacOS")
set(PLUGIN_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/PlugIns")
set(DATA_INSTALL_DIR "${BUNDLE_INSTALL_DIR}/Resources")
add_definitions(-DWITH_APP_BUNDLE)
else()
include(GNUInstallDirs)
set(PROGNAME keepassxc)
set(CLI_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(PROXY_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
@ -457,10 +373,6 @@ else()
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/keepassxc")
endif()
if(WITH_TESTS)
enable_testing()
endif(WITH_TESTS)
if(WITH_COVERAGE)
# Include code coverage, use with -DCMAKE_BUILD_TYPE=Debug
include(CodeCoverage)
@ -489,11 +401,10 @@ if(WITH_COVERAGE)
endif()
endif()
include(CLangFormat)
# Find Qt
set(QT_COMPONENTS Core Network Concurrent Gui Svg Widgets Test LinguistTools)
if(UNIX AND NOT APPLE)
if(WITH_XC_X11)
if(WITH_X11)
list(APPEND QT_COMPONENTS X11Extras)
endif()
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} DBus REQUIRED)
@ -512,14 +423,13 @@ else()
find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
endif()
# Minimum Qt version check
if(Qt5Core_VERSION VERSION_LESS "5.12.0")
message(FATAL_ERROR "Qt version 5.12.0 or higher is required")
endif()
get_filename_component(Qt5_PREFIX ${Qt5_DIR}/../../.. REALPATH)
if(APPLE)
# Add includes under Qt5 Prefix in case Qt6 is also installed
include_directories(SYSTEM ${Qt5_PREFIX}/include)
# C++20 is not supported before Qt 5.15.0
if(Qt5Core_VERSION VERSION_LESS "5.15.0")
set(CMAKE_CXX_STANDARD 17)
endif()
# Process moc automatically
@ -529,7 +439,17 @@ set(CMAKE_AUTOUIC ON)
# Process .qrc files automatically
set(CMAKE_AUTORCC ON)
add_definitions(-DQT_NO_EXCEPTIONS -DQT_STRICT_ITERATORS -DQT_NO_CAST_TO_ASCII)
if(NOT CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()
get_filename_component(Qt5_PREFIX ${Qt5_DIR}/../../.. REALPATH)
if(APPLE)
# Add includes under Qt5 Prefix in case Qt6 is also installed
include_directories(SYSTEM ${Qt5_PREFIX}/include)
set(CMAKE_MACOSX_RPATH TRUE)
find_program(MACDEPLOYQT_EXE macdeployqt HINTS ${Qt5_PREFIX}/bin ${Qt5_PREFIX}/tools/qt5/bin ENV PATH)
if(NOT MACDEPLOYQT_EXE)
@ -545,9 +465,16 @@ elseif(WIN32)
message(STATUS "Using windeployqt: ${WINDEPLOYQT_EXE}")
endif()
# Debian sets the build type to None for package builds.
# Make sure we don't enable asserts there.
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_NONE QT_NO_DEBUG)
# Find Botan
# TODO: Increase minimum to 2.19.1 and drop Argon2 package
find_package(Botan REQUIRED)
if(BOTAN_VERSION VERSION_GREATER_EQUAL "3.0.0")
set(WITH_BOTAN3 TRUE)
elseif(BOTAN_VERSION VERSION_LESS "2.12.0")
# Check for minimum Botan version
message(FATAL_ERROR "Botan 2.12.0 or higher is required")
endif()
include_directories(SYSTEM ${BOTAN_INCLUDE_DIR})
# Find Argon2 -- Botan 2.18 and below does not support threaded Argon2
find_library(ARGON2_LIBRARIES NAMES argon2)
@ -564,70 +491,40 @@ include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
# Find Minizip
find_package(Minizip REQUIRED)
if(WITH_XC_YUBIKEY)
find_package(PCSC REQUIRED)
include_directories(SYSTEM ${PCSC_INCLUDE_DIRS})
# Find PCSC and LibUSB for hardware key support
find_package(PCSC REQUIRED)
include_directories(SYSTEM ${PCSC_INCLUDE_DIRS})
if(UNIX AND NOT APPLE)
find_library(LIBUSB_LIBRARIES NAMES usb-1.0 REQUIRED)
find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "libusb-1.0" "libusb" REQUIRED)
include_directories(SYSTEM ${LIBUSB_INCLUDE_DIR})
endif()
if(UNIX AND NOT APPLE)
find_library(LIBUSB_LIBRARIES NAMES usb-1.0 REQUIRED)
find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "libusb-1.0" "libusb" REQUIRED)
include_directories(SYSTEM ${LIBUSB_INCLUDE_DIR})
# For PolKit QuickUnlock
find_library(KEYUTILS_LIBRARIES NAMES keyutils REQUIRED)
endif()
if(UNIX)
check_cxx_source_compiles("#include <sys/prctl.h>
int main() { prctl(PR_SET_DUMPABLE, 0); return 0; }"
HAVE_PR_SET_DUMPABLE)
check_cxx_source_compiles("#include <malloc.h>
int main() { return 0; }"
HAVE_MALLOC_H)
check_cxx_source_compiles("#include <malloc.h>
int main() { malloc_usable_size(NULL); return 0; }"
HAVE_MALLOC_USABLE_SIZE)
check_cxx_source_compiles("#include <sys/resource.h>
int main() {
struct rlimit limit;
limit.rlim_cur = 0;
limit.rlim_max = 0;
setrlimit(RLIMIT_CORE, &limit);
return 0;
}" HAVE_RLIMIT_CORE)
if(APPLE)
check_cxx_source_compiles("#include <sys/types.h>
#include <sys/ptrace.h>
int main() { ptrace(PT_DENY_ATTACH, 0, 0, 0); return 0; }"
HAVE_PT_DENY_ATTACH)
endif()
endif()
include_directories(SYSTEM ${ZLIB_INCLUDE_DIR})
# Find zxcvbn or use the bundled version
find_library(ZXCVBN_LIBRARIES zxcvbn)
if(NOT ZXCVBN_LIBRARIES)
add_subdirectory(src/thirdparty/zxcvbn)
set(ZXCVBN_LIBRARIES zxcvbn)
endif(NOT ZXCVBN_LIBRARIES)
endif()
# Add KeePassXC sources and tests
add_subdirectory(src)
add_subdirectory(share)
if(WITH_TESTS)
add_subdirectory(tests)
endif(WITH_TESTS)
if(WITH_XC_DOCS)
if(WITH_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if(KPXC_FEATURE_DOCS)
add_subdirectory(docs)
endif()
if(PRINT_SUMMARY)
# This will print ENABLED, REQUIRED and DISABLED
feature_summary(WHAT ALL)
else()
# This will only print ENABLED and DISABLED feature
feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
endif()
# Print out summary information
message(STATUS "")
feature_summary(QUIET_ON_EMPTY WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
feature_summary(QUIET_ON_EMPTY WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")

View File

@ -1,19 +1,17 @@
Build and Install KeePassXC
=================
# Build and Install KeePassXC
This document will guide you through the steps to build and install KeePassXC from source.
For more information, see also the [_Building KeePassXC_](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC) page on the wiki.
The [QuickStart Guide](https://keepassxc.org/docs/KeePassXC_GettingStarted.html) gets you started using KeePassXC on your Windows, macOS, or Linux computer using pre-compiled binaries from the [downloads page](https://keepassxc.org/download).
Toolchain and Build Dependencies
================================
## Toolchain and Build Dependencies
The following build tools must exist within your PATH:
* cmake (>= 3.10.0)
* cmake (>= 3.16.0)
* make (>= 4.2) or ninja (>= 1.10)
* g++ (>= 4.9) or clang++ (>= 6.0)
* g++ (>= 9.3.0) or clang++ (>= 10.0)
* asciidoctor (>= 2.0)
* Besides a working C++ toolchain, KeePassXC also has a number of direct build and runtime dependencies. For detailed information about how to install them, please refer to the GitHub wiki:
@ -22,8 +20,8 @@ The following build tools must exist within your PATH:
* [Set up Build Environment on Windows](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-Windows)
* [Set up Build Environment on macOS](https://github.com/keepassxreboot/keepassxc/wiki/Set-up-Build-Environment-on-macOS)
Build Steps
===========
## Build Steps
We recommend using the release tool to perform builds, please read up-to-date instructions [on our wiki](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC#building-using-the-release-tool).
To compile from source, open a **Terminal (Linux/MacOS)**, the **MSVC Tools Command Prompt (Windows)**, or **MSYS2-MinGW shell (Windows)**. For code development on Windows, you can use Visual Studio 2022, Visual Studio Code, or CLion.
@ -55,10 +53,10 @@ To compile from source, open a **Terminal (Linux/MacOS)**, the **MSVC Tools Comm
```
mkdir build
cd build
cmake -DWITH_XC_ALL=ON ..
cmake ..
make
```
If you have `vcpkg` installed, add `-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake` to the `cmake` command to automatically download and install all required build and runtime dependencies locally to your build directory before compiling KeePassXC. Using `vcpkg` is the preferred way to install dependencies on macOS and required on Windows if using the MSVC toolchain.
For more detailed build instructions for each platform, please refer to the [GitHub wiki](https://github.com/keepassxreboot/keepassxc/wiki/Building-KeePassXC).
@ -77,49 +75,39 @@ When building with ASAN support on macOS, you need to use `export ASAN_OPTIONS=d
If you are using MSYS2, you have to add ```-G "MSYS Makefiles"``` at the beginning of the cmake command.
CMake Configuration Options
==========================
## Recommended CMake Build Parameters
```
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=<RelWithDebInfo/Debug/Release>
-DWITH_GUI_TESTS=ON
```
## Additional CMake Parameters
KeePassXC comes with a variety of build options that can turn on/off features. Most notably, we allow you to build the application with all TCP/IP networking code disabled. Please note that we still require and link against Qt5's network library in order to use local named pipes on all operating systems. Each of these build options are supplied at the time of calling cmake:
KeePassXC comes with a variety of build options that can turn on/off features. Each of these build options are supplied at the time of calling cmake:
```
-DWITH_XC_AUTOTYPE=[ON|OFF] Enable/Disable Auto-Type (default: ON)
-DWITH_XC_YUBIKEY=[ON|OFF] Enable/Disable YubiKey HMAC-SHA1 authentication support (default: OFF)
-DWITH_XC_BROWSER=[ON|OFF] Enable/Disable KeePassXC-Browser extension support (default: OFF)
-DWITH_XC_BROWSER_PASSKEYS=[ON|OFF] Enable/Disable Passkeys support for browser integration (default: OFF)
-DWITH_XC_NETWORKING=[ON|OFF] Enable/Disable Networking support (e.g., favicon downloading) (default: OFF)
-DWITH_XC_SSHAGENT=[ON|OFF] Enable/Disable SSHAgent support (default: OFF)
-DWITH_XC_FDOSECRETS=[ON|OFF] (Linux Only) Enable/Disable Freedesktop.org Secrets Service support (default:OFF)
-DWITH_XC_KEESHARE=[ON|OFF] Enable/Disable KeeShare group synchronization extension (default: OFF)
-DWITH_XC_ALL=[ON|OFF] Enable/Disable compiling all plugins above (default: OFF)
-DKPXC_MINIMAL=[ON|OFF] Build KeePassXC with the minimal feature set required for basic usage (default: OFF)
-DKPXC_FEATURE_BROWSER=[ON|OFF] Browser integration and passkeys support (default: ON)
-DKPXC_FEATURE_SSHAGENT=[ON|OFF] SSH Agent integration (default: ON)
-DKPXC_FEATURE_FDOSECRETS=[ON|OFF] (Linux Only) freedesktop.org Secret Service integration; replace system keyring (default:ON)
-DWITH_XC_UPDATECHECK=[ON|OFF] Enable/Disable automatic updating checking (requires WITH_XC_NETWORKING) (default: ON)
-DKPXC_FEATURE_NETWORK=[ON|OFF] Include code that reaches out to external networks (e.g. downloading icons) (default: ON)
-DKPXC_FEATURE_UPDATES=[ON|OFF] Include automatic update checks; disable for managed distributions (requires networking) (default: ON)
-DKPXC_FEATURE_DOCS=[ON|OFF] Build offline documentation; requires asciidoctor tool (default: ON)
-DWITH_TESTS=[ON|OFF] Enable/Disable building of unit tests (default: ON)
-DWITH_GUI_TESTS=[ON|OFF] Enable/Disable building of GUI tests (default: OFF)
-DWITH_DEV_BUILD=[ON|OFF] Enable/Disable deprecated method warnings (default: OFF)
-DWITH_WARN_DEPRECATED=[ON|OFF] Development only: warn about deprecated methods, including Qt. (default: OFF)
-DWITH_ASAN=[ON|OFF] Enable/Disable address sanitizer checks (Linux / macOS only) (default: OFF)
-DWITH_COVERAGE=[ON|OFF] Enable/Disable coverage tests (GCC only) (default: OFF)
-DWITH_APP_BUNDLE=[ON|OFF] Enable Application Bundle for macOS (default: ON)
-DWITH_CCACHE=[ON|OFF] Use ccache for build speed optimization (default: OFF)
-DWITH_X11=[ON|OFF] Enable building with X11 dependencies (default: ON)
-DKEEPASSXC_BUILD_TYPE=[Snapshot|PreRelease|Release] Set the build type to show/hide stability warnings (default: "Snapshot")
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Other] Specify the distribution method (default: "Other")
-DKEEPASSXC_BUILD_TYPE=[Snapshot|Release] Set the build type to show/hide stability warnings (default: "Snapshot")
-DKEEPASSXC_DIST_TYPE=[Snap|AppImage|Flatpak|Native] Specify the distribution method (default: "Native")
-DOVERRIDE_VERSION=[X.X.X] Specify a version number when building. Used with snapshot builds (default: "")
-DGIT_HEAD_OVERRIDE=[XXXXXXX] Specify the 7 digit git commit ref for this build. Used with distribution builds (default: "")
```
Installation
============
Note: Even though you can build the application with all TCP/IP networking code disabled, we still require and link against
Qt5's network library to use local named pipes on all operating systems.
## Installation
After you have successfully built KeePassXC, install the binary by executing the following:
@ -127,8 +115,7 @@ After you have successfully built KeePassXC, install the binary by executing the
sudo make install
```
Packaging
=========
## Packaging
You can create a package to redistribute KeePassXC (zip, deb, rpm, dmg, etc..). Refer to [keepassxc-packaging](https://github.com/keepassxreboot/keepassxc-packaging) for packaging scripts.
@ -138,21 +125,23 @@ To package using CMake, run the following command using whichever [generators](h
cpack -G "ZIP;WIX"
```
Testing
=======
## Testing
You can perform tests on the built executables with:
```
make test ARGS+="--output-on-failure"
```
On Linux, if you are not currently running on an X Server or Wayland, run the tests as follows:
```
make test ARGS+="-E test\(cli\|gui\) --output-on-failure"
xvfb-run -e errors -a --server-args="-screen 0 1024x768x24" make test ARGS+="-R test\(cli\|gui\) --output-on-failure"
```
Common parameters:
```
CTEST_OUTPUT_ON_FAILURE=1
ARGS+=-jX

View File

@ -1,4 +1,5 @@
# <img src="https://keepassxc.org/assets/img/keepassxc.svg" width="40" height="40"/> KeePassXC
[![OpenSSF Best Practices](https://bestpractices.coreinfrastructure.org/projects/6326/badge)](https://bestpractices.coreinfrastructure.org/projects/6326)
[![TeamCity Build Status](https://ci.keepassxc.org/app/rest/builds/buildType:\(project:KeepassXC\)/statusIcon)](https://ci.keepassxc.org/?guest=1)
[![codecov](https://codecov.io/gh/keepassxreboot/keepassxc/branch/develop/graph/badge.svg)](https://codecov.io/gh/keepassxreboot/keepassxc)
@ -10,32 +11,37 @@
[KeePassXC](https://keepassxc.org) is a modern, secure, and open-source password manager that stores and manages your most sensitive information. You can run KeePassXC on Windows, macOS, and Linux systems. KeePassXC is for people with extremely high demands of secure personal data management. It saves many different types of information, such as usernames, passwords, URLs, attachments, and notes in an offline, encrypted file that can be stored in any location, including private and public cloud solutions. For easy identification and management, user-defined titles and icons can be specified for entries. In addition, entries are sorted into customizable groups. An integrated search function allows you to use advanced patterns to easily find any entry in your database. A customizable, fast, and easy-to-use password generator utility allows you to create passwords with any combination of characters or easy to remember passphrases.
## Quick Start
The [QuickStart Guide](https://keepassxc.org/docs/KeePassXC_GettingStarted.html) gets you started using KeePassXC on your Windows, macOS, or Linux computer using pre-compiled binaries from the [downloads page](https://keepassxc.org/download). Additionally, individual Linux distributions may ship their own versions, so please check your distribution's package list to see if KeePassXC is available. Detailed documentation is available in the [User Guide](https://keepassxc.org/docs/KeePassXC_UserGuide.html).
## Features List
KeePassXC has numerous features for novice and power users alike. Our goal is to create an application that can be used by anyone while still offering advanced features to those that need them.
### Basic
* Create, open, and save databases in the KDBX format (KeePass-compatible with KDBX4 and KDBX3)
* Store sensitive information in entries that are organized by groups
* Search for entries
* Password generator
* Auto-Type passwords into applications
* Browser integration with Google Chrome, Mozilla Firefox, Microsoft Edge, Chromium, Vivaldi, Brave, and Tor-Browser
* Entry icon download
* Import databases from CSV, 1Password, and KeePass1 formats
### Core Features
### Advanced
* Database reports (password health, HIBP, and statistics)
* Database export to CSV and HTML formats
* Create, open, and save databases in the KDBX format (KeePass-compatible with KDBX4 and KDBX3)
* All information is encrypted at rest and never exposed outside the program
* Store sensitive information in entries that are organized by groups
* Password generator
* Search for entries
* TOTP storage and generation
* YubiKey/OnlyKey challenge-response support
* Auto-Type passwords into applications
* Browser integration with all major browsers
* Share database entries with KeeShare
* Import databases from CSV, 1Password, and Bitwarden formats
### Additional Features
* Entry icon download
* Auto-Open databases
* Password health reports, database statistics, and Have I Been Pwned search
* Export to CSV, HTML, and XML formats
* Field references between entries
* File attachments and custom attributes
* Entry history and data restoration
* YubiKey/OnlyKey challenge-response support
* Command line interface (keepassxc-cli)
* Auto-Open databases
* KeeShare shared databases (import, export, and synchronize)
* SSH Agent integration
* FreeDesktop.org Secret Service (replace Gnome keyring, etc.)
* Additional encryption choices: Twofish and ChaCha20

65
cmake/CompilerFlags.cmake Normal file
View File

@ -0,0 +1,65 @@
# Copyright (C) 2024 KeePassXC Team <team@keepassxc.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or (at your option)
# version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
macro(add_gcc_compiler_cxxflags FLAGS)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
endif()
endmacro()
macro(add_gcc_compiler_cflags FLAGS)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
endif()
endmacro()
macro(add_gcc_compiler_flags FLAGS)
add_gcc_compiler_cxxflags("${FLAGS}")
add_gcc_compiler_cflags("${FLAGS}")
endmacro()
# Copies of above macros that first ensure the compiler understands a given flag
# Because check_*_compiler_flag() sets -D with name, need to provide "safe" FLAGNAME
macro(check_add_gcc_compiler_cxxflag FLAG FLAGNAME)
check_cxx_compiler_flag("${FLAG}" CXX_HAS${FLAGNAME})
if(CXX_HAS${FLAGNAME})
add_gcc_compiler_cxxflags("${FLAG}")
endif()
endmacro()
macro(check_add_gcc_compiler_cflag FLAG FLAGNAME)
check_c_compiler_flag("${FLAG}" CC_HAS${FLAGNAME})
if(CC_HAS${FLAGNAME})
add_gcc_compiler_cflags("${FLAG}")
endif()
endmacro()
# This is the "front-end" for the above macros
# Optionally takes additional parameter(s) with language to check (currently "C" or "CXX")
macro(check_add_gcc_compiler_flag FLAG)
string(REGEX REPLACE "[-=]" "_" FLAGNAME "${FLAG}")
set(check_lang_spec ${ARGN})
list(LENGTH check_lang_spec num_extra_args)
set(langs C CXX)
if(num_extra_args GREATER 0)
set(langs "${check_lang_spec}")
endif()
if("C" IN_LIST langs)
check_add_gcc_compiler_cflag("${FLAG}" "${FLAGNAME}")
endif()
if("CXX" IN_LIST langs)
check_add_gcc_compiler_cxxflag("${FLAG}" "${FLAGNAME}")
endif()
endmacro()

View File

@ -0,0 +1,8 @@
#include <sys/ptrace.h>
#include <sys/types.h>
int main()
{
ptrace(PT_DENY_ATTACH, 0, 0, 0);
return 0;
}

View File

@ -47,7 +47,6 @@ CMAKE_OPTIONS=""
CPACK_GENERATORS="WIX;ZIP"
COMPILER="g++"
MAKE_OPTIONS="-j$(getconf _NPROCESSORS_ONLN)"
BUILD_PLUGINS="all"
INSTALL_PREFIX="/usr/local"
ORIG_BRANCH=""
ORIG_CWD="$(pwd)"
@ -132,8 +131,6 @@ Options:
-m, --make-options Make options for compiling sources (default: '${MAKE_OPTIONS}')
-g, --generators Additional CPack generators (default: '${CPACK_GENERATORS}')
-i, --install-prefix Install prefix (default: '${INSTALL_PREFIX}')
-p, --plugins Space-separated list of plugins to build
(default: ${BUILD_PLUGINS})
--snapshot Don't checkout the release tag
-n, --no-source-tarball Don't build source tarball
-h, --help Show this help
@ -829,10 +826,6 @@ build() {
INSTALL_PREFIX="$2"
shift ;;
-p|--plugins)
BUILD_PLUGINS="$2"
shift ;;
-n|--no-source-tarball)
build_source_tarball=false ;;
@ -870,13 +863,9 @@ build() {
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Snapshot -DOVERRIDE_VERSION=${RELEASE_NAME}"
else
checkWorkingTreeClean
if echo "$TAG_NAME" | grep -qE '\-(alpha|beta)[0-9]+$'; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=PreRelease"
logInfo "Checking out pre-release tag '${TAG_NAME}'..."
else
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Release"
logInfo "Checking out release tag '${TAG_NAME}'..."
fi
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_BUILD_TYPE=Release"
logInfo "Checking out release tag '${TAG_NAME}'..."
if ! git checkout "$TAG_NAME" > /dev/null 2>&1; then
exitError "Failed to check out target branch."
@ -922,9 +911,6 @@ build() {
cd "${OUTPUT_DIR}/build-release"
logInfo "Configuring sources..."
for p in ${BUILD_PLUGINS}; do
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_XC_$(echo $p | tr '[:lower:]' '[:upper:]')=On"
done
if [ -n "$OS_LINUX" ] && ${build_appimage}; then
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DKEEPASSXC_DIST_TYPE=AppImage"
# linuxdeploy requires /usr as install prefix

View File

@ -253,7 +253,6 @@ function Invoke-GpgSignFiles([string[]] $files, [string] $key) {
}
}
# Handle errors and restore state
$OrigDir = (Get-Location).Path
$OrigBranch = & git rev-parse --abbrev-ref HEAD
@ -345,6 +344,7 @@ if ($Merge) {
Write-Host "All done!"
Write-Host "Please merge the release branch back into the develop branch now and then push your changes."
Write-Host "Don't forget to also push the tags using 'git push --tags'."
} elseif ($Build) {
$Vcpkg = (Resolve-Path "$Vcpkg/scripts/buildsystems/vcpkg.cmake").Path
@ -357,6 +357,13 @@ if ($Merge) {
Test-RequiredPrograms
# Create directories
New-Item "$OutDir" -ItemType Directory -Force | Out-Null
$OutDir = (Resolve-Path $OutDir).Path
$BuildDir = "$OutDir\build-release"
New-Item "$BuildDir" -ItemType Directory -Force | Out-Null
if ($Snapshot) {
$Tag = "HEAD"
$SourceBranch = & git rev-parse --abbrev-ref HEAD
@ -366,38 +373,26 @@ if ($Merge) {
} else {
Test-WorkingTreeClean
# Clear output directory
if (Test-Path $OutDir) {
Remove-Item $OutDir -Recurse
# Clear build directory except for installed vcpkg files to prevent having to re-sign everything
if (Test-Path $BuildDir) {
Get-ChildItem $BuildDir -Recurse | Where-Object {$_.FullName -notlike "$BuildDir\vcpkg_installed*"} | Remove-Item -Recurse -Force
}
if ($Version -match "-beta\d*$") {
$CMakeOptions = "-DKEEPASSXC_BUILD_TYPE=PreRelease $CMakeOptions"
} else {
$CMakeOptions = "-DKEEPASSXC_BUILD_TYPE=Release $CMakeOptions"
}
$CMakeOptions = "-DKEEPASSXC_BUILD_TYPE=Release $CMakeOptions"
# Setup Tag if not defined then checkout tag
if ($Tag -eq "" -or $Tag -eq $null) {
if ($Tag -eq "" -or $null -eq $Tag) {
$Tag = $Version
}
Write-Host "Checking out tag 'tags/$Tag' to build." -ForegroundColor Cyan
Invoke-Cmd "git" "checkout `"tags/$Tag`""
}
# Create directories
New-Item "$OutDir" -ItemType Directory -Force | Out-Null
$OutDir = (Resolve-Path $OutDir).Path
$BuildDir = "$OutDir\build-release"
New-Item "$BuildDir" -ItemType Directory -Force | Out-Null
# Enter build directory
Set-Location "$BuildDir"
# Setup CMake options
$CMakeOptions = "-DWITH_XC_ALL=ON -DWITH_TESTS=OFF -DCMAKE_BUILD_TYPE=Release $CMakeOptions"
$CMakeOptions = "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=`"$Vcpkg`" -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON $CMakeOptions"
$CMakeOptions = "-DWITH_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE:FILEPATH=`"$Vcpkg`" -DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON"
Write-Host "Configuring build..." -ForegroundColor Cyan
Invoke-Cmd "cmake" "-G `"$CMakeGenerator`" $CMakeOptions `"$SourceDir`""
@ -436,6 +431,7 @@ if ($Merge) {
# Restore state
Invoke-Command {git checkout $OrigBranch}
Set-Location "$OrigDir"
} elseif ($Sign) {
Test-RequiredPrograms
@ -459,8 +455,8 @@ if ($Merge) {
# SIG # Begin signature block
# MIIm2gYJKoZIhvcNAQcCoIImyzCCJscCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDuejql+mhHrYzE
# MGUrjGMbUzkTkzwhj8dkNuT2x9j8+KCCH8cwggVvMIIEV6ADAgECAhBI/JO0YFWU
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCHsQKXRYSHXkaZ
# Cl/5OsdoM/QUjsgM3oA8v9vQYqsrh6CCH8cwggVvMIIEV6ADAgECAhBI/JO0YFWU
# jTanyYqJ1pQWMA0GCSqGSIb3DQEBDAUAMHsxCzAJBgNVBAYTAkdCMRswGQYDVQQI
# DBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoM
# EUNvbW9kbyBDQSBMaW1pdGVkMSEwHwYDVQQDDBhBQUEgQ2VydGlmaWNhdGUgU2Vy
@ -634,35 +630,35 @@ if ($Merge) {
# TGltaXRlZDErMCkGA1UEAxMiU2VjdGlnbyBQdWJsaWMgQ29kZSBTaWduaW5nIENB
# IFIzNgIQBkM/zMzkM6iSzBe3RqWMZTANBglghkgBZQMEAgEFAKCBhDAYBgorBgEE
# AYI3AgEMMQowCKACgAChAoAAMBkGCSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwG
# CisGAQQBgjcCAQsxDjAMBgorBgEEAYI3AgEVMC8GCSqGSIb3DQEJBDEiBCCn5BDd
# F+7Q6LMoJuJxenFHgWAZjm1CET9oBKnlZKClzjANBgkqhkiG9w0BAQEFAASCAgAS
# ypiTBQb39I43fGdH6t2OYAl53TSbJfPG99/11OYS+6nMTKhy7dHtzzgMFxBQmL/L
# P4eJJMqh1yIYEjrjhNLLddRhVP2lfsuQ1OkLVx5lS8M32I3SzpskOe+SywMLDYJy
# sYHEcZkyQX0Q2J/RGzF8/tDcltZodYEdZrQdaAKo7bGv1JcYpW7B6JZnNjquE90d
# WVNAsQ6Mc3kzkjbs2qDaRAdkOmX5uENWbNf1GgTRpud7Ic5hMyb4v9qfWAptlFuO
# pLHyuINNsBuTfzD/cGVR9qecDPIE90UnHQHZWws9U+m84CzAmqpptp4VhrAWc7Hc
# bHsbmg4tGA41ythKyERpW9YlwID6fJYMigEVmJihXdM/qRGO2XdfbPAr0C0AMPIV
# re8r86BJw1lxJJYL2gsS/ttgrnW2C8aFq+IxxXWnv/7maPG69K/jmRLQGZuLIZCl
# 7rT6hob37zZMsdnqDZ0DjJb/FGonJr7GpyeMEWPy8eVwZydMbC9hBl8HNgQ04sp7
# ouskM1nCco9DV+d1Y6Oyje6IylZjD+xgX7VfsDa2O3Lw27cfyxJBW359meYHytkJ
# oYqh4Y4fC9YlYTD3913ryqTbPaWtWjvFV+GR8biHxDoTmTRuNaeN6RDyyZJkdON7
# CnR/8X8y4C9BXdesvjfIdhHZsGwLJcZ87cnYGb7oYqGCA0swggNHBgkqhkiG9w0B
# CisGAQQBgjcCAQsxDjAMBgorBgEEAYI3AgEVMC8GCSqGSIb3DQEJBDEiBCDx8XCN
# KVtldJ+NDiAODkb0Q9ZluUXrd7Zx2r9yvpCKbDANBgkqhkiG9w0BAQEFAASCAgBV
# BsZnlSJw3Iogiz/QG9cX//zPpUC0BssOPhodd8DWiZcxOihYpO/phFvRoMyljcp3
# kjgVpk9572BD0ot+W4NT4gG2GOf287lYswaAY9Keh/NT3HXRdBD8esYnG0PNK2ZN
# F9F+6Pt9IvcxxUQd/YTmThFnFPQOn1hxrapOwskESEpM7F4ifNaGDkkWoAFWb0kw
# czX4tngvX+v+z7/jtW5ULClxiyahT26+Hvm2MiJGuSf1M6OBl5WmuXe1WgcIGGIh
# nXEzAHzdGghJU7g6f94fgLQT5NUmw993AhPh3WCzBF8Jt6R6DYfPiJMLHix92PHx
# 9IWVdIF1rcM2a7S82ffKLqU46dcvdcAWxE7B6ivFtP/wy9dFNpHyNvqe8rbZsVxO
# axxOsD6VCoJrdUJf8DZAWDAdMxbxXUeh20l89yISp+95+Cni0E6OcaztH+mDANvj
# uAg8RX2SB0/frjf1YFTzCxw0fkjPTp0KexptiYmsKdQkTsXBOMyF6gRTupkMzdnn
# SO3fsnEqsxogtqlbcHmlcTXtkn9DjdiOUAkhfwWjv9UughSvVKFO/4KDaEliMV4h
# KD8nZ9XLpxSUaTGqARZtzkgXrgbL6P4rr0qV0atW+zhol3H+BJ+B0xksH5HNFn9C
# owH9kBQH3v2tl7eFW7Uw3c2jx5BLLIwzC8QOaoecaqGCA0swggNHBgkqhkiG9w0B
# CQYxggM4MIIDNAIBATCBkTB9MQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3JlYXRl
# ciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRgwFgYDVQQKEw9TZWN0aWdv
# IExpbWl0ZWQxJTAjBgNVBAMTHFNlY3RpZ28gUlNBIFRpbWUgU3RhbXBpbmcgQ0EC
# EDlMJeF8oG0nqGXiO9kdItQwDQYJYIZIAWUDBAICBQCgeTAYBgkqhkiG9w0BCQMx
# CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0yNDA0MjgyMjE0MzdaMD8GCSqG
# SIb3DQEJBDEyBDARWlO4ZY7Qij7x/efLB7SJrHgfXJwezYW7sskwZhfhnoQ8JQ8Q
# HfefvIk4nF1+1PkwDQYJKoZIhvcNAQEBBQAEggIAWpBgtEaYVRayRmCTjyOoKg0b
# 2vXn3dqpcpckspX4t58xHLbhapGm3Akg9N6C0xZWm9qQ9vhjoOeuLZ0Z+017JRUe
# YExYYIYcyNGlxyt/uXiBst8KiAFFzn6RwIjycQcsnOsGRBAz2E9/k7wGtdg8kqBI
# Q71cDl+seRjWVcTR4JgthphZuRTKS1Jxn3tjDNJuK+LFo4jL38ojxhhdOnb3xzZ0
# M1AQ+l2YuDxBX4H9aZsbiTfdI1mxvmPgmZbq4fjV28TUCiBhD1UYuHUPN3Ff9Fwo
# 9BMbTLvKqED8Mm9A25S4M8kVZsGt8j3EAt0AJaWbdHLpLC0l0ykDAcSiwZNYsdMu
# vN0q6z5knfhKv4M8FXQ2wu8pbPww7/4kBqqy9L8VMI8UIazG9Z/R7yhkZjEz3jgc
# a/VZMcsDn41B79/9eSx4wED7NYtc0T6DB8WFH1a2CqlORSHnRolnms+VjWerfmZP
# a9lV7Sk1gGZ+MePsWwXj7liURI/ubTtPtxWElWuYookkQMmrOJYj+IZCW4RvV3I3
# utzHUwfbBaON3Mq46ADayLxKP2SE9j3JXpl4mZeWXdYUrywt2TgQktCXT7iZOinl
# dbx1tso5uDAj1DQDiTm4Nps+UWjyo2bZB/g1ONMqxPDIuY75HryfmJDlvCMp80Tk
# cJchA5s/dVwNSWKti4Q=
# CwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0yNDA3MDEwMjA3MDdaMD8GCSqG
# SIb3DQEJBDEyBDDZlndFw9BTnL5meJayzDKbYwynb3s25wAwJ0SbCyKa8h3oU8+3
# UeRdN5e4LPfA+EgwDQYJKoZIhvcNAQEBBQAEggIAWpzFpzUStjRIGjooryRlFXn1
# kffDTsl3zqPsVpjjLi6wZk49FZJJqJTkFKGnrVkY+iPTPm2wHQyHBdDa9+LhLq2W
# Pm4blEDJR9ow3kpuv+XwW1xyYCh9iYGX5dcaS3e6CKTIa/Ay7CpG7uNA2mlbvdKn
# RzMbjpoerxrfyfSIy8rGWKoj4QOB+l2H51rjG4VpD5jUJg+fjdKADvolbm2Vjhap
# PqTRk/2fwW66L3yr4urUYT1rWQ3Elm85oUHZeJxe9ZebzxLb01cARybyPZ1n4pl0
# Aa0xm4l44RoHyqSINeh6NeICNjp2Ii/Bf/znO5ndogTbGAAgbSDbotlswfy9gZxh
# qoR9P8PZ9QXId1xqLAXw7IUJHDdXtoxlLpYtGJlaj/tgSEOG3FfRen5fJxFMNsTD
# J+Cv+hWcSlQEBo4pZyW8SPlYkUX1AuXwN7VyheD5G8Wpj+9lLbwqyN7JqAydr33w
# P6e/BPbh23tGHMl43sYkdCwE4qekbdCiHiUjHeeoldfNb5CzCZkuCkBIAE4XNcie
# v6FEB81V7+/a+gPJ72lh1LLKJixm+5S+qirBY+AQVbkigP/1ZcJZXYnEek9TRYsV
# uWTlGYhWZTQwPB3hnp5ohptoeVzywld6a/obTuQiYKU5xoyG2/UIdxRycRFsoLy4
# SrWzgFjLb4ejgF3fIMM=
# SIG # End signature block

View File

@ -5698,17 +5698,6 @@ Are you sure you want to continue with this file?</source>
<source>Don&apos;t show again for this version</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: You are using an unstable build of KeePassXC.
There is a high risk of corruption, maintain a backup of your databases.
This version is not meant for production use.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>NOTE: You are using a pre-release version of KeePassXC.
Expect some bugs and minor issues, this version is meant for testing purposes.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No Tags</source>
<translation type="unfinished"></translation>
@ -6047,6 +6036,12 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
<source>Setup Remote Sync</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>WARNING: You are using a development snapshot build of KeePassXC.
Maintain a backup of your databases in the event of unknown bugs.
This version is not meant for production use.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ManageDatabase</name>
@ -8289,10 +8284,6 @@ Kernel: %3 %4</source>
<source>KeeShare</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>YubiKey</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quick Unlock</source>
<translation type="unfinished"></translation>
@ -8301,10 +8292,6 @@ Kernel: %3 %4</source>
<source>Secret Service Integration</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enabled extensions:</source>
<translation type="unfinished"></translation>
@ -8898,6 +8885,10 @@ This option is deprecated, use --set-key-file instead.</source>
<source>Only PBKDF and Argon2 are supported, cannot decrypt json file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Hardware Keys</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QtIOCompressor</name>

View File

@ -1,4 +1,4 @@
# Copyright (C) 2023 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2024 KeePassXC Team <team@keepassxc.org>
# Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
#
# This program is free software: you can redistribute it and/or modify
@ -16,18 +16,6 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
add_feature_info(Auto-Type WITH_XC_AUTOTYPE "Automatic password typing")
add_feature_info(Networking WITH_XC_NETWORKING "Compile KeePassXC with network access code (e.g. for downloading website icons)")
add_feature_info(KeePassXC-Browser WITH_XC_BROWSER "Browser integration with KeePassXC-Browser")
add_feature_info(Passkeys WITH_XC_BROWSER_PASSKEYS "Passkeys support for browser integration")
add_feature_info(SSHAgent WITH_XC_SSHAGENT "SSH agent integration compatible with KeeAgent")
add_feature_info(KeeShare WITH_XC_KEESHARE "Sharing integration with KeeShare")
add_feature_info(YubiKey WITH_XC_YUBIKEY "YubiKey HMAC-SHA1 challenge-response")
add_feature_info(UpdateCheck WITH_XC_UPDATECHECK "Automatic update checking")
if(UNIX AND NOT APPLE)
add_feature_info(FdoSecrets WITH_XC_FDOSECRETS "Implement freedesktop.org Secret Storage Spec server side API.")
endif()
set(core_SOURCES
core/Alloc.cpp
core/AutoTypeAssociations.cpp
@ -94,6 +82,11 @@ set(core_SOURCES
keys/FileKey.cpp
keys/PasswordKey.cpp
keys/ChallengeResponseKey.cpp
keys/drivers/YubiKey.h
keys/drivers/YubiKey.cpp
keys/drivers/YubiKeyInterface.cpp
keys/drivers/YubiKeyInterfaceUSB.cpp
keys/drivers/YubiKeyInterfacePCSC.cpp
streams/HashedBlockStream.cpp
streams/HmacBlockStream.cpp
streams/LayeredStream.cpp
@ -189,6 +182,7 @@ set(gui_SOURCES
gui/reports/ReportsPageHibp.cpp
gui/reports/ReportsWidgetStatistics.cpp
gui/reports/ReportsPageStatistics.cpp
gui/osutils/DeviceListener.cpp
gui/osutils/OSUtilsBase.cpp
gui/osutils/ScreenLockListener.cpp
gui/osutils/ScreenLockListenerPrivate.cpp
@ -210,6 +204,7 @@ set(gui_SOURCES
if(APPLE)
list(APPEND gui_SOURCES
gui/osutils/macutils/DeviceListenerMac.cpp
gui/osutils/macutils/MacPasteboard.cpp
gui/osutils/macutils/MacUtils.cpp
gui/osutils/macutils/ScreenLockListenerMac.cpp
@ -223,14 +218,16 @@ endif()
if(UNIX AND NOT APPLE)
list(APPEND gui_SOURCES
gui/osutils/nixutils/DeviceListenerLibUsb.cpp
gui/osutils/nixutils/NixUtils.cpp
gui/osutils/nixutils/ScreenLockListenerDBus.cpp
gui/osutils/nixutils/NixUtils.cpp)
)
if("${CMAKE_SYSTEM}" MATCHES "Linux")
list(APPEND core_SOURCES
quickunlock/Polkit.cpp
quickunlock/PolkitDbusTypes.cpp)
endif()
if(WITH_XC_X11)
if(WITH_X11)
list(APPEND gui_SOURCES
gui/osutils/nixutils/X11Funcs.cpp)
endif()
@ -248,15 +245,11 @@ if(UNIX AND NOT APPLE)
quickunlock/dbus/org.freedesktop.PolicyKit1.Authority.xml
polkit_dbus
)
find_library(KEYUTILS_LIBRARIES NAMES keyutils)
if(NOT KEYUTILS_LIBRARIES)
message(FATAL_ERROR "Could not find libkeyutils")
endif()
endif()
if(WIN32)
list(APPEND gui_SOURCES
gui/osutils/winutils/DeviceListenerWin.cpp
gui/osutils/winutils/ScreenLockListenerWin.cpp
gui/osutils/winutils/WinUtils.cpp
../share/windows/icon.rc)
@ -265,86 +258,24 @@ if(WIN32)
endif()
endif()
if(WITH_XC_YUBIKEY)
list(APPEND gui_SOURCES gui/osutils/DeviceListener.cpp)
if(APPLE)
list(APPEND gui_SOURCES gui/osutils/macutils/DeviceListenerMac.cpp)
elseif(UNIX)
list(APPEND gui_SOURCES gui/osutils/nixutils/DeviceListenerLibUsb.cpp)
elseif(WIN32)
list(APPEND gui_SOURCES gui/osutils/winutils/DeviceListenerWin.cpp)
endif()
endif()
add_subdirectory(browser)
add_subdirectory(proxy)
if(WITH_XC_BROWSER)
if(KPXC_FEATURE_BROWSER)
set(browser_LIB browser)
list(APPEND gui_SOURCES
gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
gui/entry/EntryURLModel.cpp
gui/reports/ReportsWidgetBrowserStatistics.cpp
gui/reports/ReportsPageBrowserStatistics.cpp)
endif()
if(WITH_XC_BROWSER_PASSKEYS)
list(APPEND gui_SOURCES
gui/reports/ReportsWidgetPasskeys.cpp
gui/reports/ReportsPageBrowserStatistics.cpp
gui/reports/ReportsPagePasskeys.cpp
gui/reports/ReportsWidgetBrowserStatistics.cpp
gui/reports/ReportsWidgetPasskeys.cpp
gui/passkeys/PasskeyExporter.cpp
gui/passkeys/PasskeyExportDialog.cpp
gui/passkeys/PasskeyImporter.cpp
gui/passkeys/PasskeyImportDialog.cpp)
endif()
add_subdirectory(autotype)
add_subdirectory(cli)
add_subdirectory(qrcode)
set(qrcode_LIB qrcode)
add_subdirectory(keeshare)
if(WITH_XC_KEESHARE)
set(keeshare_LIB keeshare)
endif()
add_subdirectory(sshagent)
if(WITH_XC_SSHAGENT)
set(sshagent_LIB sshagent)
endif()
add_subdirectory(fdosecrets)
if(WITH_XC_FDOSECRETS)
set(fdosecrets_LIB fdosecrets)
endif()
add_subdirectory(thirdparty)
set(autotype_SOURCES
autotype/AutoType.cpp
autotype/AutoTypeAction.cpp
autotype/AutoTypeMatchModel.cpp
autotype/AutoTypeMatchView.cpp
autotype/AutoTypeSelectDialog.cpp
autotype/PickcharsDialog.cpp
autotype/WindowSelectComboBox.cpp)
add_library(autotype STATIC ${autotype_SOURCES})
target_link_libraries(autotype Qt5::Core Qt5::Widgets)
if(WITH_XC_YUBIKEY)
list(APPEND core_SOURCES
keys/drivers/YubiKey.h
keys/drivers/YubiKey.cpp
keys/drivers/YubiKeyInterface.cpp
keys/drivers/YubiKeyInterfaceUSB.cpp
keys/drivers/YubiKeyInterfacePCSC.cpp)
else()
list(APPEND core_SOURCES
keys/drivers/YubiKey.h
keys/drivers/YubiKeyStub.cpp)
endif()
if(WITH_XC_NETWORKING)
if(KPXC_FEATURE_NETWORK)
list(APPEND gui_SOURCES
networking/HibpDownloader.cpp
networking/NetworkManager.cpp
@ -354,12 +285,36 @@ if(WITH_XC_NETWORKING)
gui/IconDownloaderDialog.cpp)
endif()
add_subdirectory(cli)
add_subdirectory(thirdparty)
add_subdirectory(autotype)
set(autotype_LIB autotype)
# TODO: Refactor to gui sources
add_subdirectory(qrcode)
set(qrcode_LIB qrcode)
# TODO: Move to gui sources on refactor
add_subdirectory(keeshare)
set(keeshare_LIB keeshare)
add_subdirectory(sshagent)
if(KPXC_FEATURE_SSHAGENT)
set(sshagent_LIB sshagent)
endif()
add_subdirectory(fdosecrets)
if(KPXC_FEATURE_FDOSECRETS)
set(fdosecrets_LIB fdosecrets)
endif()
configure_file(config-keepassx.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx.h)
configure_file(git-info.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/git-info.h)
# Core Library Definition
add_library(keepassxc_core STATIC ${core_SOURCES})
set_target_properties(keepassxc_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
set_target_properties(keepassxc_core PROPERTIES COMPILE_DEFINITIONS KPXC_BUILDING_CORE)
target_link_libraries(keepassxc_core
${qrcode_LIB}
Qt5::Core
@ -375,12 +330,12 @@ target_link_libraries(keepassxc_core
# GUI Library Definition
add_library(keepassxc_gui STATIC ${gui_SOURCES})
set_target_properties(keepassxc_gui PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
set_target_properties(keepassxc_gui PROPERTIES COMPILE_DEFINITIONS KPXC_BUILDING_CORE)
target_link_libraries(keepassxc_gui
keepassxc_core
Qt5::Network
Qt5::Widgets
autotype
${autotype_LIB}
${browser_LIB}
${fdosecrets_LIB}
${keeshare_LIB}
@ -397,7 +352,7 @@ if(HAIKU)
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(keepassxc_core Qt5::DBus ${LIBUSB_LIBRARIES})
if(WITH_XC_X11)
if(WITH_X11)
target_link_libraries(keepassxc_gui Qt5::X11Extras X11)
endif()
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
@ -534,7 +489,7 @@ if(WIN32)
COMPONENT Runtime)
# install OpenSSL library
if(WITH_XC_NETWORKING)
if(KPXC_FEATURE_NETWORK)
find_file(OPENSSL_DLL
NAMES libssl-3.dll libssl-3-x64.dll
HINTS "${OPENSSL_ROOT_DIR}/bin"

View File

@ -148,9 +148,7 @@ AutoType::AutoType(QObject* parent, bool test)
QString pluginPath = resources()->pluginPath(pluginName);
if (!pluginPath.isEmpty()) {
#ifdef WITH_XC_AUTOTYPE
loadPlugin(pluginPath);
#endif
}
connect(qApp, SIGNAL(aboutToQuit()), SLOT(unloadPlugin()));

View File

@ -1,5 +1,19 @@
if(WITH_XC_AUTOTYPE)
if(UNIX AND NOT APPLE AND NOT HAIKU)
# Main auto-type static library
set(autotype_SOURCES
AutoType.cpp
AutoTypeAction.cpp
AutoTypeMatchModel.cpp
AutoTypeMatchView.cpp
AutoTypeSelectDialog.cpp
PickcharsDialog.cpp
WindowSelectComboBox.cpp)
add_library(autotype STATIC ${autotype_SOURCES})
target_link_libraries(autotype Qt5::Core Qt5::Widgets)
# Platform specific auto-type implementations
if(UNIX AND NOT APPLE AND NOT HAIKU)
if(WITH_X11)
find_package(X11 REQUIRED COMPONENTS Xi XTest)
find_package(Qt5X11Extras 5.2 REQUIRED)
if(PRINT_SUMMARY)
@ -9,13 +23,14 @@ if(WITH_XC_AUTOTYPE)
endif()
add_subdirectory(xcb)
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
add_subdirectory(windows)
endif()
if(WITH_TESTS)
add_subdirectory(test)
endif()
elseif(APPLE)
add_subdirectory(mac)
elseif(WIN32)
add_subdirectory(windows)
endif()
# Auto-type tests
if(WITH_TESTS)
add_subdirectory(test)
endif()

View File

@ -17,11 +17,9 @@
#include "BrowserAction.h"
#include "BrowserMessageBuilder.h"
#ifdef WITH_XC_BROWSER_PASSKEYS
#include "BrowserPasskeys.h"
#include "PasskeyUtils.h"
#endif
#include "BrowserSettings.h"
#include "PasskeyUtils.h"
#include "core/Global.h"
#include "core/Tools.h"
@ -110,12 +108,10 @@ QJsonObject BrowserAction::handleAction(QLocalSocket* socket, const QJsonObject&
return handleGlobalAutoType(json, action);
} else if (action.compare("get-database-entries", Qt::CaseSensitive) == 0) {
return handleGetDatabaseEntries(json, action);
#ifdef WITH_XC_BROWSER_PASSKEYS
} else if (action.compare(BROWSER_REQUEST_PASSKEYS_GET) == 0) {
return handlePasskeysGet(json, action);
} else if (action.compare(BROWSER_REQUEST_PASSKEYS_REGISTER) == 0) {
return handlePasskeysRegister(json, action);
#endif
}
// Action was not recognized
@ -519,7 +515,6 @@ QJsonObject BrowserAction::handleGlobalAutoType(const QJsonObject& json, const Q
return buildResponse(action, browserRequest.incrementedNonce);
}
#ifdef WITH_XC_BROWSER_PASSKEYS
QJsonObject BrowserAction::handlePasskeysGet(const QJsonObject& json, const QString& action)
{
if (!m_associated) {
@ -585,7 +580,6 @@ QJsonObject BrowserAction::handlePasskeysRegister(const QJsonObject& json, const
const Parameters params{{"response", response}};
return buildResponse(action, browserRequest.incrementedNonce, params);
}
#endif
QJsonObject BrowserAction::decryptMessage(const QString& message, const QString& nonce)
{

View File

@ -84,19 +84,15 @@ private:
QJsonObject handleGetTotp(const QJsonObject& json, const QString& action);
QJsonObject handleDeleteEntry(const QJsonObject& json, const QString& action);
QJsonObject handleGlobalAutoType(const QJsonObject& json, const QString& action);
#ifdef WITH_XC_BROWSER_PASSKEYS
QJsonObject handlePasskeysGet(const QJsonObject& json, const QString& action);
QJsonObject handlePasskeysRegister(const QJsonObject& json, const QString& action);
#endif
private:
QJsonObject buildResponse(const QString& action, const QString& nonce, const Parameters& params = {});
QJsonObject getErrorReply(const QString& action, const int errorCode) const;
QJsonObject decryptMessage(const QString& message, const QString& nonce);
BrowserRequest decodeRequest(const QJsonObject& json);
StringPairList getConnectionKeys(const BrowserRequest& browserRequest);
private:
static const int MaxUrlLength;
QString m_clientPublicKey;

View File

@ -284,7 +284,7 @@ BrowserPasskeys::buildCredentialPrivateKey(int alg, const QString& predefinedFir
try {
Botan::Ed25519_PrivateKey key(*randomGen()->getRng());
auto publicKey = key.get_public_key();
#ifdef WITH_XC_BOTAN3
#ifdef WITH_BOTAN3
auto privateKey = key.raw_private_key_bits();
#else
auto privateKey = key.get_private_key();
@ -333,7 +333,7 @@ QByteArray BrowserPasskeys::buildSignature(const QByteArray& authenticatorData,
std::vector<uint8_t> rawSignature;
if (algName == "ECDSA") {
Botan::ECDSA_PrivateKey privateKey(algId, privateKeyBytes);
#ifdef WITH_XC_BOTAN3
#ifdef WITH_BOTAN3
Botan::PK_Signer signer(
privateKey, *randomGen()->getRng(), "EMSA1(SHA-256)", Botan::Signature_Format::DerSequence);
#else

View File

@ -23,19 +23,17 @@
#include "BrowserEntrySaveDialog.h"
#include "BrowserHost.h"
#include "BrowserMessageBuilder.h"
#include "BrowserPasskeys.h"
#include "BrowserPasskeysClient.h"
#include "BrowserPasskeysConfirmationDialog.h"
#include "BrowserSettings.h"
#include "PasskeyUtils.h"
#include "core/Tools.h"
#include "gui/MainWindow.h"
#include "gui/MessageBox.h"
#include "gui/UrlTools.h"
#include "gui/osutils/OSUtils.h"
#ifdef WITH_XC_BROWSER_PASSKEYS
#include "BrowserPasskeys.h"
#include "BrowserPasskeysClient.h"
#include "BrowserPasskeysConfirmationDialog.h"
#include "PasskeyUtils.h"
#include "gui/passkeys/PasskeyImporter.h"
#endif
#ifdef Q_OS_MACOS
#include "gui/osutils/macutils/MacUtils.h"
#endif
@ -56,9 +54,7 @@ const QString BrowserService::KEEPASSXCBROWSER_NAME = QStringLiteral("KeePassXC-
const QString BrowserService::KEEPASSXCBROWSER_OLD_NAME = QStringLiteral("keepassxc-browser Settings");
static const QString KEEPASSXCBROWSER_GROUP_NAME = QStringLiteral("KeePassXC-Browser Passwords");
static int KEEPASSXCBROWSER_DEFAULT_ICON = 1;
#ifdef WITH_XC_BROWSER_PASSKEYS
static int KEEPASSXCBROWSER_PASSKEY_ICON = 13;
#endif
// These are for the settings and password conversion
static const QString KEEPASSHTTP_NAME = QStringLiteral("KeePassHttp Settings");
static const QString KEEPASSHTTP_GROUP_NAME = QStringLiteral("KeePassHttp Passwords");
@ -616,7 +612,6 @@ QString BrowserService::getKey(const QString& id)
return db->metadata()->customData()->value(CustomData::BrowserKeyPrefix + id);
}
#ifdef WITH_XC_BROWSER_PASSKEYS
// Passkey registration
QJsonObject BrowserService::showPasskeysRegisterPrompt(const QJsonObject& publicKeyOptions,
const QString& origin,
@ -836,7 +831,6 @@ void BrowserService::addPasskeyToEntry(Entry* entry,
entry->endUpdate();
}
#endif
void BrowserService::addEntry(const EntryParameters& entryParameters,
const QString& group,
@ -1015,12 +1009,10 @@ QList<Entry*> BrowserService::searchEntries(const QSharedPointer<Database>& db,
continue;
}
#ifdef WITH_XC_BROWSER_PASSKEYS
// With Passkeys, check for the Relying Party instead of URL
if (passkey && entry->attributes()->value(BrowserPasskeys::KPEX_PASSKEY_RELYING_PARTY) != siteUrl) {
continue;
}
#endif
// Additional URL check may have already inserted the entry to the list
if (!entries.contains(entry)) {
@ -1353,7 +1345,6 @@ bool BrowserService::shouldIncludeEntry(Entry* entry,
return false;
}
#ifdef WITH_XC_BROWSER_PASSKEYS
// Returns all Passkey entries for the current Relying Party
QList<Entry*> BrowserService::getPasskeyEntries(const QString& rpId, const StringPairList& keyList)
{
@ -1428,7 +1419,6 @@ QJsonObject BrowserService::getPasskeyError(int errorCode) const
{
return QJsonObject({{"errorCode", errorCode}});
}
#endif
bool BrowserService::handleURL(const QString& entryUrl,
const QString& siteUrl,

View File

@ -87,7 +87,7 @@ public:
QSharedPointer<Database> getDatabase(const QUuid& rootGroupUuid = {});
QSharedPointer<Database> selectedDatabase();
QList<QSharedPointer<Database>> getOpenDatabases();
#ifdef WITH_XC_BROWSER_PASSKEYS
QJsonObject showPasskeysRegisterPrompt(const QJsonObject& publicKeyOptions,
const QString& origin,
const StringPairList& keyList);
@ -110,7 +110,7 @@ public:
const QString& credentialId,
const QString& userHandle,
const QString& privateKey);
#endif
void addEntry(const EntryParameters& entryParameters,
const QString& group,
const QString& groupUuid,
@ -182,7 +182,7 @@ private:
bool removeFirstDomain(QString& hostname);
bool
shouldIncludeEntry(Entry* entry, const QString& url, const QString& submitUrl, const bool omitWwwSubdomain = false);
#ifdef WITH_XC_BROWSER_PASSKEYS
QList<Entry*> getPasskeyEntries(const QString& rpId, const StringPairList& keyList);
QList<Entry*>
getPasskeyEntriesWithUserHandle(const QString& rpId, const QString& userId, const StringPairList& keyList);
@ -192,7 +192,7 @@ private:
const QString& rpId,
const StringPairList& keyList);
QJsonObject getPasskeyError(int errorCode) const;
#endif
bool handleURL(const QString& entryUrl,
const QString& siteUrl,
const QString& formUrl,
@ -217,9 +217,7 @@ private:
Q_DISABLE_COPY(BrowserService);
friend class TestBrowser;
#ifdef WITH_XC_BROWSER_PASSKEYS
friend class TestPasskeys;
#endif
};
static inline BrowserService* browserService()

View File

@ -13,32 +13,28 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if(WITH_XC_BROWSER)
if(KPXC_FEATURE_BROWSER)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(browser_SOURCES
BrowserAccessControlDialog.cpp
BrowserAction.cpp
BrowserCbor.cpp
BrowserEntryConfig.cpp
BrowserEntrySaveDialog.cpp
BrowserHost.cpp
BrowserMessageBuilder.cpp
BrowserPasskeys.cpp
BrowserPasskeysClient.cpp
BrowserPasskeysConfirmationDialog.cpp
BrowserSettingsPage.cpp
BrowserSettingsWidget.cpp
BrowserService.cpp
BrowserSettings.cpp
BrowserShared.cpp
CustomTableWidget.cpp
NativeMessageInstaller.cpp)
if(WITH_XC_BROWSER_PASSKEYS)
list(APPEND browser_SOURCES
BrowserCbor.cpp
BrowserPasskeys.cpp
BrowserPasskeysClient.cpp
BrowserPasskeysConfirmationDialog.cpp
PasskeyUtils.cpp)
endif()
NativeMessageInstaller.cpp
PasskeyUtils.cpp)
add_library(browser STATIC ${browser_SOURCES})
target_link_libraries(browser Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${BOTAN_LIBRARIES})

View File

@ -27,9 +27,7 @@ DatabaseCommand::DatabaseCommand()
positionalArguments.append({QString("database"), QObject::tr("Path of the database."), QString("")});
options.append(Command::KeyFileOption);
options.append(Command::NoPasswordOption);
#ifdef WITH_XC_YUBIKEY
options.append(Command::YubiKeyOption);
#endif
}
int DatabaseCommand::execute(const QStringList& arguments)
@ -55,11 +53,7 @@ int DatabaseCommand::execute(const QStringList& arguments)
db = Utils::unlockDatabase(args.at(0),
!parser->isSet(Command::NoPasswordOption),
parser->value(Command::KeyFileOption),
#ifdef WITH_XC_YUBIKEY
parser->value(Command::YubiKeyOption),
#else
"",
#endif
parser->isSet(Command::QuietOption));
if (!db) {
return EXIT_FAILURE;

View File

@ -51,9 +51,8 @@ Merge::Merge()
options.append(Merge::KeyFileFromOption);
options.append(Merge::NoPasswordFromOption);
options.append(Merge::DryRunOption);
#ifdef WITH_XC_YUBIKEY
options.append(Merge::YubiKeyFromOption);
#endif
positionalArguments.append({QString("database2"), QObject::tr("Path of the database to merge from."), QString("")});
}

View File

@ -21,10 +21,8 @@
#include "core/Entry.h"
#include "core/EntryAttributes.h"
#include "core/Global.h"
#include "keys/FileKey.h"
#ifdef WITH_XC_YUBIKEY
#include "keys/ChallengeResponseKey.h"
#endif
#include "keys/FileKey.h"
#ifdef Q_OS_WIN
#include <windows.h>
@ -154,7 +152,6 @@ namespace Utils
compositeKey->addKey(fileKey);
}
#ifdef WITH_XC_YUBIKEY
if (!yubiKeySlot.isEmpty()) {
unsigned int serial = 0;
int slot;
@ -185,18 +182,14 @@ namespace Utils
YubiKey::instance()->findValidKeys();
}
#else
Q_UNUSED(yubiKeySlot);
#endif // WITH_XC_YUBIKEY
auto db = QSharedPointer<Database>::create();
QString error;
if (db->open(databaseFilename, compositeKey, &error)) {
return db;
} else {
if (!db->open(databaseFilename, compositeKey, &error)) {
err << error << Qt::endl;
return {};
}
return db;
}
/**

View File

@ -12,34 +12,36 @@
#define KEEPASSX_PLUGIN_DIR "@PLUGIN_INSTALL_DIR@"
#define KEEPASSX_DATA_DIR "@DATA_INSTALL_DIR@"
#cmakedefine WITH_XC_AUTOTYPE
#cmakedefine WITH_XC_NETWORKING
#cmakedefine WITH_XC_BROWSER
#cmakedefine WITH_XC_BROWSER_PASSKEYS
#cmakedefine WITH_XC_YUBIKEY
#cmakedefine WITH_XC_SSHAGENT
#cmakedefine WITH_XC_KEESHARE
#cmakedefine WITH_XC_UPDATECHECK
#cmakedefine WITH_XC_FDOSECRETS
#cmakedefine WITH_XC_DOCS
#cmakedefine WITH_XC_X11
#cmakedefine WITH_XC_BOTAN3
/* Build Scope */
#cmakedefine WITH_X11
#cmakedefine WITH_BOTAN3
/* Advanced Features */
#cmakedefine KPXC_FEATURE_BROWSER
#cmakedefine KPXC_FEATURE_SSHAGENT
#cmakedefine KPXC_FEATURE_FDOSECRETS
/* Minor Features */
#cmakedefine KPXC_FEATURE_NETWORK
#cmakedefine KPXC_FEATURE_UPDATES
#cmakedefine KPXC_FEATURE_DOCS
/* Distribution */
#cmakedefine KEEPASSXC_BUILD_TYPE "@KEEPASSXC_BUILD_TYPE@"
#cmakedefine KEEPASSXC_BUILD_TYPE_RELEASE
#cmakedefine KEEPASSXC_BUILD_TYPE_PRE_RELEASE
#cmakedefine KEEPASSXC_BUILD_TYPE_SNAPSHOT
#cmakedefine KEEPASSXC_DIST
#cmakedefine KEEPASSXC_DIST_TYPE "@KEEPASSXC_DIST_TYPE@"
#cmakedefine KEEPASSXC_DIST_SNAP
#cmakedefine KEEPASSXC_DIST_APPIMAGE
#cmakedefine KEEPASSXC_DIST_FLATPAK
/* Security Test Results */
#cmakedefine HAVE_PR_SET_DUMPABLE 1
#cmakedefine HAVE_RLIMIT_CORE 1
#cmakedefine HAVE_PT_DENY_ATTACH 1
/* macOS Feature Support */
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_BIOMETRY()
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_TOUCH_ID()
#cmakedefine01 XC_APPLE_COMPILER_SUPPORT_WATCH()

View File

@ -208,7 +208,7 @@ namespace Bootstrap
goto Cleanup;
}
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
// OpenSSH for Windows ssh-agent service is running as LocalSystem
if (!AddAccessAllowedAce(pACL,
ACL_REVISION,

View File

@ -24,7 +24,7 @@
#include <QTextStream>
#if defined(Q_OS_WIN)
#if defined(KEEPASSX_BUILDING_CORE)
#if defined(KPXC_BUILDING_CORE)
#define KEEPASSXC_EXPORT Q_DECL_IMPORT
#else
#define KEEPASSXC_EXPORT Q_DECL_EXPORT

View File

@ -17,14 +17,8 @@
*/
#include "Group.h"
#include "config-keepassx.h"
#include "core/Config.h"
#ifdef WITH_XC_KEESHARE
#include "keeshare/KeeShare.h"
#endif
#include "core/Global.h"
#include "core/Metadata.h"
#include "core/Tools.h"

View File

@ -51,9 +51,7 @@ namespace Tools
{
QString debugInfo = "KeePassXC - ";
debugInfo.append(QObject::tr("Version %1").arg(KEEPASSXC_VERSION).append("\n"));
#ifndef KEEPASSXC_BUILD_TYPE_RELEASE
debugInfo.append(QObject::tr("Build Type: %1").arg(KEEPASSXC_BUILD_TYPE).append("\n"));
#endif
QString commitHash;
if (!QString(GIT_HEAD).isEmpty()) {
@ -63,9 +61,7 @@ namespace Tools
debugInfo.append(QObject::tr("Revision: %1").arg(commitHash.left(7)).append("\n"));
}
#ifdef KEEPASSXC_DIST
debugInfo.append(QObject::tr("Distribution: %1").arg(KEEPASSXC_DIST_TYPE).append("\n"));
#endif
// Qt related debugging information.
debugInfo.append("\n");
@ -86,35 +82,23 @@ namespace Tools
debugInfo.append("\n\n");
QString extensions;
#ifdef WITH_XC_AUTOTYPE
extensions += "\n- " + QObject::tr("Auto-Type");
#endif
#ifdef WITH_XC_BROWSER
extensions += "\n- " + QObject::tr("Browser Integration");
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
extensions += "\n- " + QObject::tr("Passkeys");
#endif
#ifdef WITH_XC_SSHAGENT
extensions += "\n- " + QObject::tr("SSH Agent");
#endif
#ifdef WITH_XC_KEESHARE
extensions += "\n- " + QObject::tr("KeeShare");
#endif
#ifdef WITH_XC_YUBIKEY
extensions += "\n- " + QObject::tr("YubiKey");
#endif
extensions += "\n- " + QObject::tr("Hardware Keys");
#if defined(Q_OS_MACOS) || defined(Q_CC_MSVC)
extensions += "\n- " + QObject::tr("Quick Unlock");
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_BROWSER
extensions += "\n- " + QObject::tr("Browser Integration");
extensions += "\n- " + QObject::tr("Passkeys");
#endif
#ifdef KPXC_FEATURE_SSHAGENT
extensions += "\n- " + QObject::tr("SSH Agent");
#endif
#ifdef KPXC_FEATURE_FDOSECRETS
extensions += "\n- " + QObject::tr("Secret Service Integration");
#endif
if (extensions.isEmpty()) {
extensions = " " + QObject::tr("None");
}
debugInfo.append(QObject::tr("Enabled extensions:").append(extensions).append("\n"));
return debugInfo;
}

View File

@ -239,7 +239,7 @@ namespace Crypto
{
bool init()
{
#ifdef WITH_XC_BOTAN3
#ifdef WITH_BOTAN3
unsigned int version_major = 3, min_version_minor = 0;
QString versionString = "3.x";
#else

View File

@ -34,7 +34,7 @@ bool SymmetricCipher::init(Mode mode, Direction direction, const QByteArray& key
try {
auto botanMode = modeToString(mode);
auto botanDirection =
#ifdef WITH_XC_BOTAN3
#ifdef WITH_BOTAN3
(direction == SymmetricCipher::Encrypt ? Botan::Cipher_Dir::Encryption : Botan::Cipher_Dir::Decryption);
#else
(direction == SymmetricCipher::Encrypt ? Botan::Cipher_Dir::ENCRYPTION : Botan::Cipher_Dir::DECRYPTION);

View File

@ -1,4 +1,4 @@
if(WITH_XC_FDOSECRETS)
if(KPXC_FEATURE_FDOSECRETS)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
add_library(fdosecrets STATIC

View File

@ -225,7 +225,6 @@ KdbxXmlWriter::BinaryIdxMap Kdbx4Writer::writeAttachments(QIODevice* device, Dat
data.append(entry->attachments()->value(key));
CryptoHash hash(CryptoHash::Sha256);
#ifdef WITH_XC_KEESHARE
// Namespace KeeShare attachments so they don't get deduplicated together with attachments
// from other databases. Prevents potential filesize side channels.
auto group = entry->group();
@ -237,7 +236,6 @@ KdbxXmlWriter::BinaryIdxMap Kdbx4Writer::writeAttachments(QIODevice* device, Dat
} else {
hash.addData(db->uuid().toByteArray());
}
#endif
hash.addData(data);
// Deduplicate attachments with the same hash

View File

@ -109,7 +109,6 @@ void KdbxXmlWriter::fillBinaryIdxMap()
for (const QString& key : attachmentKeys) {
QByteArray data = entry->attachments()->value(key);
CryptoHash hash(CryptoHash::Sha256);
#ifdef WITH_XC_KEESHARE
// Namespace KeeShare attachments so they don't get deduplicated together with attachments
// from other databases. Prevents potential filesize side channels.
auto group = entry->group();
@ -121,7 +120,6 @@ void KdbxXmlWriter::fillBinaryIdxMap()
} else {
hash.addData(m_db->uuid().toByteArray());
}
#endif
hash.addData(data);
const auto hashResult = hash.result();

View File

@ -34,7 +34,7 @@
#include "FileDialog.h"
#include "MessageBox.h"
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
#include "browser/BrowserSettingsPage.h"
#endif
@ -100,7 +100,7 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
m_generalUi->setupUi(m_generalWidget);
addPage(tr("General"), icons()->icon("preferences-other"), m_generalWidget);
addPage(tr("Security"), icons()->icon("security-high"), m_secWidget);
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
addSettingsPage(new BrowserSettingsPage());
#endif
@ -169,7 +169,7 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
m_generalUi->languageComboBox->installEventFilter(mouseWheelFilter);
m_generalUi->trayIconAppearance->installEventFilter(mouseWheelFilter);
#ifdef WITH_XC_UPDATECHECK
#ifdef KPXC_FEATURE_UPDATES
connect(m_generalUi->checkForUpdatesOnStartupCheckBox, SIGNAL(toggled(bool)), SLOT(checkUpdatesToggled(bool)));
#else
m_generalUi->checkForUpdatesOnStartupCheckBox->setVisible(false);
@ -177,7 +177,7 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
m_generalUi->checkUpdatesSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
#endif
#ifndef WITH_XC_NETWORKING
#ifndef KPXC_FEATURE_NETWORK
m_secUi->privacy->setVisible(false);
m_generalUi->faviconTimeoutLabel->setVisible(false);
m_generalUi->faviconTimeoutSpinBox->setVisible(false);

View File

@ -25,9 +25,7 @@
#include "gui/MessageBox.h"
#include "keys/ChallengeResponseKey.h"
#include "keys/FileKey.h"
#ifdef WITH_XC_YUBIKEY
#include "keys/drivers/YubiKeyInterfaceUSB.h"
#endif
#include "quickunlock/QuickUnlockInterface.h"
#include <QCheckBox>
@ -52,9 +50,7 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
: DialogyWidget(parent)
, m_ui(new Ui::DatabaseOpenWidget())
, m_db(nullptr)
#ifdef WITH_XC_YUBIKEY
, m_deviceListener(new DeviceListener(this))
#endif
{
m_ui->setupUi(this);
@ -102,7 +98,6 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
sp.setRetainSizeWhenHidden(true);
m_ui->hardwareKeyProgress->setSizePolicy(sp);
#ifdef WITH_XC_YUBIKEY
connect(m_deviceListener, SIGNAL(devicePlugged(bool, void*, void*)), this, SLOT(pollHardwareKey()));
connect(YubiKey::instance(), SIGNAL(detectComplete(bool)), SLOT(hardwareKeyResponse(bool)), Qt::QueuedConnection);
@ -123,10 +118,6 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
connect(&m_hideNoHardwareKeysFoundTimer, &QTimer::timeout, this, [this] {
m_ui->noHardwareKeysFoundLabel->setVisible(false);
});
#else
m_ui->noHardwareKeysFoundLabel->setVisible(false);
m_ui->refreshHardwareKeys->setVisible(false);
#endif
// QuickUnlock actions
connect(m_ui->quickUnlockButton, &QPushButton::pressed, this, [this] { openDatabase(); });
@ -168,7 +159,6 @@ bool DatabaseOpenWidget::event(QEvent* event)
toggleQuickUnlockScreen();
if (type == QEvent::Show) {
#ifdef WITH_XC_YUBIKEY
#ifdef Q_OS_WIN
m_deviceListener->registerHotplugCallback(true,
true,
@ -183,7 +173,6 @@ bool DatabaseOpenWidget::event(QEvent* event)
#else
m_deviceListener->registerHotplugCallback(true, true, YubiKeyInterfaceUSB::YUBICO_USB_VID);
m_deviceListener->registerHotplugCallback(true, true, YubiKeyInterfaceUSB::ONLYKEY_USB_VID);
#endif
#endif
}
@ -199,11 +188,9 @@ bool DatabaseOpenWidget::event(QEvent* event)
m_hideTimer.start();
}
#ifdef WITH_XC_YUBIKEY
if (type == QEvent::Hide) {
m_deviceListener->deregisterAllHotplugCallbacks();
}
#endif
ret = true;
}
@ -238,10 +225,8 @@ void DatabaseOpenWidget::load(const QString& filename)
toggleQuickUnlockScreen();
#ifdef WITH_XC_YUBIKEY
// Do initial auto-poll
pollHardwareKey();
#endif
}
void DatabaseOpenWidget::clearForms()
@ -426,7 +411,6 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::buildDatabaseKey()
config()->set(Config::LastKeyFiles, lastKeyFiles);
}
#ifdef WITH_XC_YUBIKEY
auto lastChallengeResponse = config()->get(Config::LastChallengeResponse).toHash();
lastChallengeResponse.remove(m_filename);
@ -443,7 +427,6 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::buildDatabaseKey()
if (config()->get(Config::RememberLastKeyFiles).toBool()) {
config()->set(Config::LastChallengeResponse, lastChallengeResponse);
}
#endif
return databaseKey;
}

View File

@ -23,11 +23,8 @@
#include <QScopedPointer>
#include <QTimer>
#include "config-keepassx.h"
#include "gui/DialogyWidget.h"
#ifdef WITH_XC_YUBIKEY
#include "osutils/DeviceListener.h"
#endif
class CompositeKey;
class Database;
@ -83,9 +80,7 @@ private slots:
void hardwareKeyResponse(bool found);
private:
#ifdef WITH_XC_YUBIKEY
QPointer<DeviceListener> m_deviceListener;
#endif
bool m_pollingHardwareKey = false;
bool m_manualHardwareKeyRefresh = false;
bool m_blockQuickUnlock = false;

View File

@ -552,7 +552,7 @@ void DatabaseTabWidget::showDatabaseSettings()
currentDatabaseWidget()->switchToDatabaseSettings();
}
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
void DatabaseTabWidget::showPasskeys()
{
currentDatabaseWidget()->switchToPasskeys();

View File

@ -84,7 +84,7 @@ public slots:
void showDatabaseSecurity();
void showDatabaseReports();
void showDatabaseSettings();
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
void showPasskeys();
void importPasskey();
void importPasskeyToEntry();

View File

@ -59,15 +59,15 @@
#include "remote/RemoteHandler.h"
#include "remote/RemoteSettings.h"
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
#include "gui/IconDownloaderDialog.h"
#endif
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
#include "sshagent/SSHAgent.h"
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
#include "gui/passkeys/PasskeyImporter.h"
#endif
@ -133,9 +133,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
auto rightHandSideVBox = new QVBoxLayout();
rightHandSideVBox->setMargin(0);
rightHandSideVBox->addWidget(m_searchingLabel);
#ifdef WITH_XC_KEESHARE
rightHandSideVBox->addWidget(m_shareLabel);
#endif
rightHandSideVBox->addWidget(m_previewSplitter);
rightHandSideWidget->setLayout(rightHandSideVBox);
m_entryView = new EntryView(rightHandSideWidget);
@ -166,12 +164,10 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
m_searchingLabel->setAlignment(Qt::AlignCenter);
m_searchingLabel->setVisible(false);
#ifdef WITH_XC_KEESHARE
m_shareLabel->setObjectName("KeeShareBanner");
m_shareLabel->setRawText(tr("Shared group…"));
m_shareLabel->setAlignment(Qt::AlignCenter);
m_shareLabel->setVisible(false);
#endif
m_previewView->setObjectName("previewWidget");
m_previewView->hide();
@ -229,11 +225,9 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
m_searchLimitGroup = config()->get(Config::SearchLimitGroup).toBool();
#ifdef WITH_XC_KEESHARE
// We need to reregister the database to allow exports
// from a newly created database
KeeShare::instance()->connectDatabase(m_db, {});
#endif
if (m_db->isInitialized()) {
switchToMainView();
@ -478,12 +472,7 @@ void DatabaseWidget::replaceDatabase(QSharedPointer<Database> db)
emit databaseReplaced(oldDb, m_db);
#if defined(WITH_XC_KEESHARE)
KeeShare::instance()->connectDatabase(m_db, oldDb);
#else
// Keep the instance active till the end of this function
Q_UNUSED(oldDb);
#endif
oldDb->releaseData();
}
@ -783,7 +772,7 @@ void DatabaseWidget::setClipboardTextAndMinimize(const QString& text)
}
}
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
void DatabaseWidget::addToAgent()
{
Entry* currentEntry = m_entryView->currentEntry();
@ -888,7 +877,7 @@ void DatabaseWidget::openUrl()
void DatabaseWidget::downloadSelectedFavicons()
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
QList<Entry*> selectedEntries;
for (const auto& index : m_entryView->selectionModel()->selectedRows()) {
selectedEntries.append(m_entryView->entryFromIndex(index));
@ -901,7 +890,7 @@ void DatabaseWidget::downloadSelectedFavicons()
void DatabaseWidget::downloadAllFavicons()
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
auto currentGroup = m_groupView->currentGroup();
if (currentGroup) {
performIconDownloads(currentGroup->entries());
@ -911,7 +900,7 @@ void DatabaseWidget::downloadAllFavicons()
void DatabaseWidget::downloadFaviconInBackground(Entry* entry)
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
performIconDownloads({entry}, true, true);
#else
Q_UNUSED(entry);
@ -920,7 +909,7 @@ void DatabaseWidget::downloadFaviconInBackground(Entry* entry)
void DatabaseWidget::performIconDownloads(const QList<Entry*>& entries, bool force, bool downloadInBackground)
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
auto* iconDownloaderDialog = new IconDownloaderDialog(this);
connect(this, SIGNAL(databaseLockRequested()), iconDownloaderDialog, SLOT(close()));
@ -1295,7 +1284,7 @@ void DatabaseWidget::loadDatabase(bool accepted)
m_entryBeforeLock = QUuid();
m_saveAttempts = 0;
emit databaseUnlocked();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
sshAgent()->databaseUnlocked(m_db);
#endif
if (config()->get(Config::MinimizeAfterUnlock).toBool()) {
@ -1445,7 +1434,7 @@ void DatabaseWidget::unlockDatabase(bool accepted)
processAutoOpen();
emit databaseUnlocked();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
sshAgent()->databaseUnlocked(m_db);
#endif
@ -1587,7 +1576,7 @@ void DatabaseWidget::switchToRemoteSettings()
m_databaseSettingDialog->showRemoteSettings();
}
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
void DatabaseWidget::switchToPasskeys()
{
switchToDatabaseReports();
@ -1684,9 +1673,7 @@ void DatabaseWidget::search(const QString& searchtext)
m_lastSearchText = searchtext;
m_searchingLabel->setVisible(true);
#ifdef WITH_XC_KEESHARE
m_shareLabel->setVisible(false);
#endif
emit searchModeActivated();
}
@ -1751,7 +1738,6 @@ void DatabaseWidget::onGroupChanged()
m_previewView->setGroup(group);
#ifdef WITH_XC_KEESHARE
auto shareLabel = KeeShare::sharingLabel(group);
if (!shareLabel.isEmpty()) {
m_shareLabel->setRawText(shareLabel);
@ -1759,7 +1745,6 @@ void DatabaseWidget::onGroupChanged()
} else {
m_shareLabel->setVisible(false);
}
#endif
emit groupChanged();
}
@ -2024,7 +2009,7 @@ bool DatabaseWidget::lock()
m_entryBeforeLock = currentEntry->uuid();
}
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
sshAgent()->databaseLocked(m_db);
#endif
@ -2205,7 +2190,7 @@ bool DatabaseWidget::currentEntryHasTotp()
return currentEntry->hasTotp();
}
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
bool DatabaseWidget::currentEntryHasSshKey()
{
Entry* currentEntry = m_entryView->currentEntry();
@ -2218,7 +2203,7 @@ bool DatabaseWidget::currentEntryHasSshKey()
}
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
bool DatabaseWidget::currentEntryHasPasskey()
{
auto currentEntry = m_entryView->currentEntry();

View File

@ -113,7 +113,7 @@ public:
bool currentEntryHasUrl();
bool currentEntryHasNotes();
bool currentEntryHasTotp();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
bool currentEntryHasSshKey();
#endif
bool currentEntryHasAutoTypeEnabled();
@ -197,7 +197,7 @@ public slots:
void copyTotp();
void copyPasswordTotp();
void setupTotp();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
void addToAgent();
void removeFromAgent();
#endif
@ -225,7 +225,7 @@ public slots:
void switchToDatabaseReports();
void switchToDatabaseSettings();
void switchToRemoteSettings();
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
void switchToPasskeys();
void showImportPasskeyDialog(bool isEntry = false);
void removePasskeyFromEntry();

View File

@ -28,7 +28,7 @@
#include "gui/IconModels.h"
#include "gui/Icons.h"
#include "gui/MessageBox.h"
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
#include "gui/IconDownloader.h"
#endif
@ -48,7 +48,7 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
, m_applyIconTo(ApplyIconToOptions::THIS_ONLY)
, m_defaultIconModel(new DefaultIconModel(this))
, m_customIconModel(new CustomIconModel(this))
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
, m_downloader(new IconDownloader())
#endif
{
@ -73,14 +73,14 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
this, SIGNAL(widgetUpdated()));
connect(m_ui->customIconsView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SIGNAL(widgetUpdated()));
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
connect(m_downloader.data(),
SIGNAL(finished(const QString&, const QImage&)),
SLOT(iconReceived(const QString&, const QImage&)));
#endif
// clang-format on
#ifndef WITH_XC_NETWORKING
#ifndef KPXC_FEATURE_NETWORK
m_ui->faviconButton->setVisible(false);
m_ui->faviconURL->setVisible(false);
#endif
@ -188,7 +188,7 @@ void EditWidgetIcons::keyPressEvent(QKeyEvent* event)
void EditWidgetIcons::setUrl(const QString& url)
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
QUrl urlCheck(url);
if (urlCheck.scheme().startsWith("http")) {
m_ui->faviconURL->setText(urlCheck.url(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::RemoveFragment));
@ -203,7 +203,7 @@ void EditWidgetIcons::setUrl(const QString& url)
void EditWidgetIcons::downloadFavicon()
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
auto url = m_ui->faviconURL->text();
if (!url.isEmpty()) {
m_downloader->setUrl(url);
@ -214,7 +214,7 @@ void EditWidgetIcons::downloadFavicon()
void EditWidgetIcons::iconReceived(const QString& url, const QImage& icon)
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
Q_UNUSED(url);
if (icon.isNull()) {
QString message(tr("Unable to fetch favicon."));
@ -237,7 +237,7 @@ void EditWidgetIcons::iconReceived(const QString& url, const QImage& icon)
void EditWidgetIcons::abortRequests()
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
if (m_downloader) {
m_downloader->abortDownload();
}

View File

@ -28,7 +28,7 @@
class Database;
class DefaultIconModel;
class CustomIconModel;
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
class IconDownloader;
#endif
@ -104,7 +104,7 @@ private:
ApplyIconToOptions m_applyIconTo;
DefaultIconModel* const m_defaultIconModel;
CustomIconModel* const m_customIconModel;
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
QSharedPointer<IconDownloader> m_downloader;
#endif

View File

@ -25,10 +25,8 @@
#include "core/Totp.h"
#include "gui/Font.h"
#include "gui/Icons.h"
#if defined(WITH_XC_KEESHARE)
#include "keeshare/KeeShare.h"
#include "keeshare/KeeShareSettings.h"
#endif
#include <QScrollBar>
#include <QTabWidget>
@ -105,10 +103,6 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
connect(m_ui->groupTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection);
setFocusProxy(m_ui->entryTabWidget);
#if !defined(WITH_XC_KEESHARE)
removeTab(m_ui->groupTabWidget, m_ui->groupShareTab);
#endif
}
EntryPreviewWidget::~EntryPreviewWidget() = default;
@ -206,10 +200,7 @@ void EntryPreviewWidget::refresh()
} else if (m_currentGroup) {
updateGroupHeaderLine();
updateGroupGeneralTab();
#if defined(WITH_XC_KEESHARE)
updateGroupSharingTab();
#endif
setVisible(!config()->get(Config::GUI_HidePreviewPanel).toBool());
@ -527,7 +518,6 @@ void EntryPreviewWidget::updateGroupGeneralTab()
}
}
#if defined(WITH_XC_KEESHARE)
void EntryPreviewWidget::updateGroupSharingTab()
{
Q_ASSERT(m_currentGroup);
@ -536,7 +526,6 @@ void EntryPreviewWidget::updateGroupSharingTab()
m_ui->groupShareTypeLabel->setText(KeeShare::referenceTypeLabel(reference));
m_ui->groupSharePathLabel->setText(reference.path);
}
#endif
void EntryPreviewWidget::updateTotpLabel()
{

View File

@ -65,9 +65,7 @@ private slots:
void updateGroupHeaderLine();
void updateGroupGeneralTab();
#if defined(WITH_XC_KEESHARE)
void updateGroupSharingTab();
#endif
void updateTotpLabel();
void updateTabIndexes();

View File

@ -24,16 +24,12 @@
#include <QPaintDevice>
#include <QPainter>
#include "config-keepassx.h"
#include "core/Config.h"
#include "core/Database.h"
#include "gui/DatabaseIcons.h"
#include "gui/MainWindow.h"
#include "gui/osutils/OSUtils.h"
#ifdef WITH_XC_KEESHARE
#include "keeshare/KeeShare.h"
#endif
class AdaptiveIconEngine : public QIconEngine
{
@ -263,12 +259,9 @@ QPixmap Icons::groupIconPixmap(const Group* group, IconSize size)
if (group->isExpired()) {
icon = databaseIcons()->applyBadge(icon, DatabaseIcons::Badges::Expired);
}
#ifdef WITH_XC_KEESHARE
else if (KeeShare::isShared(group)) {
} else if (KeeShare::isShared(group)) {
icon = KeeShare::indicatorBadge(group, icon);
}
#endif
return icon;
}

View File

@ -47,30 +47,25 @@
#include "gui/entry/EntryView.h"
#include "gui/osutils/OSUtils.h"
#include "gui/remote/RemoteSettings.h"
#include "keeshare/KeeShare.h"
#include "keeshare/SettingsPageKeeShare.h"
#include "keys/drivers/YubiKey.h"
#ifdef WITH_XC_UPDATECHECK
#ifdef KPXC_FEATURE_UPDATES
#include "gui/UpdateCheckDialog.h"
#include "networking/UpdateChecker.h"
#endif
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
#include "sshagent/AgentSettingsPage.h"
#include "sshagent/SSHAgent.h"
#endif
#ifdef WITH_XC_KEESHARE
#include "keeshare/KeeShare.h"
#include "keeshare/SettingsPageKeeShare.h"
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
#include "fdosecrets/FdoSecretsPlugin.h"
#endif
#ifdef WITH_XC_YUBIKEY
#include "keys/drivers/YubiKey.h"
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
#include "browser/BrowserService.h"
#endif
@ -158,7 +153,7 @@ MainWindow::MainWindow()
m_entryContextMenu->addSeparator();
m_entryContextMenu->addAction(m_ui->actionEntryAutoType);
m_entryContextMenu->addSeparator();
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
m_entryContextMenu->addAction(m_ui->actionEntryImportPasskey);
m_entryContextMenu->addAction(m_ui->actionEntryRemovePasskey);
m_entryContextMenu->addSeparator();
@ -220,26 +215,24 @@ MainWindow::MainWindow()
m_ui->settingsWidget->addSettingsPage(new ShortcutSettingsPage());
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
connect(
browserService(), &BrowserService::requestUnlock, m_ui->tabWidget, &DatabaseTabWidget::performBrowserUnlock);
#endif
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
connect(sshAgent(), SIGNAL(error(QString)), this, SLOT(showErrorMessage(QString)));
connect(sshAgent(), SIGNAL(enabledChanged(bool)), this, SLOT(agentEnabled(bool)));
m_ui->settingsWidget->addSettingsPage(new AgentSettingsPage());
#endif
#if defined(WITH_XC_KEESHARE)
KeeShare::init(this);
m_ui->settingsWidget->addSettingsPage(new SettingsPageKeeShare(m_ui->tabWidget));
connect(KeeShare::instance(),
SIGNAL(sharingMessage(QString, MessageWidget::MessageType)),
SLOT(displayGlobalMessage(QString, MessageWidget::MessageType)));
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
auto fdoSS = new FdoSecretsPlugin(m_ui->tabWidget);
connect(fdoSS, &FdoSecretsPlugin::error, this, &MainWindow::showErrorMessage);
connect(fdoSS, &FdoSecretsPlugin::requestSwitchToDatabases, this, &MainWindow::switchToDatabases);
@ -248,10 +241,8 @@ MainWindow::MainWindow()
m_ui->settingsWidget->addSettingsPage(fdoSS);
#endif
#ifdef WITH_XC_YUBIKEY
connect(YubiKey::instance(), SIGNAL(userInteractionRequest()), SLOT(showYubiKeyPopup()), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(challengeCompleted()), SLOT(hideYubiKeyPopup()), Qt::QueuedConnection);
#endif
setWindowIcon(icons()->applicationIcon());
m_ui->globalMessageWidget->hideMessage();
@ -430,7 +421,7 @@ MainWindow::MainWindow()
m_ui->actionKeyboardShortcuts->setIcon(icons()->icon("keyboard-shortcuts"));
m_ui->actionCheckForUpdates->setIcon(icons()->icon("system-software-update"));
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
m_ui->actionPasskeys->setIcon(icons()->icon("passkey"));
m_ui->actionImportPasskey->setIcon(icons()->icon("document-import"));
m_ui->actionEntryImportPasskey->setIcon(icons()->icon("document-import"));
@ -482,7 +473,7 @@ MainWindow::MainWindow()
connect(m_ui->actionDatabaseSecurity, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseSecurity()));
connect(m_ui->actionReports, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseReports()));
connect(m_ui->actionDatabaseSettings, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showDatabaseSettings()));
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
connect(m_ui->actionPasskeys, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showPasskeys()));
connect(m_ui->actionImportPasskey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importPasskey()));
connect(m_ui->actionEntryImportPasskey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importPasskeyToEntry()));
@ -530,7 +521,7 @@ MainWindow::MainWindow()
m_actionMultiplexer.connect(m_ui->actionEntryAutoTypeTOTP, SIGNAL(triggered()), SLOT(performAutoTypeTOTP()));
m_actionMultiplexer.connect(m_ui->actionEntryOpenUrl, SIGNAL(triggered()), SLOT(openUrl()));
m_actionMultiplexer.connect(m_ui->actionEntryDownloadIcon, SIGNAL(triggered()), SLOT(downloadSelectedFavicons()));
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
m_actionMultiplexer.connect(m_ui->actionEntryAddToAgent, SIGNAL(triggered()), SLOT(addToAgent()));
m_actionMultiplexer.connect(m_ui->actionEntryRemoveFromAgent, SIGNAL(triggered()), SLOT(removeFromAgent()));
#endif
@ -580,7 +571,7 @@ MainWindow::MainWindow()
setUnifiedTitleAndToolBarOnMac(true);
#endif
#ifdef WITH_XC_UPDATECHECK
#ifdef KPXC_FEATURE_UPDATES
connect(m_ui->actionCheckForUpdates, SIGNAL(triggered()), SLOT(showUpdateCheckDialog()));
connect(UpdateChecker::instance(),
SIGNAL(updateCheckFinished(bool, QString, bool)),
@ -594,11 +585,11 @@ MainWindow::MainWindow()
m_ui->actionCheckForUpdates->setVisible(false);
#endif
#ifndef WITH_XC_NETWORKING
#ifndef KPXC_FEATURE_NETWORK
m_ui->actionGroupDownloadFavicons->setVisible(false);
m_ui->actionEntryDownloadIcon->setVisible(false);
#endif
#ifndef WITH_XC_DOCS
#ifndef KPXC_FEATURE_DOCS
m_ui->actionGettingStarted->setVisible(false);
m_ui->actionUserGuide->setVisible(false);
m_ui->actionKeyboardShortcuts->setVisible(false);
@ -630,36 +621,27 @@ MainWindow::MainWindow()
// Properly shutdown on logoff, restart, and shutdown
connect(qApp, &QGuiApplication::commitDataRequest, this, [this] { m_appExitCalled = true; });
#if defined(KEEPASSXC_BUILD_TYPE_SNAPSHOT) || defined(KEEPASSXC_BUILD_TYPE_PRE_RELEASE)
#ifdef KEEPASSXC_BUILD_TYPE_SNAPSHOT
auto* hidePreRelWarn = new QAction(tr("Don't show again for this version"), m_ui->globalMessageWidget);
m_ui->globalMessageWidget->addAction(hidePreRelWarn);
auto hidePreRelWarnConn = QSharedPointer<QMetaObject::Connection>::create();
*hidePreRelWarnConn = connect(m_ui->globalMessageWidget, &KMessageWidget::hideAnimationFinished, [=] {
*hidePreRelWarnConn = connect(m_ui->globalMessageWidget, &MessageWidget::hideAnimationStarted, [=] {
m_ui->globalMessageWidget->removeAction(hidePreRelWarn);
disconnect(*hidePreRelWarnConn);
hidePreRelWarn->deleteLater();
});
connect(hidePreRelWarn, &QAction::triggered, [=] {
m_ui->globalMessageWidget->animatedHide();
m_ui->globalMessageWidget->hideMessage();
config()->set(Config::Messages_HidePreReleaseWarning, KEEPASSXC_VERSION);
});
#endif
#if defined(KEEPASSXC_BUILD_TYPE_SNAPSHOT)
if (config()->get(Config::Messages_HidePreReleaseWarning) != KEEPASSXC_VERSION) {
m_ui->globalMessageWidget->showMessage(
tr("WARNING: You are using an unstable build of KeePassXC.\n"
"There is a high risk of corruption, maintain a backup of your databases.\n"
"This version is not meant for production use."),
MessageWidget::Warning,
-1);
}
#elif defined(KEEPASSXC_BUILD_TYPE_PRE_RELEASE)
if (config()->get(Config::Messages_HidePreReleaseWarning) != KEEPASSXC_VERSION) {
m_ui->globalMessageWidget->showMessage(
tr("NOTE: You are using a pre-release version of KeePassXC.\n"
"Expect some bugs and minor issues, this version is meant for testing purposes."),
MessageWidget::Information,
-1);
m_ui->globalMessageWidget->showMessage(tr("WARNING: You are using a development snapshot build of KeePassXC.\n"
"Maintain a backup of your databases in the event of unknown bugs.\n"
"This version is not meant for production use."),
MessageWidget::Warning,
-1);
}
#endif
@ -695,7 +677,7 @@ MainWindow::MainWindow()
MainWindow::~MainWindow()
{
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
sshAgent()->removeAllIdentities();
#endif
}
@ -747,11 +729,7 @@ void MainWindow::appExit()
*/
bool MainWindow::isHardwareKeySupported()
{
#ifdef WITH_XC_YUBIKEY
return true;
#else
return false;
#endif
}
/**
@ -763,7 +741,6 @@ bool MainWindow::isHardwareKeySupported()
*/
bool MainWindow::refreshHardwareKeys()
{
#ifdef WITH_XC_YUBIKEY
auto yk = YubiKey::instance();
// find keys sync to allow returning if any key was found
bool found = yk->findValidKeys();
@ -771,9 +748,6 @@ bool MainWindow::refreshHardwareKeys()
// emit here manually because sync findValidKeys() cannot do that properly
emit yk->detectComplete(found);
return found;
#else
return false;
#endif
}
void MainWindow::updateLastDatabasesMenu()
@ -959,7 +933,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionGroupSortDesc->setEnabled(groupSelected && currentGroupHasChildren);
m_ui->actionGroupEmptyRecycleBin->setVisible(recycleBinSelected);
m_ui->actionGroupEmptyRecycleBin->setEnabled(recycleBinSelected);
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
m_ui->actionGroupDownloadFavicons->setVisible(!recycleBinSelected);
#endif
m_ui->actionGroupDownloadFavicons->setEnabled(groupSelected && currentGroupHasEntries
@ -975,7 +949,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionExportHtml->setEnabled(true);
m_ui->actionExportXML->setEnabled(true);
m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1);
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
bool singleEntryHasPasskey = singleEntrySelected && dbWidget->currentEntryHasPasskey();
m_ui->actionPasskeys->setEnabled(true);
m_ui->actionImportPasskey->setEnabled(true);
@ -983,7 +957,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionEntryRemovePasskey->setEnabled(singleEntryHasPasskey);
#endif
m_ui->menuRemoteSync->setEnabled(true);
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
bool singleEntryHasSshKey =
singleEntrySelected && sshAgent()->isEnabled() && dbWidget->currentEntryHasSshKey();
m_ui->actionEntryAddToAgent->setVisible(singleEntryHasSshKey);
@ -1050,7 +1024,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionEntryRemoveFromAgent->setVisible(false);
m_ui->actionGroupEmptyRecycleBin->setVisible(false);
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
m_ui->actionPasskeys->setEnabled(false);
m_ui->actionImportPasskey->setEnabled(false);
m_ui->actionEntryImportPasskey->setEnabled(false);
@ -1185,7 +1159,7 @@ void MainWindow::showAboutDialog()
void MainWindow::performUpdateCheck()
{
#ifdef WITH_XC_UPDATECHECK
#ifdef KPXC_FEATURE_UPDATES
if (!config()->get(Config::UpdateCheckMessageShown).toBool()) {
auto result =
MessageBox::question(this,
@ -1208,7 +1182,7 @@ void MainWindow::performUpdateCheck()
void MainWindow::hasUpdateAvailable(bool hasUpdate, const QString& version, bool isManuallyRequested)
{
#ifdef WITH_XC_UPDATECHECK
#ifdef KPXC_FEATURE_UPDATES
if (hasUpdate && !isManuallyRequested) {
auto* updateCheckDialog = new UpdateCheckDialog(this);
updateCheckDialog->showUpdateCheckResponse(hasUpdate, version);
@ -1223,7 +1197,7 @@ void MainWindow::hasUpdateAvailable(bool hasUpdate, const QString& version, bool
void MainWindow::showUpdateCheckDialog()
{
#ifdef WITH_XC_UPDATECHECK
#ifdef KPXC_FEATURE_UPDATES
updateCheck()->checkForUpdates(true);
auto* updateCheckDialog = new UpdateCheckDialog(this);
updateCheckDialog->show();

View File

@ -16,7 +16,7 @@
*/
#include "UrlTools.h"
#if defined(WITH_XC_NETWORKING) || defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_NETWORK) || defined(KPXC_FEATURE_BROWSER)
#include <QHostAddress>
#include <QNetworkCookie>
#include <QNetworkCookieJar>
@ -40,7 +40,7 @@ QUrl UrlTools::convertVariantToUrl(const QVariant& var) const
return url;
}
#if defined(WITH_XC_NETWORKING) || defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_NETWORK) || defined(KPXC_FEATURE_BROWSER)
QUrl UrlTools::getRedirectTarget(QNetworkReply* reply) const
{
QVariant var = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);

View File

@ -22,7 +22,7 @@
#include <QObject>
#include <QUrl>
#include <QVariant>
#if defined(WITH_XC_NETWORKING) || defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_NETWORK) || defined(KPXC_FEATURE_BROWSER)
#include <QNetworkReply>
#endif
@ -34,7 +34,7 @@ public:
explicit UrlTools() = default;
static UrlTools* instance();
#if defined(WITH_XC_NETWORKING) || defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_NETWORK) || defined(KPXC_FEATURE_BROWSER)
QUrl getRedirectTarget(QNetworkReply* reply) const;
QString getBaseDomainFromUrl(const QString& url) const;
QString getTopLevelDomainFromUrl(const QString& url) const;

View File

@ -24,22 +24,16 @@
#include "gui/Icons.h"
#include "keys/ChallengeResponseKey.h"
#include "keys/CompositeKey.h"
#ifdef WITH_XC_YUBIKEY
#include "keys/drivers/YubiKeyInterfaceUSB.h"
#endif
YubiKeyEditWidget::YubiKeyEditWidget(QWidget* parent)
: KeyComponentWidget(parent)
, m_compUi(new Ui::YubiKeyEditWidget())
#ifdef WITH_XC_YUBIKEY
, m_deviceListener(new DeviceListener(this))
#endif
{
initComponent();
#ifdef WITH_XC_YUBIKEY
connect(YubiKey::instance(), SIGNAL(detectComplete(bool)), SLOT(hardwareKeyResponse(bool)), Qt::QueuedConnection);
connect(m_deviceListener, &DeviceListener::devicePlugged, this, [&](bool, void*, void*) { pollYubikey(); });
#endif
}
YubiKeyEditWidget::~YubiKeyEditWidget() = default;
@ -90,7 +84,6 @@ void YubiKeyEditWidget::showEvent(QShowEvent* event)
{
KeyComponentWidget::showEvent(event);
#ifdef WITH_XC_YUBIKEY
#ifdef Q_OS_WIN
m_deviceListener->registerHotplugCallback(true,
true,
@ -106,15 +99,12 @@ void YubiKeyEditWidget::showEvent(QShowEvent* event)
m_deviceListener->registerHotplugCallback(true, true, YubiKeyInterfaceUSB::YUBICO_USB_VID);
m_deviceListener->registerHotplugCallback(true, true, YubiKeyInterfaceUSB::ONLYKEY_USB_VID);
#endif
#endif
}
void YubiKeyEditWidget::hideEvent(QHideEvent* event)
{
KeyComponentWidget::hideEvent(event);
#ifdef WITH_XC_YUBIKEY
m_deviceListener->deregisterAllHotplugCallbacks();
#endif
}
void YubiKeyEditWidget::initComponentEditWidget(QWidget* widget)
@ -146,7 +136,6 @@ void YubiKeyEditWidget::initComponent()
void YubiKeyEditWidget::pollYubikey()
{
#ifdef WITH_XC_YUBIKEY
if (!m_compEditWidget) {
return;
}
@ -159,7 +148,6 @@ void YubiKeyEditWidget::pollYubikey()
m_compUi->refreshHardwareKeys->setEnabled(false);
YubiKey::instance()->findValidKeysAsync();
#endif
}
void YubiKeyEditWidget::hardwareKeyResponse(bool found)

View File

@ -19,10 +19,7 @@
#define KEEPASSXC_YUBIKEYEDITWIDGET_H
#include "KeyComponentWidget.h"
#include "config-keepassx.h"
#ifdef WITH_XC_YUBIKEY
#include "gui/osutils/DeviceListener.h"
#endif
namespace Ui
{
@ -57,9 +54,7 @@ private slots:
private:
const QScopedPointer<Ui::YubiKeyEditWidget> m_compUi;
QPointer<QWidget> m_compEditWidget;
#ifdef WITH_XC_YUBIKEY
QPointer<DeviceListener> m_deviceListener;
#endif
bool m_isDetected = false;
};

View File

@ -20,15 +20,13 @@
#include "DatabaseSettingsWidgetDatabaseKey.h"
#include "DatabaseSettingsWidgetEncryption.h"
#include "DatabaseSettingsWidgetGeneral.h"
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
#include "DatabaseSettingsWidgetBrowser.h"
#endif
#include "../remote/DatabaseSettingsWidgetRemote.h"
#include "DatabaseSettingsWidgetMaintenance.h"
#ifdef WITH_XC_KEESHARE
#include "keeshare/DatabaseSettingsWidgetKeeShare.h"
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
#include "fdosecrets/widgets/DatabaseSettingsWidgetFdoSecrets.h"
#endif
@ -44,13 +42,11 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
, m_securityTabWidget(new QTabWidget(this))
, m_databaseKeyWidget(new DatabaseSettingsWidgetDatabaseKey(this))
, m_encryptionWidget(new DatabaseSettingsWidgetEncryption(this))
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
, m_browserWidget(new DatabaseSettingsWidgetBrowser(this))
#endif
#ifdef WITH_XC_KEESHARE
, m_keeShareWidget(new DatabaseSettingsWidgetKeeShare(this))
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
, m_fdoSecretsWidget(new DatabaseSettingsWidgetFdoSecrets(this))
#endif
, m_maintenanceWidget(new DatabaseSettingsWidgetMaintenance(this))
@ -78,15 +74,13 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
addPage(tr("Remote Sync"), icons()->icon("remote-sync"), m_remoteWidget);
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
addPage(tr("Browser Integration"), icons()->icon("internet-web-browser"), m_browserWidget);
#endif
#ifdef WITH_XC_KEESHARE
addPage(tr("KeeShare"), icons()->icon("preferences-system-network-sharing"), m_keeShareWidget);
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
addPage(tr("Secret Service Integration"), icons()->icon(QStringLiteral("freedesktop")), m_fdoSecretsWidget);
#endif
@ -103,13 +97,11 @@ void DatabaseSettingsDialog::load(const QSharedPointer<Database>& db)
m_databaseKeyWidget->loadSettings(db);
m_encryptionWidget->loadSettings(db);
m_remoteWidget->loadSettings(db);
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
m_browserWidget->loadSettings(db);
#endif
#ifdef WITH_XC_KEESHARE
m_keeShareWidget->loadSettings(db);
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
m_fdoSecretsWidget->loadSettings(db);
#endif
m_maintenanceWidget->loadSettings(db);
@ -157,10 +149,8 @@ void DatabaseSettingsDialog::save()
// Browser settings don't have anything to save
#ifdef WITH_XC_KEESHARE
m_keeShareWidget->saveSettings();
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
m_fdoSecretsWidget->saveSettings();
#endif
@ -173,7 +163,7 @@ void DatabaseSettingsDialog::reject()
m_databaseKeyWidget->discard();
m_encryptionWidget->discard();
m_remoteWidget->discard();
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
m_browserWidget->discard();
#endif

View File

@ -28,13 +28,11 @@ class Database;
class DatabaseSettingsWidgetGeneral;
class DatabaseSettingsWidgetEncryption;
class DatabaseSettingsWidgetDatabaseKey;
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
class DatabaseSettingsWidgetBrowser;
#endif
#ifdef WITH_XC_KEESHARE
class DatabaseSettingsWidgetKeeShare;
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
class DatabaseSettingsWidgetFdoSecrets;
#endif
class DatabaseSettingsWidgetMaintenance;
@ -67,13 +65,11 @@ private:
QPointer<QTabWidget> m_securityTabWidget;
QPointer<DatabaseSettingsWidgetDatabaseKey> m_databaseKeyWidget;
QPointer<DatabaseSettingsWidgetEncryption> m_encryptionWidget;
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
QPointer<DatabaseSettingsWidgetBrowser> m_browserWidget;
#endif
#ifdef WITH_XC_KEESHARE
QPointer<DatabaseSettingsWidgetKeeShare> m_keeShareWidget;
#endif
#ifdef WITH_XC_FDOSECRETS
#ifdef KPXC_FEATURE_FDOSECRETS
QPointer<DatabaseSettingsWidgetFdoSecrets> m_fdoSecretsWidget;
#endif
QPointer<DatabaseSettingsWidgetMaintenance> m_maintenanceWidget;

View File

@ -38,9 +38,7 @@ DatabaseSettingsWidgetDatabaseKey::DatabaseSettingsWidgetDatabaseKey(QWidget* pa
, m_additionalKeyOptions(new QWidget(this))
, m_passwordEditWidget(new PasswordEditWidget(this))
, m_keyFileEditWidget(new KeyFileEditWidget(this))
#ifdef WITH_XC_YUBIKEY
, m_yubiKeyEditWidget(new YubiKeyEditWidget(this))
#endif
{
auto* vbox = new QVBoxLayout(this);
vbox->setSizeConstraint(QLayout::SetMinimumSize);
@ -58,9 +56,7 @@ DatabaseSettingsWidgetDatabaseKey::DatabaseSettingsWidgetDatabaseKey(QWidget* pa
m_additionalKeyOptions->layout()->setMargin(0);
m_additionalKeyOptions->layout()->setSpacing(20);
m_additionalKeyOptions->layout()->addWidget(m_keyFileEditWidget);
#ifdef WITH_XC_YUBIKEY
m_additionalKeyOptions->layout()->addWidget(m_yubiKeyEditWidget);
#endif
m_additionalKeyOptions->setVisible(false);
connect(m_additionalKeyOptionsToggle, SIGNAL(clicked()), SLOT(showAdditionalKeyOptions()));
@ -92,23 +88,19 @@ void DatabaseSettingsWidgetDatabaseKey::loadSettings(QSharedPointer<Database> db
}
}
#ifdef WITH_XC_YUBIKEY
for (const auto& key : m_db->key()->challengeResponseKeys()) {
if (key->uuid() == ChallengeResponseKey::UUID) {
m_yubiKeyEditWidget->setComponentAdded(true);
hasAdditionalKeys = true;
}
}
#endif
setAdditionalKeyOptionsVisible(hasAdditionalKeys);
}
connect(m_passwordEditWidget->findChild<QPushButton*>("removeButton"), SIGNAL(clicked()), SLOT(markDirty()));
connect(m_keyFileEditWidget->findChild<QPushButton*>("removeButton"), SIGNAL(clicked()), SLOT(markDirty()));
#ifdef WITH_XC_YUBIKEY
connect(m_yubiKeyEditWidget->findChild<QPushButton*>("removeButton"), SIGNAL(clicked()), SLOT(markDirty()));
#endif
}
void DatabaseSettingsWidgetDatabaseKey::initialize()
@ -116,9 +108,7 @@ void DatabaseSettingsWidgetDatabaseKey::initialize()
bool blocked = blockSignals(true);
m_passwordEditWidget->setComponentAdded(false);
m_keyFileEditWidget->setComponentAdded(false);
#ifdef WITH_XC_YUBIKEY
m_yubiKeyEditWidget->setComponentAdded(false);
#endif
blockSignals(blocked);
}
@ -130,9 +120,7 @@ bool DatabaseSettingsWidgetDatabaseKey::saveSettings()
{
m_isDirty |= (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::Edit);
m_isDirty |= (m_keyFileEditWidget->visiblePage() == KeyComponentWidget::Page::Edit);
#ifdef WITH_XC_YUBIKEY
m_isDirty |= (m_yubiKeyEditWidget->visiblePage() == KeyComponentWidget::Page::Edit);
#endif
if (m_db->key() && !m_db->key()->keys().isEmpty() && !m_isDirty) {
// Key unchanged
@ -213,11 +201,9 @@ bool DatabaseSettingsWidgetDatabaseKey::saveSettings()
return false;
}
#ifdef WITH_XC_YUBIKEY
if (!addToCompositeKey(m_yubiKeyEditWidget, newKey, oldChallengeResponse)) {
return false;
}
#endif
if (newKey->keys().isEmpty() && newKey->challengeResponseKeys().isEmpty()) {
MessageBox::critical(this,

View File

@ -19,7 +19,6 @@
#define KEEPASSXC_DATABASESETTINGSWIDGETDATABASEKEY_H
#include "DatabaseSettingsWidget.h"
#include "config-keepassx.h"
#include <QPointer>
@ -72,9 +71,7 @@ private:
const QPointer<QWidget> m_additionalKeyOptions;
const QPointer<PasswordEditWidget> m_passwordEditWidget;
const QPointer<KeyFileEditWidget> m_keyFileEditWidget;
#ifdef WITH_XC_YUBIKEY
const QPointer<YubiKeyEditWidget> m_yubiKeyEditWidget;
#endif
};
#endif // KEEPASSXC_DATABASESETTINGSWIDGETDATABASEKEY_H

View File

@ -39,12 +39,12 @@
#include "core/Group.h"
#include "core/Metadata.h"
#include "core/TimeDelta.h"
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
#include "sshagent/OpenSSHKey.h"
#include "sshagent/OpenSSHKeyGenDialog.h"
#include "sshagent/SSHAgent.h"
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
#include "EntryURLModel.h"
#include "browser/BrowserService.h"
#endif
@ -74,10 +74,10 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
, m_advancedWidget(new QWidget(this))
, m_iconsWidget(new EditWidgetIcons(this))
, m_autoTypeWidget(new QWidget(this))
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
, m_sshAgentWidget(new QWidget(this))
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
, m_browserSettingsChanged(false)
, m_browserWidget(new QWidget(this))
, m_additionalURLsDataModel(new EntryURLModel(this))
@ -100,11 +100,11 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
setupIcon();
setupAutoType();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
setupSSHAgent();
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
setupBrowser();
#endif
@ -150,19 +150,19 @@ void EditEntryWidget::setupMain()
m_usernameCompleter->setModel(m_usernameCompleterModel);
m_mainUi->usernameComboBox->setCompleter(m_usernameCompleter);
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
m_mainUi->fetchFaviconButton->setIcon(icons()->icon("favicon-download"));
m_mainUi->fetchFaviconButton->setDisabled(true);
#else
m_mainUi->fetchFaviconButton->setVisible(false);
#endif
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
connect(m_mainUi->fetchFaviconButton, SIGNAL(clicked()), m_iconsWidget, SLOT(downloadFavicon()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), m_iconsWidget, SLOT(setUrl(QString)));
m_mainUi->urlEdit->enableVerifyMode();
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(entryURLEdited(const QString&)));
#endif
connect(m_mainUi->expireCheck, &QCheckBox::toggled, [&](bool enabled) {
@ -257,7 +257,7 @@ void EditEntryWidget::setupAutoType()
// clang-format on
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void EditEntryWidget::setupBrowser()
{
if (config()->get(Config::Browser_Enabled).toBool()) {
@ -448,7 +448,7 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_mainUi->usernameComboBox->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(setModified()));
connect(m_mainUi->passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(setModified()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(setModified()));
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(updateFaviconButtonEnable(QString)));
#endif
connect(m_mainUi->tagsList, SIGNAL(tagsEdited()), this, SLOT(setModified()));
@ -479,7 +479,7 @@ void EditEntryWidget::setupEntryUpdate()
// Properties and History tabs don't need extra connections
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
// SSH Agent tab
if (sshAgent()->isEnabled()) {
connect(m_sshAgentUi->attachmentRadioButton, SIGNAL(toggled(bool)), this, SLOT(setModified()));
@ -495,7 +495,7 @@ void EditEntryWidget::setupEntryUpdate()
}
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
connect(m_browserUi->skipAutoSubmitCheckbox, SIGNAL(toggled(bool)), SLOT(setModified()));
connect(m_browserUi->hideEntryCheckbox, SIGNAL(toggled(bool)), SLOT(setModified()));
@ -543,7 +543,7 @@ void EditEntryWidget::updateHistoryButtons(const QModelIndex& current, const QMo
}
}
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
void EditEntryWidget::setupSSHAgent()
{
m_pendingPrivateKey = "";
@ -888,7 +888,7 @@ void EditEntryWidget::loadEntry(Entry* entry,
setCurrentPage(0);
setPageHidden(m_historyWidget, m_history || m_entry->historyItems().count() < 1);
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
setPageHidden(m_sshAgentWidget, !sshAgent()->isEnabled());
#endif
@ -1003,13 +1003,13 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
}
updateAutoTypeEnabled();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
if (sshAgent()->isEnabled()) {
updateSSHAgent();
}
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
if (!hasPage(m_browserWidget)) {
setupBrowser();
@ -1165,7 +1165,7 @@ bool EditEntryWidget::commitEntry()
m_autoTypeAssoc->removeEmpty();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
toKeeAgentSettings(m_sshAgentSettings);
#endif
@ -1174,7 +1174,7 @@ bool EditEntryWidget::commitEntry()
m_entry->beginUpdate();
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
updateBrowser();
}
@ -1262,7 +1262,7 @@ void EditEntryWidget::updateEntryData(Entry* entry) const
entry->autoTypeAssociations()->copyDataFrom(m_autoTypeAssoc);
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
if (sshAgent()->isEnabled()) {
m_sshAgentSettings.toEntry(entry);
}
@ -1348,7 +1348,7 @@ void EditEntryWidget::clear()
hideMessage();
}
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
void EditEntryWidget::updateFaviconButtonEnable(const QString& url)
{
m_mainUi->fetchFaviconButton->setDisabled(url.isEmpty());

View File

@ -44,11 +44,11 @@ class QMenu;
class QScrollArea;
class QSortFilterProxyModel;
class QStringListModel;
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
#include "sshagent/KeeAgentSettings.h"
class OpenSSHKey;
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
class EntryURLModel;
#endif
@ -85,7 +85,7 @@ private slots:
void acceptEntry();
bool commitEntry();
void cancel();
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
void updateFaviconButtonEnable(const QString& url);
#endif
void insertAttribute();
@ -111,7 +111,7 @@ private slots:
void useExpiryPreset(QAction* action);
void toggleHideNotes(bool visible);
void pickColor();
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
void toKeeAgentSettings(KeeAgentSettings& settings) const;
void setSSHAgentSettings();
void updateSSHAgent();
@ -126,7 +126,7 @@ private slots:
void copyPublicKey();
void generatePrivateKey();
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void updateBrowserModified();
void updateBrowser();
void insertURL();
@ -141,10 +141,10 @@ private:
void setupAdvanced();
void setupIcon();
void setupAutoType();
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void setupBrowser();
#endif
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
void setupSSHAgent();
#endif
void setupProperties();
@ -156,7 +156,7 @@ private:
QMenu* createPresetsMenu();
void updateEntryData(Entry* entry) const;
void updateBrowserIntegrationCheckbox(QCheckBox* checkBox, bool enabled, bool value, const QString& option);
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
bool getOpenSSHKey(OpenSSHKey& key, bool decrypt = false);
#endif
@ -167,7 +167,7 @@ private:
bool m_create;
bool m_history;
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
KeeAgentSettings m_sshAgentSettings;
QString m_pendingPrivateKey;
#endif
@ -184,10 +184,10 @@ private:
QWidget* const m_advancedWidget;
EditWidgetIcons* const m_iconsWidget;
QWidget* const m_autoTypeWidget;
#ifdef WITH_XC_SSHAGENT
#ifdef KPXC_FEATURE_SSHAGENT
QWidget* const m_sshAgentWidget;
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
bool m_browserSettingsChanged;
QWidget* const m_browserWidget;
EntryURLModel* const m_additionalURLsDataModel;

View File

@ -18,7 +18,7 @@
#include "EditGroupWidget.h"
#include "ui_EditGroupWidgetMain.h"
#if defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_BROWSER)
#include "browser/BrowserService.h"
#include "ui_EditGroupWidgetBrowser.h"
#endif
@ -30,10 +30,7 @@
#include "gui/Font.h"
#include "gui/Icons.h"
#include "gui/MessageBox.h"
#if defined(WITH_XC_KEESHARE)
#include "keeshare/group/EditGroupPageKeeShare.h"
#endif
class EditGroupWidget::ExtraPage
{
@ -70,7 +67,7 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
, m_editGroupWidgetMain(new QScrollArea())
, m_editGroupWidgetIcons(new EditWidgetIcons())
, m_editWidgetProperties(new EditWidgetProperties())
#if defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_BROWSER)
, m_browserSettingsChanged(false)
, m_browserUi(new Ui::EditGroupWidgetBrowser())
, m_browserWidget(new QWidget(this))
@ -81,14 +78,12 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
addPage(tr("Group"), icons()->icon("document-edit"), m_editGroupWidgetMain);
addPage(tr("Icon"), icons()->icon("preferences-desktop-icons"), m_editGroupWidgetIcons);
#if defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_BROWSER)
if (config()->get(Config::Browser_Enabled).toBool()) {
initializeBrowserPage();
}
#endif
#if defined(WITH_XC_KEESHARE)
addEditPage(new EditGroupPageKeeShare(this));
#endif
addPage(tr("Properties"), icons()->icon("document-properties"), m_editWidgetProperties);
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
@ -130,7 +125,7 @@ void EditGroupWidget::setupModifiedTracking()
// Icon tab
connect(m_editGroupWidgetIcons, SIGNAL(widgetUpdated()), SLOT(setModified()));
#if defined(WITH_XC_BROWSER)
#if defined(KPXC_FEATURE_BROWSER)
if (config()->get(Config::Browser_Enabled).toBool()) {
setupBrowserModifiedTracking();
}
@ -189,7 +184,7 @@ void EditGroupWidget::loadGroup(Group* group, bool create, const QSharedPointer<
page.set(m_temporaryGroup.data(), m_db);
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
auto inheritHideEntries = false;
auto inheritSkipSubmit = false;
@ -286,7 +281,7 @@ void EditGroupWidget::apply()
page.assign();
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (config()->get(Config::Browser_Enabled).toBool()) {
if (!m_browserSettingsChanged) {
return;
@ -353,7 +348,7 @@ void EditGroupWidget::cancel()
emit editFinished(false);
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void EditGroupWidget::initializeBrowserPage()
{
addPage(tr("Browser Integration"), icons()->icon("internet-web-browser"), m_browserWidget);
@ -450,7 +445,7 @@ Group::TriState EditGroupWidget::triStateFromIndex(int index)
}
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void EditGroupWidget::addRestrictKeyComboBoxItems(QStringList const& keyList, QString inheritValue)
{
auto comboBox = m_browserUi->browserIntegrationRestrictKeyCombobox;

View File

@ -69,7 +69,7 @@ private slots:
void apply();
void save();
void cancel();
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
void initializeBrowserPage();
void setupBrowserModifiedTracking();
void updateBrowserModified();
@ -90,7 +90,7 @@ private:
QPointer<QScrollArea> m_editGroupWidgetMain;
QPointer<EditWidgetIcons> m_editGroupWidgetIcons;
QPointer<EditWidgetProperties> m_editWidgetProperties;
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
bool m_browserSettingsChanged;
const QScopedPointer<Ui::EditGroupWidgetBrowser> m_browserUi;
QWidget* const m_browserWidget;

View File

@ -125,9 +125,7 @@ QVariant GroupModel::data(const QModelIndex& index, int role) const
if (role == Qt::DisplayRole) {
QString nameTemplate = "%1";
#if defined(WITH_XC_KEESHARE)
nameTemplate = KeeShare::indicatorSuffix(group, nameTemplate);
#endif
return nameTemplate.arg(group->name());
} else if (role == Qt::DecorationRole) {
return Icons::groupIconPixmap(group);

View File

@ -30,7 +30,7 @@
#include <QStandardPaths>
#include <QStyle>
#include <QTextStream>
#ifdef WITH_XC_X11
#ifdef WITH_X11
#include <QX11Info>
#include <qpa/qplatformnativeinterface.h>
@ -67,7 +67,7 @@ NixUtils* NixUtils::instance()
NixUtils::NixUtils(QObject* parent)
: OSUtilsBase(parent)
{
#ifdef WITH_XC_X11
#ifdef WITH_X11
dpy = QX11Info::display();
rootWindow = QX11Info::appRootWindow();
#endif
@ -214,7 +214,7 @@ void NixUtils::launchAtStartupRequested(uint response, const QVariantMap& result
bool NixUtils::isCapslockEnabled()
{
#ifdef WITH_XC_X11
#ifdef WITH_X11
QPlatformNativeInterface* native = QGuiApplication::platformNativeInterface();
auto* display = native->nativeResourceForWindow("display", nullptr);
if (!display) {
@ -242,7 +242,7 @@ void NixUtils::registerNativeEventFilter()
bool NixUtils::nativeEventFilter(const QByteArray& eventType, void* message, long*)
{
#ifdef WITH_XC_X11
#ifdef WITH_X11
if (eventType != QByteArrayLiteral("xcb_generic_event_t")) {
return false;
}
@ -264,7 +264,7 @@ bool NixUtils::nativeEventFilter(const QByteArray& eventType, void* message, lon
bool NixUtils::triggerGlobalShortcut(uint keycode, uint modifiers)
{
#ifdef WITH_XC_X11
#ifdef WITH_X11
QHashIterator<QString, QSharedPointer<globalShortcut>> i(m_globalShortcuts);
while (i.hasNext()) {
i.next();
@ -282,7 +282,7 @@ bool NixUtils::triggerGlobalShortcut(uint keycode, uint modifiers)
bool NixUtils::registerGlobalShortcut(const QString& name, Qt::Key key, Qt::KeyboardModifiers modifiers, QString* error)
{
#ifdef WITH_XC_X11
#ifdef WITH_X11
auto keycode = XKeysymToKeycode(dpy, qcharToNativeKeyCode(key));
auto modifierscode = qtToNativeModifiers(modifiers);
@ -334,7 +334,7 @@ bool NixUtils::registerGlobalShortcut(const QString& name, Qt::Key key, Qt::Keyb
bool NixUtils::unregisterGlobalShortcut(const QString& name)
{
#ifdef WITH_XC_X11
#ifdef WITH_X11
if (!m_globalShortcuts.contains(name)) {
return false;
}

View File

@ -21,11 +21,11 @@
#include "ReportsPageHealthcheck.h"
#include "ReportsPageHibp.h"
#include "ReportsPageStatistics.h"
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
#include "ReportsPageBrowserStatistics.h"
#include "ReportsWidgetBrowserStatistics.h"
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
#include "ReportsPagePasskeys.h"
#include "ReportsWidgetPasskeys.h"
#endif
@ -63,10 +63,10 @@ ReportsDialog::ReportsDialog(QWidget* parent)
, m_healthPage(new ReportsPageHealthcheck())
, m_hibpPage(new ReportsPageHibp())
, m_statPage(new ReportsPageStatistics())
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
, m_browserStatPage(new ReportsPageBrowserStatistics())
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
, m_passkeysPage(new ReportsPagePasskeys())
#endif
, m_editEntryWidget(new EditEntryWidget(this))
@ -76,10 +76,10 @@ ReportsDialog::ReportsDialog(QWidget* parent)
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
addPage(m_statPage);
addPage(m_healthPage);
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
addPage(m_passkeysPage);
#endif
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
addPage(m_browserStatPage);
#endif
addPage(m_hibpPage);
@ -94,12 +94,12 @@ ReportsDialog::ReportsDialog(QWidget* parent)
connect(m_ui->categoryList, SIGNAL(categoryChanged(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
connect(m_healthPage->m_healthWidget, SIGNAL(entryActivated(Entry*)), SLOT(entryActivationSignalReceived(Entry*)));
connect(m_hibpPage->m_hibpWidget, SIGNAL(entryActivated(Entry*)), SLOT(entryActivationSignalReceived(Entry*)));
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
connect(m_browserStatPage->m_browserWidget,
SIGNAL(entryActivated(Entry*)),
SLOT(entryActivationSignalReceived(Entry*)));
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
connect(
m_passkeysPage->m_passkeysWidget, SIGNAL(entryActivated(Entry*)), SLOT(entryActivationSignalReceived(Entry*)));
#endif
@ -128,7 +128,7 @@ void ReportsDialog::addPage(QSharedPointer<IReportsPage> page)
m_ui->categoryList->setCurrentCategory(category);
}
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
void ReportsDialog::activatePasskeysPage()
{
m_ui->stackedWidget->setCurrentWidget(m_passkeysPage->m_passkeysWidget);
@ -167,12 +167,12 @@ void ReportsDialog::switchToMainView(bool previousDialogAccepted)
} else if (m_sender == m_hibpPage->m_hibpWidget) {
m_hibpPage->m_hibpWidget->refreshAfterEdit();
}
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
if (m_sender == m_browserStatPage->m_browserWidget) {
m_browserStatPage->m_browserWidget->calculateBrowserStatistics();
}
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
if (m_sender == m_passkeysPage->m_passkeysWidget) {
m_passkeysPage->m_passkeysWidget->updateEntries();
}

View File

@ -29,10 +29,10 @@ class QTabWidget;
class ReportsPageHealthcheck;
class ReportsPageHibp;
class ReportsPageStatistics;
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
class ReportsPageBrowserStatistics;
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
class ReportsPagePasskeys;
#endif
@ -63,7 +63,7 @@ public:
void load(const QSharedPointer<Database>& db);
void addPage(QSharedPointer<IReportsPage> page);
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
void activatePasskeysPage();
#endif
@ -81,10 +81,10 @@ private:
const QSharedPointer<ReportsPageHealthcheck> m_healthPage;
const QSharedPointer<ReportsPageHibp> m_hibpPage;
const QSharedPointer<ReportsPageStatistics> m_statPage;
#ifdef WITH_XC_BROWSER
#ifdef KPXC_FEATURE_BROWSER
const QSharedPointer<ReportsPageBrowserStatistics> m_browserStatPage;
#endif
#ifdef WITH_XC_BROWSER_PASSKEYS
#ifdef KPXC_FEATURE_BROWSER_PASSKEYS
const QSharedPointer<ReportsPagePasskeys> m_passkeysPage;
#endif
QPointer<EditEntryWidget> m_editEntryWidget;

View File

@ -71,7 +71,7 @@ ReportsWidgetHibp::ReportsWidgetHibp(QWidget* parent)
connect(m_ui->hibpTableView, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
connect(m_ui->hibpTableView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint)));
connect(m_ui->showKnownBadCheckBox, SIGNAL(stateChanged(int)), this, SLOT(makeHibpTable()));
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
connect(&m_downloader, SIGNAL(hibpResult(QString, int)), SLOT(addHibpResult(QString, int)));
connect(&m_downloader, SIGNAL(fetchFailed(QString)), SLOT(fetchFailed(QString)));
@ -92,7 +92,7 @@ void ReportsWidgetHibp::loadSettings(QSharedPointer<Database> db)
m_error.clear();
m_rowToEntry.clear();
m_editedEntry = nullptr;
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
m_ui->stackedWidget->setCurrentIndex(0);
m_ui->validationButton->setEnabled(true);
m_ui->progressBar->hide();
@ -188,7 +188,7 @@ void ReportsWidgetHibp::makeHibpTable()
}
// If we're done and everything is good, display a motivational message
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
if (m_downloader.passwordsRemaining() == 0 && m_pwndPasswords.isEmpty() && m_error.isEmpty()) {
m_referencesModel->clear();
m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Congratulations, no exposed passwords!"));
@ -219,7 +219,7 @@ void ReportsWidgetHibp::addHibpResult(const QString& password, int count)
m_pwndPasswords[password] = count;
}
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
// Update the progress bar
int remaining = m_downloader.passwordsRemaining();
if (remaining > 0) {
@ -249,7 +249,7 @@ void ReportsWidgetHibp::fetchFailed(const QString& error)
*/
void ReportsWidgetHibp::startValidation()
{
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
// Collect all passwords in the database (unless recycled, and
// unless empty, and unless marked as "known bad") and submit them
// to the downloader.
@ -345,7 +345,7 @@ void ReportsWidgetHibp::refreshAfterEdit()
m_pwndPasswords.remove(m_editedPassword);
// Validate the new password against HIBP
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
m_downloader.add(m_editedEntry->password());
m_downloader.validate();
#endif

View File

@ -23,7 +23,7 @@
#include <QWidget>
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
#include "networking/HibpDownloader.h"
#endif
@ -76,7 +76,7 @@ private:
QString m_editedPassword; // The old password of the entry we're editing
bool m_editedExcluded; // The old "known bad" flag of the entry we're editing
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
HibpDownloader m_downloader; // This performs the actual HIBP online query
#endif
};

View File

@ -1,18 +1,16 @@
if(WITH_XC_KEESHARE)
set(keeshare_SOURCES
SettingsPageKeeShare.cpp
SettingsWidgetKeeShare.cpp
DatabaseSettingsWidgetKeeShare.cpp
group/EditGroupWidgetKeeShare.cpp
group/EditGroupPageKeeShare.cpp
KeeShare.cpp
KeeShareSettings.cpp
ShareImport.cpp
ShareExport.cpp
ShareObserver.cpp
)
set(keeshare_SOURCES
SettingsPageKeeShare.cpp
SettingsWidgetKeeShare.cpp
DatabaseSettingsWidgetKeeShare.cpp
group/EditGroupWidgetKeeShare.cpp
group/EditGroupPageKeeShare.cpp
KeeShare.cpp
KeeShareSettings.cpp
ShareImport.cpp
ShareExport.cpp
ShareObserver.cpp
)
add_library(keeshare STATIC ${keeshare_SOURCES})
target_link_libraries(keeshare PUBLIC Qt5::Core Qt5::Widgets ${BOTAN_LIBRARIES} ${ZLIB_LIBRARIES} PRIVATE ${MINIZIP_LIBRARIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
endif(WITH_XC_KEESHARE)
add_library(keeshare STATIC ${keeshare_SOURCES})
target_link_libraries(keeshare PUBLIC Qt5::Core Qt5::Widgets ${BOTAN_LIBRARIES} ${ZLIB_LIBRARIES} PRIVATE ${MINIZIP_LIBRARIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})

View File

@ -1,72 +0,0 @@
/*
* Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
* Copyright (C) 2017-2021 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "YubiKey.h"
YubiKey::YubiKey() = default;
YubiKey* YubiKey::m_instance(Q_NULLPTR);
YubiKey* YubiKey::instance()
{
if (!m_instance) {
m_instance = new YubiKey();
}
return m_instance;
}
bool YubiKey::isInitialized()
{
return false;
}
bool YubiKey::findValidKeys()
{
return false;
}
void YubiKey::findValidKeysAsync()
{
}
YubiKey::KeyMap YubiKey::foundKeys()
{
return {};
}
QString YubiKey::errorMessage()
{
return {};
}
bool YubiKey::testChallenge(YubiKeySlot slot, bool* wouldBlock)
{
Q_UNUSED(slot);
Q_UNUSED(wouldBlock);
return false;
}
YubiKey::ChallengeResult YubiKey::challenge(YubiKeySlot slot, const QByteArray& chal, Botan::secure_vector<char>& resp)
{
Q_UNUSED(slot);
Q_UNUSED(chal);
Q_UNUSED(resp);
return YubiKey::ChallengeResult::YCR_ERROR;
}

View File

@ -22,7 +22,7 @@
#include <QHash>
#include <QObject>
#ifndef WITH_XC_NETWORKING
#ifndef KPXC_FEATURE_NETWORK
#error This file requires KeePassXC to be built with network support.
#endif

View File

@ -17,7 +17,7 @@
#include "config-keepassx.h"
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
#include "NetworkManager.h"

View File

@ -20,13 +20,13 @@
#include "config-keepassx.h"
#ifdef WITH_XC_NETWORKING
#ifdef KPXC_FEATURE_NETWORK
class QNetworkAccessManager;
QNetworkAccessManager* getNetMgr();
#else
Q_STATIC_ASSERT_X(false, "Qt Networking used when WITH_XC_NETWORKING is disabled!");
Q_STATIC_ASSERT_X(false, "Qt Networking used when KPXC_FEATURE_NETWORK is disabled!");
#endif
#endif // KEEPASSXC_NETWORKMANAGER_H

View File

@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if(WITH_XC_BROWSER)
if(KPXC_FEATURE_BROWSER)
set(proxy_SOURCES
../browser/BrowserShared.cpp
keepassxc-proxy.cpp

View File

@ -1,4 +1,4 @@
if(WITH_XC_SSHAGENT)
if(KPXC_FEATURE_SSHAGENT)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(sshagent_SOURCES

View File

@ -127,7 +127,7 @@ namespace OpenSSHKeyGen
QByteArray privateData;
BinaryStream privateStream(&privateData);
vectorToStream(ed25519Key.get_public_key(), privateStream);
#ifdef WITH_XC_BOTAN3
#ifdef WITH_BOTAN3
vectorToStream(ed25519Key.raw_private_key_bits(), privateStream);
#else
vectorToStream(ed25519Key.get_private_key(), privateStream);

View File

@ -13,7 +13,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if(WITH_XC_YUBIKEY)
add_subdirectory(ykcore)
set(thirdparty_LIBRARIES ${thirdparty_LIBRARIES} ykcore PARENT_SCOPE)
endif()
add_subdirectory(ykcore)
set(thirdparty_LIBRARIES ${thirdparty_LIBRARIES} ykcore PARENT_SCOPE)

View File

@ -76,18 +76,6 @@ macro(add_unit_test)
endif(KDE4_TEST_OUTPUT STREQUAL "xml")
set_tests_properties(${_test_NAME} PROPERTIES ENVIRONMENT "LANG=en_US.UTF-8")
if(NOT MSVC_IDE) #not needed for the ide
# if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
if(NOT WITH_TESTS)
get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
if(NOT _buildtestsAdded)
add_custom_target(buildtests)
set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
endif()
add_dependencies(buildtests ${_test_NAME})
endif()
endif()
endmacro(add_unit_test)
set(TEST_LIBRARIES keepassxc_gui Qt5::Test)
@ -145,27 +133,9 @@ add_unit_test(NAME testkeepass1reader SOURCES TestKeePass1Reader.cpp
add_unit_test(NAME testimports SOURCES TestImports.cpp
LIBS ${TEST_LIBRARIES})
if(WITH_XC_NETWORKING)
add_unit_test(NAME testupdatecheck SOURCES TestUpdateCheck.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testicondownloader SOURCES TestIconDownloader.cpp LIBS ${TEST_LIBRARIES})
endif()
if(WITH_XC_AUTOTYPE)
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp
LIBS ${TEST_LIBRARIES})
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
endif()
if(WITH_XC_SSHAGENT)
add_unit_test(NAME testopensshkey SOURCES TestOpenSSHKey.cpp
LIBS sshagent ${TEST_LIBRARIES})
if(NOT WIN32)
add_unit_test(NAME testsshagent SOURCES TestSSHAgent.cpp
LIBS sshagent ${TEST_LIBRARIES})
endif()
endif()
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp
LIBS ${TEST_LIBRARIES})
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
add_unit_test(NAME testentry SOURCES TestEntry.cpp
LIBS ${TEST_LIBRARIES})
@ -203,16 +173,11 @@ add_unit_test(NAME testentrysearcher SOURCES TestEntrySearcher.cpp
add_unit_test(NAME testcsvexporter SOURCES TestCsvExporter.cpp
LIBS ${TEST_LIBRARIES})
if(WITH_XC_YUBIKEY)
add_unit_test(NAME testykchallengeresponsekey
SOURCES TestYkChallengeResponseKey.cpp
add_unit_test(NAME testykchallengeresponsekey SOURCES TestYkChallengeResponseKey.cpp
LIBS ${TEST_LIBRARIES})
endif()
if(WITH_XC_KEESHARE)
add_unit_test(NAME testsharing SOURCES TestSharing.cpp
add_unit_test(NAME testsharing SOURCES TestSharing.cpp
LIBS testsupport ${TEST_LIBRARIES})
endif()
add_unit_test(NAME testdatabase SOURCES TestDatabase.cpp
LIBS testsupport ${TEST_LIBRARIES})
@ -223,29 +188,44 @@ add_unit_test(NAME testtools SOURCES TestTools.cpp
add_unit_test(NAME testconfig SOURCES TestConfig.cpp
LIBS testsupport ${TEST_LIBRARIES})
if(WITH_XC_FDOSECRETS)
add_unit_test(NAME testfdosecrets SOURCES TestFdoSecrets.cpp
LIBS testsupport fdosecrets ${TEST_LIBRARIES})
endif()
if(WITH_XC_BROWSER)
add_unit_test(NAME testbrowser SOURCES TestBrowser.cpp
LIBS browser ${TEST_LIBRARIES})
if(WITH_XC_BROWSER_PASSKEYS)
add_unit_test(NAME testpasskeys SOURCES TestPasskeys.cpp
LIBS browser ${TEST_LIBRARIES})
endif()
endif()
if(WITH_XC_NETWORKING OR WITH_XC_BROWSER)
add_unit_test(NAME testurltools SOURCES TestUrlTools.cpp LIBS ${TEST_LIBRARIES})
endif()
add_unit_test(NAME testcli SOURCES TestCli.cpp
LIBS testsupport cli ${ZXCVBN_LIBRARIES} ${TEST_LIBRARIES})
target_compile_definitions(testcli PRIVATE KEEPASSX_CLI_PATH="$<TARGET_FILE:keepassxc-cli>")
if(KPXC_FEATURE_SSHAGENT)
add_unit_test(NAME testopensshkey SOURCES TestOpenSSHKey.cpp
LIBS sshagent ${TEST_LIBRARIES})
if(NOT WIN32)
add_unit_test(NAME testsshagent SOURCES TestSSHAgent.cpp
LIBS sshagent ${TEST_LIBRARIES})
endif()
endif()
if(KPXC_FEATURE_FDOSECRETS)
add_unit_test(NAME testfdosecrets SOURCES TestFdoSecrets.cpp
LIBS testsupport fdosecrets ${TEST_LIBRARIES})
endif()
if(KPXC_FEATURE_BROWSER)
add_unit_test(NAME testbrowser SOURCES TestBrowser.cpp
LIBS browser ${TEST_LIBRARIES})
add_unit_test(NAME testpasskeys SOURCES TestPasskeys.cpp
LIBS browser ${TEST_LIBRARIES})
endif()
if(KPXC_FEATURE_NETWORK OR KPXC_FEATURE_BROWSER)
add_unit_test(NAME testurltools SOURCES TestUrlTools.cpp LIBS ${TEST_LIBRARIES})
endif()
if(KPXC_FEATURE_NETWORK)
add_unit_test(NAME testupdatecheck SOURCES TestUpdateCheck.cpp
LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testicondownloader SOURCES TestIconDownloader.cpp
LIBS ${TEST_LIBRARIES})
endif()
if(WITH_GUI_TESTS)
add_subdirectory(gui)
endif(WITH_GUI_TESTS)
endif()

View File

@ -5,7 +5,4 @@
#define KEEPASSX_TEST_DATA_DIR "${KEEPASSX_TEST_DATA_DIR}"
#cmakedefine WITH_XC_AUTOTYPE
#cmakedefine WITH_XC_YUBIKEY
#endif // KEEPASSX_CONFIG_TESTS_H

View File

@ -18,11 +18,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
add_unit_test(NAME testgui SOURCES TestGui.cpp ../util/TemporaryFile.cpp ../mock/MockRemoteProcess.cpp LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testguipixmaps SOURCES TestGuiPixmaps.cpp LIBS ${TEST_LIBRARIES})
if(WITH_XC_BROWSER)
if(KPXC_FEATURE_BROWSER)
add_unit_test(NAME testguibrowser SOURCES TestGuiBrowser.cpp ../util/TemporaryFile.cpp LIBS ${TEST_LIBRARIES})
endif()
if(WITH_XC_FDOSECRETS)
if(KPXC_FEATURE_FDOSECRETS)
add_unit_test(NAME testguifdosecrets
SOURCES TestGuiFdoSecrets.cpp ../util/TemporaryFile.cpp ../util/FdoSecretsProxy.cpp
LIBS ${TEST_LIBRARIES}