From 0f137d7ab221a552e2fa51524364fd73199e5a4b Mon Sep 17 00:00:00 2001 From: roman Date: Thu, 2 Nov 2023 15:27:04 +0100 Subject: [PATCH] compat UPDATE move crypt to compat also delete obsolete shadow dependency --- CMakeLists.txt | 4 ---- CMakeModules/UseCompat.cmake | 2 ++ compat/compat.h.in | 8 +++++++- src/session_server_ssh.c | 10 ++-------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79fde55f..59181655 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,10 +286,6 @@ find_package(LibYANG ${LIBYANG_DEP_SOVERSION} REQUIRED) target_link_libraries(netconf2 ${LIBYANG_LIBRARIES}) include_directories(${LIBYANG_INCLUDE_DIRS}) -# header file compatibility - shadow.h and crypt.h -check_include_file("shadow.h" HAVE_SHADOW) -check_include_file("crypt.h" HAVE_CRYPT) - # function compatibility - getpeereid on QNX if(${CMAKE_SYSTEM_NAME} MATCHES "QNX") target_link_libraries(netconf2 -lsocket) diff --git a/CMakeModules/UseCompat.cmake b/CMakeModules/UseCompat.cmake index f9dc007b..bc132b4b 100644 --- a/CMakeModules/UseCompat.cmake +++ b/CMakeModules/UseCompat.cmake @@ -63,6 +63,8 @@ macro(USE_COMPAT) check_symbol_exists(get_current_dir_name "unistd.h" HAVE_GET_CURRENT_DIR_NAME) # crypt + check_include_file("crypt.h" HAVE_CRYPT_H) + if(${CMAKE_SYSTEM_NAME} MATCHES "QNX") list(APPEND CMAKE_REQUIRED_LIBRARIES -llogin) elseif(NOT APPLE) diff --git a/compat/compat.h.in b/compat/compat.h.in index f1161523..c6209c82 100644 --- a/compat/compat.h.in +++ b/compat/compat.h.in @@ -17,14 +17,20 @@ #define _GNU_SOURCE /* pthread_rwlock_t */ +#cmakedefine HAVE_CRYPT_H + +#ifdef HAVE_CRYPT_H +# include +#endif + #include -#include #include #include #include #include #include #include +#include #ifndef __WORDSIZE # if defined __x86_64__ && !defined __ILP32__ diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c index cc1f3de7..f46d968b 100644 --- a/src/session_server_ssh.c +++ b/src/session_server_ssh.c @@ -15,16 +15,10 @@ #define _GNU_SOURCE -#include "config.h" /* Expose HAVE_SHADOW, HAVE_CRYPT and HAVE_LIBPAM */ +#include "config.h" /* Expose HAVE_LIBPAM */ -#ifdef HAVE_SHADOW - #include -#endif -#ifdef HAVE_CRYPT - #include -#endif #ifdef HAVE_LIBPAM - #include +# include #endif #include