Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 577868 Details for
Bug 812398
Add the ability to enable hash randomization in mod_wsgi apps
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
A patch that adds a WSGIPythonHashSeed configuration option to mod_wsgi
mod_wsgi-hash-seed.patch (text/plain), 3.57 KB, created by
Luke Macken
on 2012-04-17 02:37:14 UTC
(
hide
)
Description:
A patch that adds a WSGIPythonHashSeed configuration option to mod_wsgi
Filename:
MIME Type:
Creator:
Luke Macken
Created:
2012-04-17 02:37:14 UTC
Size:
3.57 KB
patch
obsolete
>--- mod_wsgi.c.orig 2012-04-16 19:24:08.671074746 -0400 >+++ mod_wsgi.c 2012-04-16 22:07:21.204504425 -0400 >@@ -457,6 +457,7 @@ > const char *python_home; > const char *python_path; > const char *python_eggs; >+ const char *python_hash_seed; > > int restrict_embedded; > int restrict_stdin; >@@ -526,6 +527,7 @@ > object->python_home = NULL; > object->python_path = NULL; > object->python_eggs = NULL; >+ object->python_hash_seed = NULL; > > object->restrict_embedded = -1; > object->restrict_stdin = -1; >@@ -4750,6 +4752,32 @@ > } > } > >+ if (wsgi_server_config->python_hash_seed != NULL) { >+ module = PyImport_ImportModule("os"); >+ >+ if (module) { >+ PyObject *dict = NULL; >+ PyObject *key = NULL; >+ >+ dict = PyModule_GetDict(module); >+ object = PyDict_GetItemString(dict, "environ"); >+ >+ if (object) { >+#if PY_MAJOR_VERSION >= 3 >+ key = PyUnicode_FromString("PYTHONHASHSEED"); >+#else >+ key = PyString_FromString("PYTHONHASHSEED"); >+#endif >+ >+ PyObject_DelItem(object, key); >+ >+ Py_DECREF(key); >+ } >+ >+ Py_DECREF(module); >+ } >+ } >+ > /* > * Install user defined Python module search path. This is > * added using site.addsitedir() so that any Python .pth >@@ -5810,6 +5838,14 @@ > _wputenv(L"PYTHONIOENCODING=cp1252:backslashreplace"); > #endif > >+ if (wsgi_server_config->python_hash_seed != NULL) { >+#if defined(WIN32) >+ _putenv_s("PYTHONHASHSEED", wsgi_server_config->python_hash_seed); >+#else >+ setenv("PYTHONHASHSEED", wsgi_server_config->python_hash_seed, 1); >+#endif >+ } >+ > /* Initialise Python. */ > > ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), wsgi_server, >@@ -5827,6 +5863,10 @@ > > wsgi_python_initialized = 1; > >+ if (wsgi_server_config->python_hash_seed != NULL) { >+ unsetenv("PYTHONHASHSEED"); >+ } >+ > /* > * Register cleanups to be performed on parent restart > * or shutdown. This will destroy Python itself. >@@ -7235,6 +7275,22 @@ > return NULL; > } > >+static const char *wsgi_set_python_hash_seed(cmd_parms *cmd, void *mconfig, >+ const char *f) >+{ >+ const char *error = NULL; >+ WSGIServerConfig *sconfig = NULL; >+ >+ error = ap_check_cmd_context(cmd, GLOBAL_ONLY); >+ if (error != NULL) >+ return error; >+ >+ sconfig = ap_get_module_config(cmd->server->module_config, &wsgi_module); >+ sconfig->python_hash_seed = f; >+ >+ return NULL; >+} >+ > static const char *wsgi_set_restrict_embedded(cmd_parms *cmd, void *mconfig, > const char *f) > { >@@ -9204,6 +9260,8 @@ > RSRC_CONF, TAKE1, "Python module search path." }, > { "WSGIPythonEggs", wsgi_set_python_eggs, NULL, > RSRC_CONF, TAKE1, "Python eggs cache directory." }, >+ { "WSGIPythonHashSeed", wsgi_set_python_hash_seed, NULL, >+ RSRC_CONF, TAKE1, "Python hash seed." }, > > { "WSGIRestrictStdin", wsgi_set_restrict_stdin, NULL, > RSRC_CONF, TAKE1, "Enable/Disable restrictions on use of STDIN." }, >@@ -14890,6 +14948,8 @@ > NULL, RSRC_CONF, "Python module search path."), > AP_INIT_TAKE1("WSGIPythonEggs", wsgi_set_python_eggs, > NULL, RSRC_CONF, "Python eggs cache directory."), >+ AP_INIT_RAW_ARGS("WSGIPythonHashSeed", wsgi_set_python_hash_seed, >+ NULL, RSRC_CONF, "Python hash seed."), > > #if defined(MOD_WSGI_WITH_DAEMONS) > AP_INIT_TAKE1("WSGIRestrictEmbedded", wsgi_set_restrict_embedded,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 812398
:
577865
| 577868