#####################################################################
-foreach header : [
- 'crypt.h',
-]
-
- if not cc.has_header(header)
- error(f'Header file @header@ not found')
- endif
-endforeach
-
foreach header : [
'gshadow.h',
'nss.h',
if get_option('libc') == 'musl'
libcrypt = []
+ have = get_option('libcrypt').allowed()
else
libcrypt = dependency('libcrypt', 'libxcrypt',
- required : true,
+ required : get_option('libcrypt'),
version : '>=4.4.0')
+ have = libcrypt.found()
endif
+conf.set10('HAVE_LIBCRYPT', have)
bpf_framework = get_option('bpf-framework')
bpf_compiler = get_option('bpf-compiler')
conf.set10('ENABLE_STORAGETM', get_option('storagetm'))
have = get_option('homed').require(
+ conf.get('HAVE_LIBCRYPT') == 1 and
conf.get('HAVE_OPENSSL') == 1 and
conf.get('HAVE_LIBFDISK') == 1 and
conf.get('HAVE_LIBCRYPTSETUP') == 1,
- error_message : 'openssl, fdisk and libcryptsetup required').allowed()
+ error_message : 'libcrypt, openssl, fdisk, and libcryptsetup required').allowed()
conf.set10('ENABLE_HOMED', have)
have = have and conf.get('HAVE_PAM') == 1
['gnutls'],
['libarchive'],
['libbpf'],
+ ['libcrypt'],
['libcryptsetup'],
['libcryptsetup-plugins'],
['libcurl'],
description : 'libpwquality support')
option('microhttpd', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
description : 'libµhttpd support')
+option('libcrypt', type : 'feature',
+ description : 'libcrypt/libxcrypt support')
option('libcryptsetup', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
description : 'libcryptsetup support')
option('libcryptsetup-plugins', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <crypt.h>
+#if HAVE_LIBCRYPT
+# include <crypt.h>
+#endif
#include "alloc-util.h"
#include "errno-util.h"
#include "string-util.h"
#include "strv.h"
+#if HAVE_LIBCRYPT
int make_salt(char **ret) {
const char *e;
char *salt;
return false;
}
+#endif
bool looks_like_hashed_password(const char *s) {
/* Returns false if the specified string is certainly not a hashed UNIX password. crypt(5) lists
#include "shared-forward.h"
+#if HAVE_LIBCRYPT
int make_salt(char **ret);
int hash_password(const char *password, char **ret);
int test_password_one(const char *hashed_password, const char *password);
int test_password_many(char **hashed_password, const char *password);
+
+#else
+
+static inline int hash_password(const char *password, char **ret) {
+ return -EOPNOTSUPP;
+}
+#endif
+
bool looks_like_hashed_password(const char *s);
test_template + {
'sources' : files('test-libcrypt-util.c'),
'dependencies' : libcrypt,
+ 'conditions' : ['HAVE_LIBCRYPT'],
'timeout' : 120,
},
test_template + {