diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-12-30 17:59:52 -0800 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2018-12-30 17:59:52 -0800 |
commit | a144feeb7ec501aaf30072d50e70d54b200e5ef0 (patch) | |
tree | a650f1154811346fe4cac097b097688a28664cb1 /configure.ac | |
parent | 01b9664740307b39c2907bd84cbb0b2c35be9df4 (diff) | |
download | cpython-git-a144feeb7ec501aaf30072d50e70d54b200e5ef0.tar.gz |
bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373) (GH-11376)
Use crypt_r() when available instead of crypt() in the crypt module.
As a nice side effect: This also avoids a memory sanitizer flake as clang msan doesn't know about crypt's internal libc allocated buffer.
(cherry picked from commit 387512c7ecde6446f2e29408af2e16b9fc043807)
Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index a7de901e08..788c361ffe 100644 --- a/configure.ac +++ b/configure.ac @@ -3875,6 +3875,23 @@ AC_CHECK_FUNCS(gettimeofday, ]) ) +# We search for both crypt and crypt_r as one or the other may be defined +# This gets us our -lcrypt in LIBS when required on the target platform. +AC_SEARCH_LIBS(crypt, crypt) +AC_SEARCH_LIBS(crypt_r, crypt) + +AC_CHECK_FUNC(crypt_r, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#define _GNU_SOURCE /* Required for crypt_r()'s prototype in glibc. */ +#include <crypt.h> +]], [[ +struct crypt_data d; +char *r = crypt_r("", "", &d); +]])], + [AC_DEFINE(HAVE_CRYPT_R, 1, [Define if you have the crypt_r() function.])], + []) +) + AC_CHECK_FUNCS(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime, [ LIBS="$LIBS -lrt" |