aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-04-15 21:13:42 +0200
committerJakub Jelen <jjelen@redhat.com>2018-10-02 16:35:28 +0200
commit1eeeace9750581d9d0fef39c21f7c6e00dcb4fbd (patch)
tree32b58f8c05c892cb525b57159fbb64aa871913a5
parent73ebcb3ab88575bcc207851a8fe5d87a7d27154e (diff)
downloadlibssh-1eeeace9750581d9d0fef39c21f7c6e00dcb4fbd.tar.gz
libssh-1eeeace9750581d9d0fef39c21f7c6e00dcb4fbd.tar.xz
libssh-1eeeace9750581d9d0fef39c21f7c6e00dcb4fbd.zip
cmake: Configure nss_wrapper and uid_wrapper
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> (cherry-picked from commit 21b0d29e)
-rw-r--r--tests/CMakeLists.txt20
-rw-r--r--tests/etc/group.in5
-rw-r--r--tests/etc/hosts.in2
-rw-r--r--tests/etc/passwd.in5
-rw-r--r--tests/etc/shadow.in2
5 files changed, 34 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 94939560..04838f03 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -46,6 +46,8 @@ add_subdirectory(unittests)
if (WITH_CLIENT_TESTING)
find_package(socket_wrapper 1.1.5 REQUIRED)
find_package(nss_wrapper 1.1.2 REQUIRED)
+ find_package(uid_wrapper 1.2.0 REQUIRED)
+
find_program(SSHD_EXECUTABLE
NAME
sshd
@@ -56,6 +58,24 @@ if (WITH_CLIENT_TESTING)
if (NOT SSHD_EXECUTABLE)
message(SEND_ERROR "Could not find sshd which is required for client testing")
endif()
+
+ # homedir will be used in passwd
+ set(HOMEDIR ${CMAKE_CURRENT_BINARY_DIR}/home)
+
+ ### Setup nss_wrapper
+ configure_file(etc/passwd.in ${CMAKE_CURRENT_BINARY_DIR}/etc/passwd @ONLY)
+ configure_file(etc/shadow.in ${CMAKE_CURRENT_BINARY_DIR}/etc/shadow @ONLY)
+ configure_file(etc/group.in ${CMAKE_CURRENT_BINARY_DIR}/etc/group @ONLY)
+ configure_file(etc/hosts.in ${CMAKE_CURRENT_BINARY_DIR}/etc/hosts @ONLY)
+
+ set(TORTURE_ENVIRONMENT "LD_PRELOAD=${SOCKET_WRAPPER_LIBRARY}:${NSS_WRAPPER_LIBRARY}:${UID_WRAPPER_LIBRARY}")
+ list(APPEND TORTURE_ENVIRONMENT UID_WRAPPER=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)
+ list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_GROUP=${CMAKE_CURRENT_BINARY_DIR}/etc/group)
+
+ message(STATUS "TORTURE_ENVIRONMENT=${TORTURE_ENVIRONMENT}")
+
add_subdirectory(client)
endif (WITH_CLIENT_TESTING)
diff --git a/tests/etc/group.in b/tests/etc/group.in
new file mode 100644
index 00000000..b6e85eff
--- /dev/null
+++ b/tests/etc/group.in
@@ -0,0 +1,5 @@
+users:x:1000:
+sshd:x:65531:
+nobody:x:65533:
+nogroup:x:65534:nobody
+root:x:65532:
diff --git a/tests/etc/hosts.in b/tests/etc/hosts.in
new file mode 100644
index 00000000..2ab69799
--- /dev/null
+++ b/tests/etc/hosts.in
@@ -0,0 +1,2 @@
+127.0.0.10 server.libssh.site
+127.0.0.21 client.libssh.site
diff --git a/tests/etc/passwd.in b/tests/etc/passwd.in
new file mode 100644
index 00000000..5844c1d1
--- /dev/null
+++ b/tests/etc/passwd.in
@@ -0,0 +1,5 @@
+bob:x:1000:1000:bob gecos:@HOMEDIR@/bob:/bin/false
+alice:x:1001:1000:alice gecos:@HOMEDIR@/alice:/bin/bash
+sshd:x:65530:65531:sshd:@HOMEDIR@:/sbin/nologin
+nobody:x:65533:65534:nobody gecos:@HOMEDIR@:/bin/false
+root:x:65534:65532:root gecos:@HOMEDIR@:/bin/false
diff --git a/tests/etc/shadow.in b/tests/etc/shadow.in
new file mode 100644
index 00000000..5c0e3d86
--- /dev/null
+++ b/tests/etc/shadow.in
@@ -0,0 +1,2 @@
+alice:$6$0jWkA8VP$MvBUvtGy38jWCZ5KtqnZEKQWXvvImDkDhDQII1kTqtAp3/xH31b71c.AjGkBFle.2QwCJQH7OzB/NXiMprusr/::0:::::
+bob:$6$0jWkA8VP$MvBUvtGy38jWCZ5KtqnZEKQWXvvImDkDhDQII1kTqtAp3/xH31b71c.AjGkBFle.2QwCJQH7OzB/NXiMprusr/::0:::::