Check for crypt(3), also on FreeBSD

This commit is contained in:
Adriaan de Groot 2017-09-13 22:24:30 +02:00
parent edb1dbaa6e
commit c9f4bc0cc8
3 changed files with 24 additions and 9 deletions

View File

@ -5,19 +5,30 @@
# LIBCRYPT_LIBRARY, the path to libcrypt # LIBCRYPT_LIBRARY, the path to libcrypt
# LIBCRYPT_FOUND, whether libcrypt was found # LIBCRYPT_FOUND, whether libcrypt was found
if( CMAKE_SYSTEM MATCHES "FreeBSD" )
# FreeBSD has crypt(3) declared in unistd.h, which lives in
# libc; the libcrypt found here is not used.
find_path( CRYPT_INCLUDE_DIR NAMES unistd.h )
add_definitions( -DNO_CRYPT_H )
else()
find_path( CRYPT_INCLUDE_DIR
NAMES crypt.h
HINTS
${CMAKE_INSTALL_INCLUDEDIR}
NO_CACHE
)
endif()
find_path( CRYPT_INCLUDE_DIR NAMES crypt.h find_library( CRYPT_LIBRARIES
HINTS NAMES crypt
${CMAKE_INSTALL_INCLUDEDIR}
)
find_library( CRYPT_LIBRARIES NAMES crypt
HINTS HINTS
${CMAKE_INSTALL_LIBDIR} ${CMAKE_INSTALL_LIBDIR}
) )
include( FindPackageHandleStandardArgs ) include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Crypt find_package_handle_standard_args(
REQUIRED_VARS CRYPT_LIBRARIES CRYPT_INCLUDE_DIR ) Crypt
REQUIRED_VARS CRYPT_LIBRARIES CRYPT_INCLUDE_DIR
)
mark_as_advanced( CRYPT_INCLUDE_DIR CRYPT_LIBRARIES ) mark_as_advanced( CRYPT_INCLUDE_DIR CRYPT_LIBRARIES )

View File

@ -5,7 +5,7 @@ if( ECM_FOUND )
endif() endif()
find_package( Qt5 COMPONENTS Core Test REQUIRED ) find_package( Qt5 COMPONENTS Core Test REQUIRED )
find_package( Crypt ) find_package( Crypt REQUIRED )
include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui )

View File

@ -27,7 +27,11 @@
#include <QDir> #include <QDir>
#include <random> #include <random>
#ifndef NO_CRYPT_H
#include <crypt.h> #include <crypt.h>
#endif
#include <unistd.h>
SetPasswordJob::SetPasswordJob( const QString& userName, const QString& newPassword ) SetPasswordJob::SetPasswordJob( const QString& userName, const QString& newPassword )