Add "cgi.execute-x-only" to mod_cgi, requires +x for cgi scripts (fixes #2013)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2558 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.24
Stefan Bühler 14 years ago
parent b3ba9f0fb9
commit 3c11705903

@ -10,6 +10,7 @@ NEWS
* Keep url/host values from connection to display information while keep-alive in mod_status (fixes #1202)
* Add server.breakagelog, a "special" stderr (fixes #1863)
* Fix config evaluation for debug.log-timeouts option (#1529)
* Add "cgi.execute-x-only" to mod_cgi, requires +x for cgi scripts (fixes #2013)
- 1.4.23 - 2009-06-19
* Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)

@ -56,6 +56,7 @@ typedef struct {
typedef struct {
array *cgi;
unsigned short execute_x_only;
} plugin_config;
typedef struct {
@ -151,6 +152,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
config_values_t cv[] = {
{ "cgi.assign", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
{ "cgi.execute-x-only", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET}
};
@ -165,8 +167,10 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
assert(s);
s->cgi = array_init();
s->execute_x_only = 0;
cv[0].destination = s->cgi;
cv[1].destination = &(s->execute_x_only);
p->config_storage[i] = s;
@ -1196,6 +1200,8 @@ static int mod_cgi_patch_connection(server *srv, connection *con, plugin_data *p
if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.assign"))) {
PATCH(cgi);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("cgi.execute-x-only"))) {
PATCH(execute_x_only);
}
}
}
@ -1218,6 +1224,7 @@ URIHANDLER_FUNC(cgi_is_handled) {
if (HANDLER_ERROR == stat_cache_get_entry(srv, con, con->physical.path, &sce)) return HANDLER_GO_ON;
if (!S_ISREG(sce->st.st_mode)) return HANDLER_GO_ON;
if (p->conf.execute_x_only == 1 && (sce->st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) return HANDLER_GO_ON;
s_len = fn->used - 1;

Loading…
Cancel
Save