compat UPDATE move crypt to compat
also delete obsolete shadow dependency
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79fde55..5918165 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -286,10 +286,6 @@
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 f9dc007..bc132b4 100644
--- a/CMakeModules/UseCompat.cmake
+++ b/CMakeModules/UseCompat.cmake
@@ -63,6 +63,8 @@
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 f116152..c6209c8 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 <crypt.h>
+#endif
+
#include <alloca.h>
-#include <crypt.h>
#include <limits.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
+#include <unistd.h>
#ifndef __WORDSIZE
# if defined __x86_64__ && !defined __ILP32__
diff --git a/src/session_server_ssh.c b/src/session_server_ssh.c
index cc1f3de..f46d968 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 <shadow.h>
-#endif
-#ifdef HAVE_CRYPT
- #include <crypt.h>
-#endif
#ifdef HAVE_LIBPAM
- #include <security/pam_appl.h>
+# include <security/pam_appl.h>
#endif
#include <arpa/inet.h>