diff --git a/Changed-functions-to-pre-post-actions-when-forking.patch b/Changed-functions-to-pre-post-actions-when-forking.patch deleted file mode 100644 index 91c47fc6974c2740a0daaa2d0e2c0379cc862be4..0000000000000000000000000000000000000000 --- a/Changed-functions-to-pre-post-actions-when-forking.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0f34844009075391c55419a3afb90e469facf35e Mon Sep 17 00:00:00 2001 -From: Graham Dumpleton -Date: Tue, 14 May 2019 16:14:07 +1000 -Subject: [PATCH] Changed functions to pre/post actions when forking. - ---- - src/server/mod_wsgi.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/src/server/mod_wsgi.c b/src/server/mod_wsgi.c -index 2e4bb24d..bf55945a 100644 ---- a/src/server/mod_wsgi.c -+++ b/src/server/mod_wsgi.c -@@ -4345,8 +4345,13 @@ static void wsgi_python_child_init(apr_pool_t *p) - * do it if Python was initialised in parent process. - */ - -- if (wsgi_python_initialized && !wsgi_python_after_fork) -+ if (wsgi_python_initialized && !wsgi_python_after_fork) { -+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) -+ PyOS_AfterFork_Child(); -+#else - PyOS_AfterFork(); -+#endif -+ } - - /* Finalise any Python objects required by child process. */ - -@@ -10422,6 +10427,12 @@ static int wsgi_start_process(apr_pool_t *p, WSGIDaemonProcess *daemon) - wsgi_exit_daemon_process(0); - } - -+ if (wsgi_python_initialized) { -+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) -+ PyOS_AfterFork_Parent(); -+#endif -+ } -+ - apr_pool_note_subprocess(p, &daemon->process, APR_KILL_AFTER_TIMEOUT); - apr_proc_other_child_register(&daemon->process, wsgi_manage_process, - daemon, NULL, p); diff --git a/Use-official-APIs-for-accessing-interpreter-list.patch b/Use-official-APIs-for-accessing-interpreter-list.patch deleted file mode 100644 index c2c99910d4056c030d52a97312e05f044c9372a8..0000000000000000000000000000000000000000 --- a/Use-official-APIs-for-accessing-interpreter-list.patch +++ /dev/null @@ -1,55 +0,0 @@ -From b03b02df6318afe26052db5b0365732152cacea2 Mon Sep 17 00:00:00 2001 -From: Graham Dumpleton -Date: Tue, 14 May 2019 16:14:42 +1000 -Subject: [PATCH] Use official APIs for accessing interpreter list. - ---- - src/server/wsgi_interp.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/src/server/wsgi_interp.c b/src/server/wsgi_interp.c -index 4a948509..3fbca04b 100644 ---- a/src/server/wsgi_interp.c -+++ b/src/server/wsgi_interp.c -@@ -338,9 +338,10 @@ static PyObject *ShutdownInterpreter_call( - - PyThreadState_Swap(NULL); - -- tstate = tstate->interp->tstate_head; -+ tstate = PyInterpreterState_ThreadHead(tstate->interp); -+ - while (tstate) { -- tstate_next = tstate->next; -+ tstate_next = PyThreadState_Next(tstate); - if (tstate != tstate_save) { - PyThreadState_Swap(tstate); - PyThreadState_Clear(tstate); -@@ -436,9 +437,13 @@ InterpreterObject *newInterpreterObject(const char *name) - */ - - if (!name) { -+#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7) -+ interp = PyInterpreterState_Main(); -+#else - interp = PyInterpreterState_Head(); -- while (interp->next) -- interp = interp->next; -+ while (PyInterpreterState_Next(interp)) -+ interp = PyInterpreterState_Next(interp); -+#endif - - name = ""; - } -@@ -1883,9 +1888,10 @@ static void Interpreter_dealloc(InterpreterObject *self) - - PyThreadState_Swap(NULL); - -- tstate = tstate->interp->tstate_head; -+ tstate = PyInterpreterState_ThreadHead(tstate->interp); -+ - while (tstate) { -- tstate_next = tstate->next; -+ tstate_next = PyThreadState_Next(tstate); - if (tstate != tstate_save) { - PyThreadState_Swap(tstate); - PyThreadState_Clear(tstate); diff --git a/mod_wsgi-3.4-CVE-2014-0240.patch b/mod_wsgi-3.4-CVE-2014-0240.patch new file mode 100644 index 0000000000000000000000000000000000000000..b1d770a19c98c9cd71cd07901ea6d5068ce4e163 --- /dev/null +++ b/mod_wsgi-3.4-CVE-2014-0240.patch @@ -0,0 +1,37 @@ +From d9d5fea585b23991f76532a9b07de7fcd3b649f4 Mon Sep 17 00:00:00 2001 +From: Graham Dumpleton +Date: Wed, 21 May 2014 16:16:47 +1000 +Subject: [PATCH] Local privilege escalation when using daemon mode. + (CVE-2014-0240) + +--- + mod_wsgi.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/mod_wsgi.c b/mod_wsgi.c +index 32b2903..3ef911b 100644 +--- a/mod_wsgi.c ++++ b/mod_wsgi.c +@@ -10756,6 +10756,19 @@ static void wsgi_setup_access(WSGIDaemonProcess *daemon) + ap_log_error(APLOG_MARK, WSGI_LOG_ALERT(errno), wsgi_server, + "mod_wsgi (pid=%d): Unable to change to uid=%ld.", + getpid(), (long)daemon->group->uid); ++ ++ /* ++ * On true UNIX systems this should always succeed at ++ * this point. With certain Linux kernel versions though ++ * we can get back EAGAIN where the target user had ++ * reached their process limit. In that case will be left ++ * running as wrong user. Just exit on all failures to be ++ * safe. Don't die immediately to avoid a fork bomb. ++ */ ++ ++ sleep(20); ++ ++ exit(-1); + } + + #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) +-- +2.0.3 + diff --git a/mod_wsgi-3.4-connsbh.patch b/mod_wsgi-3.4-connsbh.patch new file mode 100644 index 0000000000000000000000000000000000000000..2f0c73e33ac04333d13cc6c70f0563ff2e0aee67 --- /dev/null +++ b/mod_wsgi-3.4-connsbh.patch @@ -0,0 +1,23 @@ + +Fix scoreboard handling. + +https://bugzilla.redhat.com/show_bug.cgi?id=867276 + +http://code.google.com/p/modwsgi/source/detail?path=/mod_wsgi.c&name=mod_wsgi-3.X&r=bdbeacb88f348909845445e9d52eb7be401abaf1 + +--- mod_wsgi-3.4/mod_wsgi.c.connsbh ++++ mod_wsgi-3.4/mod_wsgi.c +@@ -10600,7 +10600,13 @@ static void wsgi_process_socket(apr_pool + * will add their own input/output filters to the chain. + */ + ++#if AP_MODULE_MAGIC_AT_LEAST(20110619,0) ++ /* For 2.4 a NULL sbh pointer should work. */ ++ sbh = NULL; ++#else ++ /* For 2.2 a dummy sbh pointer is needed. */ + ap_create_sb_handle(&sbh, p, -1, 0); ++#endif + + c = (conn_rec *)apr_pcalloc(p, sizeof(conn_rec)); + diff --git a/mod_wsgi-3.4-coredump.patch b/mod_wsgi-3.4-coredump.patch new file mode 100644 index 0000000000000000000000000000000000000000..07c4081233aceb094c99f0de43424fdc5635c5aa --- /dev/null +++ b/mod_wsgi-3.4-coredump.patch @@ -0,0 +1,47 @@ + +Enable core dumps. In upstream 3.x branch: + +http://code.google.com/p/modwsgi/source/detail?r=b4f55d756fa816a7eae0f7edc13d5f2da3f3d5c1&name=mod_wsgi-3.X&path=/mod_wsgi.c# + +--- mod_wsgi-3.4/configure.ac.dumpcore ++++ mod_wsgi-3.4/configure.ac +@@ -39,6 +39,8 @@ fi + + AC_SUBST(APXS) + ++AC_CHECK_FUNCS(prctl) ++ + AC_MSG_CHECKING(Apache version) + HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`" + HTTPD_INCLUDEDIR="`${APXS} -q INCLUDEDIR`" +--- mod_wsgi-3.4/mod_wsgi.c.coredump ++++ mod_wsgi-3.4/mod_wsgi.c +@@ -139,6 +139,10 @@ typedef regmatch_t ap_regmatch_t; + #include + #endif + ++#ifdef HAVE_SYS_PRCTL_H ++#include ++#endif ++ + #include "Python.h" + + #if !defined(PY_VERSION_HEX) +@@ -10485,6 +10489,17 @@ static void wsgi_setup_access(WSGIDaemon + "mod_wsgi (pid=%d): Unable to change to uid=%ld.", + getpid(), (long)daemon->group->uid); + } ++ ++#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) ++ /* this applies to Linux 2.4+ */ ++ if (ap_coredumpdir_configured) { ++ if (prctl(PR_SET_DUMPABLE, 1)) { ++ ap_log_error(APLOG_MARK, WSGI_LOG_ALERT(errno), wsgi_server, ++ "mod_wsgi (pid=%d): set dumpable failed - this child will not coredump" ++ " after software errors", getpid()); ++ } ++ } ++#endif + } + + static int wsgi_setup_socket(WSGIProcessGroup *process) diff --git a/mod_wsgi-3.4-deadlock.patch b/mod_wsgi-3.4-deadlock.patch new file mode 100644 index 0000000000000000000000000000000000000000..8754fc1784ac62dde3ecca0837b2cbb6ddf2439e --- /dev/null +++ b/mod_wsgi-3.4-deadlock.patch @@ -0,0 +1,18 @@ + +https://github.com/GrahamDumpleton/mod_wsgi/commit/f8b43b2b79fabdcead4410f1a10484a10608ba6a + +--- mod_wsgi-3.4/mod_wsgi.c.deadlock ++++ mod_wsgi-3.4/mod_wsgi.c +@@ -11113,8 +11113,10 @@ + while (1) { + apr_sleep(apr_time_from_sec(1)); + +- gilstate = PyGILState_Ensure(); +- PyGILState_Release(gilstate); ++ if (!wsgi_daemon_shutdown) { ++ gilstate = PyGILState_Ensure(); ++ PyGILState_Release(gilstate); ++ } + + apr_thread_mutex_lock(wsgi_shutdown_lock); + wsgi_deadlock_shutdown_time = apr_time_now(); diff --git a/mod_wsgi-3.4-head-to-get.patch b/mod_wsgi-3.4-head-to-get.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d2d425a83989c34e6b2b44238b0097f43e4b2ce --- /dev/null +++ b/mod_wsgi-3.4-head-to-get.patch @@ -0,0 +1,149 @@ +diff --git a/mod_wsgi.c b/mod_wsgi.c +index c65344e..b32fc5c 100644 +--- a/mod_wsgi.c ++++ b/mod_wsgi.c +@@ -500,6 +500,7 @@ typedef struct { + int script_reloading; + int error_override; + int chunked_request; ++ int map_head_to_get; + + int enable_sendfile; + +@@ -669,6 +670,11 @@ static void *wsgi_merge_server_config(apr_pool_t *p, void *base_conf, + else + config->chunked_request = parent->chunked_request; + ++ if (child->map_head_to_get != -1) ++ config->map_head_to_get = child->map_head_to_get; ++ else ++ config->map_head_to_get = parent->map_head_to_get; ++ + if (child->enable_sendfile != -1) + config->enable_sendfile = child->enable_sendfile; + else +@@ -704,6 +710,7 @@ typedef struct { + int script_reloading; + int error_override; + int chunked_request; ++ int map_head_to_get; + + int enable_sendfile; + +@@ -737,6 +744,7 @@ static WSGIDirectoryConfig *newWSGIDirectoryConfig(apr_pool_t *p) + object->script_reloading = -1; + object->error_override = -1; + object->chunked_request = -1; ++ object->map_head_to_get = -1; + + object->enable_sendfile = -1; + +@@ -820,6 +828,11 @@ static void *wsgi_merge_dir_config(apr_pool_t *p, void *base_conf, + else + config->chunked_request = parent->chunked_request; + ++ if (child->map_head_to_get != -1) ++ config->map_head_to_get = child->map_head_to_get; ++ else ++ config->map_head_to_get = parent->map_head_to_get; ++ + if (child->enable_sendfile != -1) + config->enable_sendfile = child->enable_sendfile; + else +@@ -880,6 +893,7 @@ typedef struct { + int script_reloading; + int error_override; + int chunked_request; ++ int map_head_to_get; + + int enable_sendfile; + +@@ -1229,6 +1243,14 @@ static WSGIRequestConfig *wsgi_create_req_config(apr_pool_t *p, request_rec *r) + config->chunked_request = 0; + } + ++ config->map_head_to_get = dconfig->map_head_to_get; ++ ++ if (config->map_head_to_get < 0) { ++ config->map_head_to_get = sconfig->map_head_to_get; ++ if (config->map_head_to_get < 0) ++ config->map_head_to_get = 2; ++ } ++ + config->enable_sendfile = dconfig->enable_sendfile; + + if (config->enable_sendfile < 0) { +@@ -7993,6 +8015,40 @@ static const char *wsgi_set_chunked_request(cmd_parms *cmd, void *mconfig, + return NULL; + } + ++static const char *wsgi_set_map_head_to_get(cmd_parms *cmd, void *mconfig, ++ const char *f) ++{ ++ if (cmd->path) { ++ WSGIDirectoryConfig *dconfig = NULL; ++ dconfig = (WSGIDirectoryConfig *)mconfig; ++ ++ if (strcasecmp(f, "Off") == 0) ++ dconfig->map_head_to_get = 0; ++ else if (strcasecmp(f, "On") == 0) ++ dconfig->map_head_to_get = 1; ++ else if (strcasecmp(f, "Auto") == 0) ++ dconfig->map_head_to_get = 2; ++ else ++ return "WSGIMapHEADToGET must be one of: Off | On | Auto"; ++ } ++ else { ++ WSGIServerConfig *sconfig = NULL; ++ sconfig = ap_get_module_config(cmd->server->module_config, ++ &wsgi_module); ++ ++ if (strcasecmp(f, "Off") == 0) ++ sconfig->map_head_to_get = 0; ++ else if (strcasecmp(f, "On") == 0) ++ sconfig->map_head_to_get = 1; ++ else if (strcasecmp(f, "Auto") == 0) ++ sconfig->map_head_to_get = 2; ++ else ++ return "WSGIMapHEADToGET must be one of: Off | On | Auto"; ++ } ++ ++ return NULL; ++} ++ + static const char *wsgi_set_enable_sendfile(cmd_parms *cmd, void *mconfig, + const char *f) + { +@@ -8463,14 +8519,15 @@ static void wsgi_build_environment(request_rec *r) + * might change the content and/or headers. + */ + +-#if AP_SERVER_MAJORVERSION_NUMBER >= 2 +- if (r->method_number == M_GET && r->header_only && +- r->output_filters->frec->ftype < AP_FTYPE_PROTOCOL) +- apr_table_setn(r->subprocess_env, "REQUEST_METHOD", "GET"); +-#else +- if (r->method_number == M_GET && r->header_only) +- apr_table_setn(r->subprocess_env, "REQUEST_METHOD", "GET"); +-#endif ++ if (config->map_head_to_get == 2) { ++ if (r->method_number == M_GET && r->header_only && ++ r->output_filters->frec->ftype < AP_FTYPE_PROTOCOL) ++ apr_table_setn(r->subprocess_env, "REQUEST_METHOD", "GET"); ++ } ++ else if (config->map_head_to_get == 1) { ++ if (r->method_number == M_GET) ++ apr_table_setn(r->subprocess_env, "REQUEST_METHOD", "GET"); ++ } + + /* Determine whether connection uses HTTPS protocol. */ + +@@ -15856,6 +15913,8 @@ static const command_rec wsgi_commands[] = + NULL, OR_FILEINFO, "Enable/Disable overriding of error pages."), + AP_INIT_TAKE1("WSGIChunkedRequest", wsgi_set_chunked_request, + NULL, OR_FILEINFO, "Enable/Disable support for chunked requests."), ++ AP_INIT_TAKE1("WSGIMapHEADToGET", wsgi_set_map_head_to_get, ++ NULL, OR_FILEINFO, "Enable/Disable mapping of HEAD to GET."), + + #ifndef WIN32 + #if AP_SERVER_MAJORVERSION_NUMBER >= 2 diff --git a/mod_wsgi-3.4-procexit.patch b/mod_wsgi-3.4-procexit.patch new file mode 100644 index 0000000000000000000000000000000000000000..7bb16904e5257f2214a29ad937dea753cb0c2c1d --- /dev/null +++ b/mod_wsgi-3.4-procexit.patch @@ -0,0 +1,28 @@ + +Log exit status in daemon manager; improves diagnosics. + +http://code.google.com/p/modwsgi/source/detail?path=/mod_wsgi.c&name=mod_wsgi-3.X&r=b4f55d756fa816a7eae0f7edc13d5f2da3f3d5c1 + +--- mod_wsgi-3.3/mod_wsgi.c.procexit ++++ mod_wsgi-3.3/mod_wsgi.c +@@ -9845,6 +9845,20 @@ static void wsgi_manage_process(int reas + wsgi_server, "mod_wsgi (pid=%d): " + "Process '%s' has died, restarting.", + daemon->process.pid, daemon->group->name); ++ if (WIFEXITED(status)) { ++ ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), ++ wsgi_server, "mod_wsgi (pid=%d): " ++ "Process '%s' terminated normally, exit code %d", ++ daemon->process.pid, daemon->group->name, ++ WEXITSTATUS(status)); ++ } ++ else if (WIFSIGNALED(status)) { ++ ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), ++ wsgi_server, "mod_wsgi (pid=%d): " ++ "Process '%s' terminated by signal %d", ++ daemon->process.pid, daemon->group->name, ++ WTERMSIG(status)); ++ } + + wsgi_start_process(wsgi_parent_pool, daemon); + } diff --git a/mod_wsgi-3.4-restart-segfault.patch b/mod_wsgi-3.4-restart-segfault.patch new file mode 100644 index 0000000000000000000000000000000000000000..cae8ab1de6ede4d0940456ab5da866a9379c34ef --- /dev/null +++ b/mod_wsgi-3.4-restart-segfault.patch @@ -0,0 +1,44 @@ +diff --git a/mod_wsgi.c b/mod_wsgi.c +index fd304bd..c65344e 100644 +--- a/mod_wsgi.c ++++ b/mod_wsgi.c +@@ -13659,14 +13659,37 @@ static int wsgi_hook_init(apr_pool_t *pconf, apr_pool_t *ptemp, + * Init function gets called twice during startup, we only + * need to actually do anything on the second time it is + * called. This avoids unecessarily initialising and then +- * destroying Python for no reason. ++ * destroying Python for no reason. We also though have to ++ * deal with a special case when a graceful restart is done. ++ * For that we are only called once, which is generally okay ++ * as the 'wsgi_init' key will be set from initial start up ++ * of the server. The exception to this is where the module ++ * is only loaded into Apache when the server is already ++ * running. In this case we have to detect that it is not ++ * the initial startup, but a subsequent restart. We can do ++ * this by looking at whether the scoreboard has been ++ * initialised yet. That is probably enough, but to be safe, ++ * also check what generation it is. + */ + + apr_pool_userdata_get(&data, userdata_key, s->process->pool); + if (!data) { + apr_pool_userdata_set((const void *)1, userdata_key, + apr_pool_cleanup_null, s->process->pool); +- return OK; ++ ++ /* ++ * Check for the special case of a graceful restart and ++ * the module being loaded for the first time. In this ++ * case we still go onto perform initialisation as the ++ * initialisation routine for the module will not be ++ * called a second time. ++ */ ++ ++ if (!ap_scoreboard_image || ++ ap_get_scoreboard_global()->running_generation == 0) { ++ ++ return OK; ++ } + } + + /* Setup module version information. */ diff --git a/mod_wsgi-3.4.tar.gz b/mod_wsgi-3.4.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c05dd0bdf3ce620d65772471e39b99bfe2d16f5f Binary files /dev/null and b/mod_wsgi-3.4.tar.gz differ diff --git a/mod_wsgi-4.5.20-exports.patch b/mod_wsgi-4.5.20-exports.patch deleted file mode 100644 index 276772eebfb6931bbf67daae57eef2a45dda7535..0000000000000000000000000000000000000000 --- a/mod_wsgi-4.5.20-exports.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- mod_wsgi-4.5.20/Makefile.in -+++ mod_wsgi-4.5.20/Makefile.in -@@ -28,7 +28,7 @@ - all : src/server/mod_wsgi.la - - src/server/mod_wsgi.la : $(SRCFILES) -- $(APXS) -c $(CPPFLAGS) $(CFLAGS) $(SRCFILES) $(LDFLAGS) $(LDLIBS) -+ $(APXS) -Wl,-export-symbols-regex -Wl,wsgi_module -c $(CPPFLAGS) $(CFLAGS) $(SRCFILES) $(LDFLAGS) $(LDLIBS) - - $(DESTDIR)$(LIBEXECDIR) : - mkdir -p $@ diff --git a/mod_wsgi-4.6.4.tar.gz b/mod_wsgi-4.6.4.tar.gz deleted file mode 100644 index f882d337fd4e9e8cdfbec0c6073b6673486b608c..0000000000000000000000000000000000000000 Binary files a/mod_wsgi-4.6.4.tar.gz and /dev/null differ diff --git a/mod_wsgi.spec b/mod_wsgi.spec index dcc6f06cc8a93545cdb1f85af91fde5c8b04e6c5..075155b841b48df3355fdacdb6307424157f62ea 100644 --- a/mod_wsgi.spec +++ b/mod_wsgi.spec @@ -1,23 +1,32 @@ %{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} %{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn 2>/dev/null || echo 0-0)}} %{!?_httpd_confdir: %{expand: %%global _httpd_confdir %%{_sysconfdir}/httpd/conf.d}} +# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4 %{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}} %{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} -%global sphinxbin %{_bindir}/sphinx-build-3 -Name: mod_wsgi -Version: 4.6.4 -Release: 2 -Summary: A WSGI interface for Python web applications in Apache -License: ASL 2.0 -URL: https://modwsgi.readthedocs.io/ -Source0: https://github.com/GrahamDumpleton/mod_wsgi/archive/%{version}.tar.gz#/mod_wsgi-%{version}.tar.gz -Source1: wsgi-python3.conf -Patch1: mod_wsgi-4.5.20-exports.patch -Patch2: Use-official-APIs-for-accessing-interpreter-list.patch -Patch3: Changed-functions-to-pre-post-actions-when-forking.patch -BuildRequires: httpd-devel gcc + +Name: mod_wsgi +Version: 3.4 +Release: 1 +Summary: A WSGI interface for Python web applications in Apache +Group: System Environment/Libraries +License: Apache-2.0 +URL: http://www.modwsgi.org +Source0: https://github.com/GrahamDumpleton/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: wsgi.conf +Patch0: mod_wsgi-3.4-connsbh.patch +Patch1: mod_wsgi-3.4-procexit.patch +Patch2: mod_wsgi-3.4-coredump.patch +Patch3: mod_wsgi-3.4-CVE-2014-0240.patch +Patch4: mod_wsgi-3.4-deadlock.patch +Patch5: mod_wsgi-3.4-restart-segfault.patch +Patch6: mod_wsgi-3.4-head-to-get.patch +BuildRequires: httpd-devel, python2-devel, autoconf + +# Suppress auto-provides for module DSO %{?filter_provides_in: %filter_provides_in %{_httpd_moddir}/.*\.so$} %{?filter_setup} + %description The mod_wsgi adapter is an Apache module that provides a WSGI compliant interface for hosting Python based web applications within Apache. The @@ -25,59 +34,63 @@ adapter is written completely in C code against the Apache C runtime and for hosting WSGI applications within Apache has a lower overhead than using existing WSGI adapters for mod_python or CGI. -%package -n python3-%{name} +%package -n python2-%{name} Summary: %summary -Requires: httpd-mmn = %{_httpd_mmn} -BuildRequires: python3-devel, python3-sphinx +BuildRequires: httpd-devel, python2-devel, autoconf +Requires: httpd-mmn = %{_httpd_mmn} Provides: mod_wsgi = %{version}-%{release} Provides: mod_wsgi%{?_isa} = %{version}-%{release} Obsoletes: mod_wsgi < %{version}-%{release} -%description -n python3-%{name} +%description -n python2-%{name} The mod_wsgi adapter is an Apache module that provides a WSGI compliant interface for hosting Python based web applications within Apache. The adapter is written completely in C code against the Apache C runtime and for hosting WSGI applications within Apache has a lower overhead than using existing WSGI adapters for mod_python or CGI. - %prep -%autosetup n %{name}-%{version} -p1 +%setup -q +%patch0 -p1 -b .connsbh +%patch1 -p1 -b .procexit +%patch2 -p1 -b .coredump +%patch3 -p1 -b .cve20140240 +%patch4 -p1 -b .deadlock +%patch5 -p1 -b .restartseg +%patch6 -p1 -b .headtoget %build -make -C docs html SPHINXBUILD=%{sphinxbin} +# Regenerate configure for -coredump patch change to configure.in +autoconf export LDFLAGS="$RPM_LD_FLAGS -L%{_libdir}" export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" -mkdir py3build/ -cp -R * py3build/ || : -pushd py3build -%configure --enable-shared --with-apxs=%{_httpd_apxs} --with-python=python3 +%configure --enable-shared --with-apxs=%{_httpd_apxs} make %{?_smp_mflags} -%py3_build -popd + %install -pushd py3build +rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir} -mv $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi{,_python3}.so + install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} -install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi-python3.conf +%if "%{_httpd_modconfdir}" == "%{_httpd_confdir}" +# httpd <= 2.2.x +install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_confdir}/wsgi.conf +%else +# httpd >= 2.4.x +install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi.conf +%endif + +%clean +rm -rf $RPM_BUILD_ROOT -%py3_install -mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express{,-3} -popd +%files -n python2-%{name} +%defattr(-,root,root,-) +%doc LICENCE README +%config(noreplace) %{_httpd_modconfdir}/*.conf +%{_httpd_moddir}/mod_wsgi.so -%files -n python3-%{name} -%license LICENSE -%doc CREDITS.rst README.rst -%config(noreplace) %{_httpd_modconfdir}/*wsgi-python3.conf -%{_httpd_moddir}/mod_wsgi_python3.so -%{python3_sitearch}/mod_wsgi-*.egg-info -%{python3_sitearch}/mod_wsgi -%{_bindir}/mod_wsgi-express-3 %changelog -* Sat Feb 27 2021 zhaorenhai - 4.6.4-2 -- Add configure file +* Tue Jun 08 2021 wangxiyuan +- Init 3.4 version -* Thu Nov 19 2020 huanghaitao - 4.6.4-1 -- package init diff --git a/wsgi-python3.conf b/wsgi-python3.conf deleted file mode 100644 index fcf1d271e66249467551f31df806965a829a0560..0000000000000000000000000000000000000000 --- a/wsgi-python3.conf +++ /dev/null @@ -1,7 +0,0 @@ -# NOTE: mod_wsgi_python3 can not coexist in the same apache process as -# mod_wsgi (python2). Only load if mod_wsgi is not already loaded. - - - LoadModule wsgi_module modules/mod_wsgi_python3.so - - diff --git a/wsgi.conf b/wsgi.conf new file mode 100644 index 0000000000000000000000000000000000000000..19f356756b9a652a3f737cf10f9bd3996c6b9430 --- /dev/null +++ b/wsgi.conf @@ -0,0 +1 @@ +LoadModule wsgi_module modules/mod_wsgi.so