diff --git a/aclocal.m4 b/aclocal.m4 index 43a7f20eb..c7d1f87ca 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -47,8 +47,11 @@ AC_DEFUN([AM_PATH_PYTHON], dnl supported. (2.0 was released on October 16, 2000). dnl FIXME: Remove the need to hard-code Python versions here. m4_define_default([_AM_PYTHON_INTERPRETER_LIST], -[python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 dnl - python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) +[python python2 python3 dnl + python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 dnl + python3.2 python3.1 python3.0 dnl + python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 dnl + python2.0]) AC_ARG_VAR([PYTHON], [the Python interpreter]) diff --git a/configure b/configure index abda236f2..5d6e0f579 100755 --- a/configure +++ b/configure @@ -19101,7 +19101,7 @@ if ${am_cv_pathless_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else - for am_cv_pathless_PYTHON in python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do + for am_cv_pathless_PYTHON in python python2 python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do test "$am_cv_pathless_PYTHON" = none && break prog="import sys # split strings by '.' and convert to numeric. Append some zeros @@ -19388,7 +19388,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking python include flags" >&5 $as_echo_n "checking python include flags... " >&6; } - PYTHON_INCLUDE=`$PYTHON_CONFIG --includes` + PYTHON_INCLUDE=`$PYTHON_CONFIG --cflags` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_INCLUDE" >&5 $as_echo "$PYTHON_INCLUDE" >&6; } @@ -19398,7 +19398,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking python linker flags" >&5 $as_echo_n "checking python linker flags... " >&6; } - PYTHON_LIBS=`$PYTHON_CONFIG --libs` + PYTHON_LIBS=`$PYTHON_CONFIG --ldflags` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5 $as_echo "$PYTHON_LIBS" >&6; } diff --git a/configure.ac b/configure.ac index 853a114fe..7f85b5cc5 100644 --- a/configure.ac +++ b/configure.ac @@ -2546,13 +2546,13 @@ if test ${USE_PYTHON-'no'} = "yes"; then AS_IF([test -z "$PYTHON_INCLUDE"], [ AC_MSG_CHECKING([python include flags]) - PYTHON_INCLUDE=`$PYTHON_CONFIG --includes` + PYTHON_INCLUDE=`$PYTHON_CONFIG --cflags` AC_MSG_RESULT([$PYTHON_INCLUDE]) ]) AS_IF([test -z "$PYTHON_LIBS"], [ AC_MSG_CHECKING([python linker flags]) - PYTHON_LIBS=`$PYTHON_CONFIG --libs` + PYTHON_LIBS=`$PYTHON_CONFIG --ldflags` AC_MSG_RESULT([$PYTHON_LIBS]) ]) diff --git a/plugins/python/regress/check_python_examples.c b/plugins/python/regress/check_python_examples.c index 77f8e7467..d3f17c3b1 100644 --- a/plugins/python/regress/check_python_examples.c +++ b/plugins/python/regress/check_python_examples.c @@ -6,6 +6,8 @@ static struct io_plugin *python_io = NULL; static struct policy_plugin *python_policy = NULL; static struct sudoers_group_plugin *group_plugin = NULL; +static struct passwd example_pwd; + void create_io_plugin_options(const char *log_path) { @@ -80,12 +82,22 @@ init(void) // always start each test from clean state memset(&data, 0, sizeof(data)); + memset(&example_pwd, 0, sizeof(example_pwd)); + example_pwd.pw_name = "pw_name"; + example_pwd.pw_passwd = "pw_passwd"; + example_pwd.pw_gecos = "pw_gecos"; + example_pwd.pw_shell ="pw_shell"; + example_pwd.pw_dir = "pw_dir"; + example_pwd.pw_uid = (uid_t)1001; + example_pwd.pw_gid = (gid_t)101; + VERIFY_TRUE(asprintf(&data.tmp_dir, TEMP_PATH_TEMPLATE) >= 0); VERIFY_NOT_NULL(mkdtemp(data.tmp_dir)); // by default we test in developer mode, so the python plugin can be loaded sudo_conf_clear_paths(); VERIFY_INT(sudo_conf_read(sudo_conf_developer_mode, SUDO_CONF_ALL), true); + VERIFY_TRUE(sudo_conf_developer_mode()); // some default values for the plugin open: data.settings = create_str_array(1, NULL); diff --git a/plugins/python/regress/testhelpers.c b/plugins/python/regress/testhelpers.c index 66925e3c0..15f48cf5a 100644 --- a/plugins/python/regress/testhelpers.c +++ b/plugins/python/regress/testhelpers.c @@ -3,16 +3,6 @@ const char *sudo_conf_developer_mode = TESTDATA_DIR "sudo.conf.developer_mode"; const char *sudo_conf_normal_mode = TESTDATA_DIR "sudo.conf.normal_mode"; -struct passwd example_pwd = { - "pw_name", - "pw_passwd", - (uid_t)1001, - (gid_t)101, - "pw_gecos", - "pw_dir", - "pw_shell" -}; - struct TestData data; static void diff --git a/plugins/python/regress/testhelpers.h b/plugins/python/regress/testhelpers.h index 028f29422..4f680a610 100644 --- a/plugins/python/regress/testhelpers.h +++ b/plugins/python/regress/testhelpers.h @@ -16,8 +16,6 @@ extern const char *sudo_conf_developer_mode; extern const char *sudo_conf_normal_mode; -extern struct passwd example_pwd; - #define TEMP_PATH_TEMPLATE "/tmp/sudo_check_python_exampleXXXXXX" extern struct TestData { diff --git a/plugins/python/sudo_python_debug.h b/plugins/python/sudo_python_debug.h index 02a715a7e..7a4022660 100644 --- a/plugins/python/sudo_python_debug.h +++ b/plugins/python/sudo_python_debug.h @@ -19,6 +19,7 @@ #ifndef SUDO_PYTHON_DEBUG_H #define SUDO_PYTHON_DEBUG_H +#include #include "sudo_debug.h" /*