summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-01-24 09:51:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2018-01-24 09:51:39 (GMT)
commit6ccdad7b1f6fb316e4e85aa1eba8fbdc3169741e (patch)
treee9e40a0dc454e368e22d2088ab0cf171972af85f
parent8ca036d4716fc86ff42474ba35d3cd32f0188a15 (diff)
downloadcpython-6ccdad7b1f6fb316e4e85aa1eba8fbdc3169741e.zip
cpython-6ccdad7b1f6fb316e4e85aa1eba8fbdc3169741e.tar.gz
cpython-6ccdad7b1f6fb316e4e85aa1eba8fbdc3169741e.tar.bz2
bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (GH-5284) (#5295)
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)
-rw-r--r--Include/Python.h3
-rw-r--r--Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst2
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--pyconfig.h.in3
5 files changed, 10 insertions, 2 deletions
diff --git a/Include/Python.h b/Include/Python.h
index 775412b..a9327b0 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -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
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 0000000..d411890
--- /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 609b5c0..3477307 100755
--- a/configure
+++ b/configure
@@ -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 \
diff --git a/configure.ac b/configure.ac
index 7243de2..c645340 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 22dc2db..11c4a66 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -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