Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,14 @@ if(ENABLE_SSH_TLS)
if (MBEDTLS_FOUND)
# dependencies - mbedtls
set(HAVE_MBEDTLS TRUE)
list(APPEND libsrc src/session_mbedtls.c)
list(APPEND libsrc src/session_mbedtls.c src/crypt.c src/crypt_mbedtls.c)
include_directories(${MBEDTLS_INCLUDE_DIRS})
target_link_libraries(netconf2 ${MBEDTLS_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${MBEDTLS_LIBRARIES})
else()
# dependencies - openssl
find_package(OpenSSL 3.0.0 REQUIRED)
list(APPEND libsrc src/session_openssl.c)
list(APPEND libsrc src/session_openssl.c src/crypt.c src/crypt_openssl.c)
include_directories(${OPENSSL_INCLUDE_DIR})
target_link_libraries(netconf2 ${OPENSSL_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
Expand Down Expand Up @@ -290,18 +290,6 @@ if(ENABLE_SSH_TLS)
include_directories(${CURL_INCLUDE_DIRS})
endif()

# crypt (if not found, assume no library needs to be linked)
if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(LIBCRYPT login)
else()
set(LIBCRYPT crypt)
endif()
check_library_exists(${LIBCRYPT} crypt "" HAVE_CRYPT)
if(HAVE_CRYPT)
target_link_libraries(netconf2 ${LIBCRYPT})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBCRYPT})
endif()

# libpam
if(ENABLE_PAM)
find_package(LibPAM)
Expand Down
14 changes: 0 additions & 14 deletions CMakeModules/UseCompat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ macro(USE_COMPAT)

check_include_file("alloca.h" HAVE_ALLOCA_H)

# crypt
check_include_file("crypt.h" HAVE_CRYPT_H)

if(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
list(APPEND CMAKE_REQUIRED_LIBRARIES -llogin)
elseif(NOT APPLE)
list(APPEND CMAKE_REQUIRED_LIBRARIES -lcrypt)
endif()
if(HAVE_CRYPT_H)
check_symbol_exists(crypt_r "crypt.h" HAVE_CRYPT_R)
else()
check_symbol_exists(crypt_r "unistd.h" HAVE_CRYPT_R)
endif()

# unsock_get_uid
check_symbol_exists(SO_PEERCRED "sys/socket.h" HAVE_SO_PEERCRED)
if(NOT HAVE_SO_PEERCRED)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ the `distro` directory.

* C compiler (gcc >= 4.8.4, clang >= 3.0, ...)
* cmake >= 3.5.0
* crypt(3)
* [libyang](https://github.com/CESNET/libyang)
* libssh >= 0.9.5 (for SSH support)
* OpenSSL >= 3.0.0 or MbedTLS >= 3.5.0 (for TLS support)
Expand Down
18 changes: 0 additions & 18 deletions compat/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,24 +380,6 @@ get_current_dir_name(void)

#endif

#ifndef HAVE_CRYPT_R
char *
crypt_r(const char *phrase, const char *setting, struct crypt_data *data)
{
static pthread_mutex_t crypt_lock = PTHREAD_MUTEX_INITIALIZER;
char *hash;

(void) data;

pthread_mutex_lock(&crypt_lock);
hash = crypt(phrase, setting);
pthread_mutex_unlock(&crypt_lock);

return hash;
}

#endif

#ifndef HAVE_TIMEGM
time_t
timegm(struct tm *tm)
Expand Down
16 changes: 0 additions & 16 deletions compat/compat.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@

#define _GNU_SOURCE /* pthread_rwlock_t */

#cmakedefine HAVE_CRYPT_H
#ifdef HAVE_CRYPT_H
# include <crypt.h>
#endif

#cmakedefine HAVE_ALLOCA_H
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
Expand Down Expand Up @@ -80,7 +75,6 @@
#cmakedefine HAVE_STRCHRNUL
#cmakedefine HAVE_GET_CURRENT_DIR_NAME
#cmakedefine HAVE_TIMEGM
#cmakedefine HAVE_CRYPT_R
#cmakedefine HAVE_SO_PEERCRED
#cmakedefine HAVE_GETPEEREID

Expand Down Expand Up @@ -228,16 +222,6 @@ char *strchrnul(const char *s, int c);
char *get_current_dir_name(void);
#endif

#ifndef HAVE_CRYPT_R

/* unused anyway */
struct crypt_data {
char a;
};

char *crypt_r(const char *phrase, const char *setting, struct crypt_data *data);
#endif

#ifndef HAVE_TIMEGM
time_t timegm(struct tm *tm);
#endif
Expand Down
Loading
Loading