Skip to content

Commit 8e230e1

Browse files
miss-islingtonvstinner
authored andcommittedJan 24, 2018
bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. (pythonGH-5284) (python#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 e768c86)
1 parent 6abbf14 commit 8e230e1

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed
 

‎Include/Python.h

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#ifdef HAVE_UNISTD_H
3636
#include <unistd.h>
3737
#endif
38+
#ifdef HAVE_CRYPT_H
39+
#include <crypt.h>
40+
#endif
3841

3942
/* For size_t? */
4043
#ifdef HAVE_STDDEF_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix segfault of the crypt module when libxcrypt is provided instead of
2+
libcrypt at the system.

‎configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -7809,7 +7809,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
78097809

78107810
fi
78117811

7812-
for ac_header in asm/types.h conio.h direct.h dlfcn.h errno.h \
7812+
for ac_header in asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
78137813
fcntl.h grp.h \
78147814
ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \
78157815
sched.h shadow.h signal.h stropts.h termios.h \

‎configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ dnl AC_MSG_RESULT($cpp_type)
20552055

20562056
# checks for header files
20572057
AC_HEADER_STDC
2058-
AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
2058+
AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \
20592059
fcntl.h grp.h \
20602060
ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \
20612061
sched.h shadow.h signal.h stropts.h termios.h \

‎pyconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@
140140
/* Define to 1 if you have the `copysign' function. */
141141
#undef HAVE_COPYSIGN
142142

143+
/* Define to 1 if you have the <crypt.h> header file. */
144+
#undef HAVE_CRYPT_H
145+
143146
/* Define to 1 if you have the `ctermid' function. */
144147
#undef HAVE_CTERMID
145148

0 commit comments

Comments
 (0)
Please sign in to comment.