aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2017-11-23 12:52:08 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-12-15 12:00:49 +0100
commit094aa5eb024582d23b8e0cd5ebfea3cb29ed188d (patch)
tree2ade576ed68a90735e33637f26c163f65e26b19e
parent5d3ab421e1db18d20d5aaa702fbd089552447628 (diff)
downloadlibssh-094aa5eb024582d23b8e0cd5ebfea3cb29ed188d.tar.gz
libssh-094aa5eb024582d23b8e0cd5ebfea3cb29ed188d.tar.xz
libssh-094aa5eb024582d23b8e0cd5ebfea3cb29ed188d.zip
tests: Temporarily build chroot_wrapper
-rw-r--r--tests/CMakeLists.txt11
-rw-r--r--tests/chroot_wrapper.c8
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f538a045..1d5c5ca5 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -81,6 +81,14 @@ if (WITH_CLIENT_TESTING)
execute_process(COMMAND ${ID_EXECUTABLE} -u OUTPUT_VARIABLE LOCAL_UID OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
+ # chroot_wrapper
+ add_library(chroot_wrapper SHARED chroot_wrapper.c)
+ set(CHROOT_WRAPPER_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}chroot_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX})
+ set(TEST_TARGET_LIBRARIES
+ ${TEST_TARGET_LIBRARIES}
+ chroot_wrapper
+ )
+
# homedir will be used in passwd
set(HOMEDIR ${CMAKE_CURRENT_BINARY_DIR}/home)
@@ -94,7 +102,8 @@ if (WITH_CLIENT_TESTING)
configure_file(etc/pam_matrix_passdb.in ${CMAKE_CURRENT_BINARY_DIR}/etc/pam_matrix_passdb @ONLY)
configure_file(etc/pam.d/sshd.in ${CMAKE_CURRENT_BINARY_DIR}/etc/pam.d/sshd @ONLY)
- set(TORTURE_ENVIRONMENT "LD_PRELOAD=${SOCKET_WRAPPER_LIBRARY}:${NSS_WRAPPER_LIBRARY}:${UID_WRAPPER_LIBRARY}:${PAM_WRAPPER_LIBRARY}")
+
+ set(TORTURE_ENVIRONMENT "LD_PRELOAD=${SOCKET_WRAPPER_LIBRARY}:${NSS_WRAPPER_LIBRARY}:${UID_WRAPPER_LIBRARY}:${PAM_WRAPPER_LIBRARY}:${CHROOT_WRAPPER_LIBRARY}")
list(APPEND TORTURE_ENVIRONMENT UID_WRAPPER=1 UID_WRAPPER_ROOT=1)
list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_PASSWD=${CMAKE_CURRENT_BINARY_DIR}/etc/passwd)
list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_SHADOW=${CMAKE_CURRENT_BINARY_DIR}/etc/shadow)
diff --git a/tests/chroot_wrapper.c b/tests/chroot_wrapper.c
new file mode 100644
index 00000000..3545f397
--- /dev/null
+++ b/tests/chroot_wrapper.c
@@ -0,0 +1,8 @@
+/* silent gcc */
+int chroot(const char *);
+
+int chroot(const char *path)
+{
+ (void)path;
+ return 0;
+}