Synced patch for libxcrypt with upstream

This commit is contained in:
Charalampos Stratakis 2018-01-23 17:09:27 +00:00
parent 56f993d4f8
commit 7ee46fb6c4
2 changed files with 46 additions and 38 deletions

View File

@ -1,47 +1,54 @@
From 6811089dbf34a2cef9799e1cb6d63b863b58739f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
Date: Sun, 21 Jan 2018 18:55:31 +0100
Subject: [PATCH] cryptmodule: Include <crypt.h> for declaration of crypt() if
needed
Not every target system may provide a crypt() function in its stdlibc
and may use an external or replacement library, like libxcrypt, for
providing such functions.
---
Modules/_cryptmodule.c | 4 ++++
configure.ac | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
index 58d179e6a3..bb26d83f55 100644
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -5,6 +5,10 @@
#include <sys/types.h>
+#if defined(HAVE_XCRYPT)
diff --git a/Include/Python.h b/Include/Python.h
index 858dbd1..2845742 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
+
/* Module crypt */
/*[clinic input]
/* For size_t? */
#ifdef HAVE_STDDEF_H
diff --git a/configure b/configure
index 93f332f..ed37d5d 100755
--- a/configure
+++ b/configure
@@ -7709,7 +7709,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 stdint.h stropts.h termios.h \
diff --git a/configure.ac b/configure.ac
index 39e2e8e769..129c198c15 100644
index d071dde..937bb65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2816,6 +2816,10 @@ LIBS="$withval $LIBS"
@@ -1949,7 +1949,7 @@ dnl AC_MSG_RESULT($cpp_type)
PKG_PROG_PKG_CONFIG
# 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 stdint.h stropts.h termios.h \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 9052dbc..7d1f125 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -137,6 +137,9 @@
/* Define to 1 if you have the `copysign' function. */
#undef HAVE_COPYSIGN
+# Check for libxcrypt is present.
+PKG_CHECK_MODULES([libxcrypt], libxcrypt,
+ AC_DEFINE([HAVE_XCRYPT], 1, [Define to 1 if libxcrypt is found.]), [])
+/* Define to 1 if you have the <crypt.h> header file. */
+#undef HAVE_CRYPT_H
+
# Check for use of the system expat library
AC_MSG_CHECKING(for --with-system-expat)
AC_ARG_WITH(system_expat,
--
2.16.0
/* Define to 1 if you have the `ctermid' function. */
#undef HAVE_CTERMID

View File

@ -390,6 +390,7 @@ Patch273: 00273-skip-float-test.patch
# Not every target system may provide a crypt() function in its stdlibc
# and may use an external or replacement library, like libxcrypt, for
# providing such functions.
# Fixed upstream: https://bugs.python.org/issue32635
Patch290: 00290-cryptmodule-Include-crypt.h-for-declaration-of-crypt.patch
# (New patches go here ^^^)