[Python-checkins] bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (#5296)

Victor Stinner webhook-mailer at python.org
Wed Jan 24 05:11:20 EST 2018


https://github.com/python/cpython/commit/8e230e1eb3d38ad557b5dc5c31166afa35c01ff3
commit: 8e230e1eb3d38ad557b5dc5c31166afa35c01ff3
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Victor Stinner <victor.stinner at gmail.com>
date: 2018-01-24T11:11:16+01:00
summary:

bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (#5296)

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 e768c86ef442ef89004089a8a34ce5909ffb90f2)

files:
A Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst
M Include/Python.h
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Include/Python.h b/Include/Python.h
index 4c7c9a48c81..6177bad869c 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -35,6 +35,9 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif
 
 /* For size_t? */
 #ifdef HAVE_STDDEF_H
diff --git a/Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst b/Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst
new file mode 100644
index 00000000000..d411890f5d8
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst
@@ -0,0 +1,2 @@
+Fix segfault of the crypt module when libxcrypt is provided instead of
+libcrypt at the system.
diff --git a/configure b/configure
index ea1baef55d3..1e66117fffb 100755
--- a/configure
+++ b/configure
@@ -7809,7 +7809,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 process.h pthread.h \
 sched.h shadow.h signal.h stropts.h termios.h \
diff --git a/configure.ac b/configure.ac
index fc1dba6b029..2eb511bf7f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2055,7 +2055,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 process.h pthread.h \
 sched.h shadow.h signal.h stropts.h termios.h \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index bc2693b0b21..6cef7b37b7b 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -140,6 +140,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
 



More information about the Python-checkins mailing list