mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-28503: Use crypt_r() when available instead of crypt() (GH-11373)
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.
This commit is contained in:
parent
1b29c03c95
commit
387512c7ec
6 changed files with 185 additions and 1 deletions
17
configure.ac
17
configure.ac
|
@ -3818,6 +3818,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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue