Skip to content

Commit

Permalink
libcrypt-util: use build-time check for crypt_preferred_method
Browse files Browse the repository at this point in the history
After systemd#16981 only the presence of crypt_gensalt_ra
is checked, but there are cases where that function is available but crypt_preferred_method
is not, and they are used in the same ifdef.
Add a check for the latter as well.
  • Loading branch information
bluca committed Sep 25, 2020
1 parent 26a63b8 commit edd2bfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,9 @@ libcrypt = cc.find_library('crypt')

crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
foreach ident : [
['crypt_ra', crypt_header],
['crypt_gensalt_ra', crypt_header]]
['crypt_ra', crypt_header],
['crypt_preferred_method', crypt_header],
['crypt_gensalt_ra', crypt_header]]

have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
dependencies : libcrypt)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/libcrypt-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

int make_salt(char **ret) {

#if HAVE_CRYPT_GENSALT_RA
#if HAVE_CRYPT_GENSALT_RA && HAVE_CRYPT_PREFERRED_METHOD
const char *e;
char *salt;

Expand Down

0 comments on commit edd2bfa

Please sign in to comment.