Skip to content

Commit

Permalink
bpo-32635: Fix a segfault when importing the crypt module with libxcr…
Browse files Browse the repository at this point in the history
…ypt. (pythonGH-5284)

glibc is deprecating libcrypt in favor of libxcrypt, however python assumes
that crypt.h will always be included. This change makes the header inclusion
explicit when libxcrypt is present on the system.
(cherry picked from commit e768c86)
  • Loading branch information
stratakis authored and miss-islington committed Jan 24, 2018
1 parent 8ca036d commit 61b978f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Include/Python.h
Expand Up @@ -43,6 +43,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif

/* For size_t? */
#ifdef HAVE_STDDEF_H
Expand Down
@@ -0,0 +1,2 @@
Fix segfault of the crypt module when libxcrypt is provided instead of
libcrypt at the system.
2 changes: 1 addition & 1 deletion configure
Expand Up @@ -7035,7 +7035,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
for ac_header in asm/types.h conio.h direct.h dlfcn.h errno.h \
for ac_header in asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -1690,7 +1690,7 @@ dnl AC_MSG_RESULT($cpp_type)

# checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
ieeefp.h io.h langinfo.h libintl.h poll.h process.h pthread.h \
shadow.h signal.h stdint.h stropts.h termios.h thread.h \
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Expand Up @@ -130,6 +130,9 @@
/* Define to 1 if you have the `copysign' function. */
#undef HAVE_COPYSIGN

/* Define to 1 if you have the <crypt.h> header file. */
#undef HAVE_CRYPT_H

/* Define to 1 if you have the `ctermid' function. */
#undef HAVE_CTERMID

Expand Down

0 comments on commit 61b978f

Please sign in to comment.