aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2017-11-23 12:52:08 +0100
committerAndreas Schneider <asn@cryptomilk.org>2018-10-05 12:09:45 +0200
commitb393f7e5e982abd82dd42054654b4f0a914b776f (patch)
tree5e6542909193588164f0de432b7fd8a58ed0809d
parent2004617fd0ade3da77741ab24a77326b0fb12ea0 (diff)
downloadlibssh-b393f7e5e982abd82dd42054654b4f0a914b776f.tar.gz
libssh-b393f7e5e982abd82dd42054654b4f0a914b776f.tar.xz
libssh-b393f7e5e982abd82dd42054654b4f0a914b776f.zip
tests: Temporarily build chroot_wrapper
(cherry-picked from commit 094aa5eb)
-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 116a0bce..34dbf095 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -68,6 +68,14 @@ if (WITH_CLIENT_TESTING)
add_definitions(-DOPENSSH_VERSION_MAJOR=${OPENSSH_VERSION_MAJOR} -DOPENSSH_VERSION_MINOR=${OPENSSH_VERSION_MINOR})
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)
@@ -81,7 +89,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;
+}