Skip to content

Commit

Permalink
compat UPDATE move crypt to compat
Browse files Browse the repository at this point in the history
also delete obsolete shadow dependency
  • Loading branch information
roman committed Nov 2, 2023
1 parent 1888b8a commit 0f137d7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions CMakeModules/UseCompat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion compat/compat.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
10 changes: 2 additions & 8 deletions src/session_server_ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 0f137d7

Please sign in to comment.