From 670a1ff8f97962efd6b27436b50fc51b62683c25 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 1 Sep 2019 17:25:49 +0200 Subject: Fix password checking with as-needed linking Newer gcc toolchains tend to enable as-needed by default, so runtime detection of libcrypt will fail. We can just explicitly link against libcrypt anyway. * configure.ac: Check for `crypt()' in libcrypt. * config.make.in: Substitute HAVE_LIBCRYPT. * libshouldbeinlibc/idvec-verify.c: Include only when libcrypt is available. Replace weak reference with explicit call and fallback macro. * utils/x.c: Likewise. * libshouldbeinlibc/Makefile (LDLIBS): Add -lcrypt when libcrypt is available. --- utils/x.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/x.c b/utils/x.c index 518f3847..90671fc9 100644 --- a/utils/x.c +++ b/utils/x.c @@ -30,6 +30,12 @@ #include #include #include +#ifdef HAVE_LIBCRYPT +#include +#else +#warning "No crypt on this system! Using plain-text passwords." +#define crypt(password, encrypted) password +#endif #include #include @@ -136,7 +142,6 @@ count_parent_gids () void verify_passwd (const char *name, const char *password, uid_t id, int is_group, structh auth *auth) { - extern char *crypt (const char salt[2], const char *string); char *prompt, *unencrypted, *encrypted; if (!password || !*password -- cgit v1.2.3