From 2793e014d442f4eba93c5c1db3967345d3a63588 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Fri, 10 Jul 2020 17:47:23 -0700 Subject: [PATCH 1/2] Fixed determining the user's homedir: If $HOME and the /etc/passwd entry for the current user contradict each other, now $HOME takes preference over /etc/passwd. --- ChangeLog.txt | 1 + src/cpp-utils/system/homedir.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index f0b72c49..6c5fdf50 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,7 @@ Version 0.10.3 (unreleased) --------------- Fixed bugs: * A comma in the base directory name would make the file system fail to mount, https://github.com/cryfs/cryfs/issues/326 +* Fixed determining the user's homedir: If $HOME and the /etc/passwd entry for the current user contradict each other, now $HOME takes preference over /etc/passwd. Version 0.10.2 --------------- diff --git a/src/cpp-utils/system/homedir.cpp b/src/cpp-utils/system/homedir.cpp index 9b7d6691..4b64090d 100644 --- a/src/cpp-utils/system/homedir.cpp +++ b/src/cpp-utils/system/homedir.cpp @@ -9,13 +9,13 @@ using std::string; #include namespace { bf::path _get_home_directory() { - struct passwd* pwd = getpwuid(getuid()); - string homedir; - if (pwd) { - homedir = pwd->pw_dir; - } else { - // try the $HOME environment variable - homedir = getenv("HOME"); + string homedir = getenv("HOME"); + if (homedir == "") { + // try the /etc/passwd entry + struct passwd* pwd = getpwuid(getuid()); + if (pwd) { + homedir = pwd->pw_dir; + } } if (homedir == "") { throw std::runtime_error("Couldn't determine home directory for user"); From d32a98602bd2db565f5c8c3e60a91c67fd2dd5ce Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 11 Jul 2020 02:17:48 -0700 Subject: [PATCH 2/2] Fix Android compilation using patch file https://github.com/termux/termux-root-packages/files/4664745/config.h.patch.txt from https://github.com/cryfs/cryfs/issues/345 --- ChangeLog.txt | 2 ++ vendor/README | 1 + vendor/cryptopp/vendor_cryptopp/config.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6c5fdf50..7d46e29d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,8 @@ Version 0.10.3 (unreleased) Fixed bugs: * A comma in the base directory name would make the file system fail to mount, https://github.com/cryfs/cryfs/issues/326 * Fixed determining the user's homedir: If $HOME and the /etc/passwd entry for the current user contradict each other, now $HOME takes preference over /etc/passwd. +* Fix Android compilation, https://github.com/cryfs/cryfs/issues/345 + Version 0.10.2 --------------- diff --git a/vendor/README b/vendor/README index 05989f34..a253a61c 100644 --- a/vendor/README +++ b/vendor/README @@ -6,3 +6,4 @@ cryptopp: https://github.com/weidai11/cryptopp/tree/CRYPTOPP_8_2_0 - changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/CRYPTOPP_8_2_0 - changed: commented out line including winapifamily.h in CMakeLists.txt - changed: In CMakeLists.txt, rename BUILD_TESTING to CRYPTOPP_BUILD_TESTING so it doesn't clash with our BUILD_TESTING + - changed: Fix Android compilation using patch file https://github.com/termux/termux-root-packages/files/4664745/config.h.patch.txt from https://github.com/cryfs/cryfs/issues/345 diff --git a/vendor/cryptopp/vendor_cryptopp/config.h b/vendor/cryptopp/vendor_cryptopp/config.h index 283c4090..54ee6c2c 100644 --- a/vendor/cryptopp/vendor_cryptopp/config.h +++ b/vendor/cryptopp/vendor_cryptopp/config.h @@ -733,7 +733,7 @@ NAMESPACE_END // Limit the include. #if !defined(CRYPTOPP_ARM_ACLE_AVAILABLE) # if defined(__aarch32__) || defined(__aarch64__) || (__ARM_ARCH >= 8) || defined(__ARM_ACLE) -# if !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__) +# if !defined(__APPLE__) # define CRYPTOPP_ARM_ACLE_AVAILABLE 1 # endif # endif