1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Description: Use new PyConfig API starting with Python 3.12.
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Forwarded: https://github.com/sunweaver/pam-python/pull/2
--- a/src/pam_python.c
+++ b/src/pam_python.c
@@ -126,7 +126,13 @@
*/
static void initialise_python(void)
{
-#if PY_MAJOR_VERSION*100 + PY_MINOR_VERSION >= 204
+#if PY_MAJOR_VERSION*100 + PY_MINOR_VERSION >= 312
+ PyConfig py_config;
+ PyConfig_InitIsolatedConfig(&py_config);
+ py_config.write_bytecode = 0;
+ Py_InitializeFromConfig(&py_config);
+ PyConfig_Clear(&py_config);
+#elif PY_MAJOR_VERSION*100 + PY_MINOR_VERSION >= 204
Py_DontWriteBytecodeFlag = 1;
Py_IgnoreEnvironmentFlag = 1; /* Required to mitigate CVE-2019-16729 */
Py_NoUserSiteDirectory = 1; /* Required to mitigate CVE-2019-16729 */
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@
all: ctest pam_python.so test-pam_$(PYTHON).pam
-WARNINGS=-Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Werror
+WARNINGS=-Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Werror
#WARNINGS=-Wunreachable-code # Gcc 4.1 .. 4.4 are too buggy to make this useful
LIBDIR ?= /lib/security
|