diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2014-04-15 21:13:42 +0200 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2015-10-12 13:47:09 +0200 |
commit | 5ec3859892bf9b61a9c32e6f7d54bed64adaf791 (patch) | |
tree | 6658636b0e31b3a8491d1b04968804fa36a0c578 | |
parent | cdbd2bdd3c6b191546059ab71e888d61faacca18 (diff) | |
download | libssh-5ec3859892bf9b61a9c32e6f7d54bed64adaf791.tar.gz libssh-5ec3859892bf9b61a9c32e6f7d54bed64adaf791.tar.xz libssh-5ec3859892bf9b61a9c32e6f7d54bed64adaf791.zip |
cmake: Configure nss_wrapper.
-rw-r--r-- | tests/CMakeLists.txt | 30 | ||||
-rw-r--r-- | tests/etc/group.in | 5 | ||||
-rw-r--r-- | tests/etc/hosts.in | 2 | ||||
-rw-r--r-- | tests/etc/passwd.in | 5 |
4 files changed, 42 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3578f6cf..893c54ed 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -41,6 +41,20 @@ set(TEST_TARGET_LIBRARIES ${TORTURE_LINK_LIBRARIES} ) +### Setup nss_wrapper + +# homedir will be used in passwd +set(HOMEDIR ${CMAKE_CURRENT_BINARY_DIR}/home) + +configure_file(etc/passwd.in ${CMAKE_CURRENT_BINARY_DIR}/etc/passwd @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}") +list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_PASSWD=${CMAKE_CURRENT_BINARY_DIR}/etc/passwd) +list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_GROUP=${CMAKE_CURRENT_BINARY_DIR}/etc/group) +list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_HOSTS=${CMAKE_CURRENT_BINARY_DIR}/etc/hosts) + add_subdirectory(unittests) if (WITH_CLIENT_TESTING) @@ -56,6 +70,22 @@ 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/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}") + list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_PASSWD=${CMAKE_CURRENT_BINARY_DIR}/etc/passwd) + list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_GROUP=${CMAKE_CURRENT_BINARY_DIR}/etc/group) + list(APPEND TORTURE_ENVIRONMENT NSS_WRAPPER_HOSTS=${CMAKE_CURRENT_BINARY_DIR}/etc/hosts) + + 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..62dc24d0 --- /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/false +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 |