Skip to content

Conversation

@jkartseva
Copy link

crypt.h might not have crypt_preferred_method which breaks the build.
Fix by adding crypt_preferred_method parser in meson.build and checking
for HAVE_CRYPT_PREFERRED_METHOD macro.
Tested on CentOS 8 with libxcrypt-4.1.1 installed.

../src/shared/libcrypt-util.c: In function ‘make_salt’:
../src/shared/libcrypt-util.c:43:21: error: implicit declaration of function ‘crypt_preferred_method’ [-Werror=implicit-function-declaration]
                 e = crypt_preferred_method();

crypt.h might not have crypt_preferred_method which breaks the build.
Fix by adding crypt_preferred_method parser in meson.build and checking
for HAVE_CRYPT_PREFERRED_METHOD macro.
Tested on CentOS 8 with libxcrypt-4.1.1 installed.
@poettering
Copy link
Member

hmm, crypt_preferred_method was added in libxcrypt 4.4 apparently

['crypt_ra', crypt_header],
['crypt_gensalt_ra', crypt_header]]
['crypt_gensalt_ra', crypt_header],
['crypt_preferred_method', crypt_header]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the indented table structure in place, i.e. reindent the first two rows' second column to match the third row

int make_salt(char **ret) {

#if HAVE_CRYPT_GENSALT_RA
#if ((HAVE_CRYPT_GENSALT_RA) && (HAVE_CRYPT_PREFERRED_METHOD))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, i think a nicer fix would be to just hardcode $6$ as default prefix if crypt_preferred_method is not available. i.e. see the other ifdef branch here, it also uses $6$ as default prefix. i.e. instead of bypassing the whole crypt_gensalt_ra() branch just add a fallback for the crypt_preferred_method() call

@poettering
Copy link
Member

/cc @keszybz

@poettering poettering added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks util-lib labels Sep 25, 2020
@poettering
Copy link
Member

In the meantime @bluca posted a similar PR #17163 and fixed according to the suggestions. I hope it's OK if I close this one in favour of his PR.

@poettering poettering closed this Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks util-lib

Development

Successfully merging this pull request may close these issues.

2 participants