Changeset 1871
- Timestamp:
- 06/15/2007 02:46:17 PM (15 months ago)
- Location:
- branches/lighttpd-1.4.x
- Files:
-
- 1 added
- 4 modified
-
src/mod_access.c (modified) (4 diffs)
-
tests/docroot/www/Makefile.am (modified) (1 diff)
-
tests/docroot/www/index.html~ (added)
-
tests/mod-access.t (modified) (2 diffs)
-
tests/prepare.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/lighttpd-1.4.x/src/mod_access.c
r1371 r1871 112 112 #undef PATCH 113 113 114 /** 115 * URI handler 116 * 117 * we will get called twice: 118 * - after the clean up of the URL and 119 * - after the pathinfo checks are done 120 * 121 * this handles the issue of trailing slashes 122 */ 114 123 URIHANDLER_FUNC(mod_access_uri_handler) { 115 124 plugin_data *p = p_d; … … 123 132 s_len = con->uri.path->used - 1; 124 133 134 if (con->conf.log_request_handling) { 135 log_error_write(srv, __FILE__, __LINE__, "s", 136 "-- mod_access_uri_handler called"); 137 } 138 125 139 for (k = 0; k < p->conf.access_deny->used; k++) { 126 140 data_string *ds = (data_string *)p->conf.access_deny->data[k]; 127 141 int ct_len = ds->value->used - 1; 142 int denied = 0; 143 128 144 129 145 if (ct_len > s_len) continue; 130 131 146 if (ds->value->used == 0) continue; 132 147 … … 135 150 if (con->conf.force_lowercase_filenames) { 136 151 if (0 == strncasecmp(con->uri.path->ptr + s_len - ct_len, ds->value->ptr, ct_len)) { 137 con->http_status = 403; 138 139 return HANDLER_FINISHED; 152 denied = 1; 140 153 } 141 154 } else { 142 155 if (0 == strncmp(con->uri.path->ptr + s_len - ct_len, ds->value->ptr, ct_len)) { 143 con->http_status = 403; 156 denied = 1; 157 } 158 } 144 159 145 return HANDLER_FINISHED; 160 if (denied) { 161 con->http_status = 403; 162 163 if (con->conf.log_request_handling) { 164 log_error_write(srv, __FILE__, __LINE__, "sb", 165 "url denied as we match:", ds->value); 146 166 } 167 168 return HANDLER_FINISHED; 147 169 } 148 170 } … … 159 181 p->init = mod_access_init; 160 182 p->set_defaults = mod_access_set_defaults; 161 p->handle_uri_clean = mod_access_uri_handler; 183 p->handle_uri_clean = mod_access_uri_handler; 184 p->handle_subrequest_start = mod_access_uri_handler; 162 185 p->cleanup = mod_access_free; 163 186 -
branches/lighttpd-1.4.x/tests/docroot/www/Makefile.am
r1374 r1871 2 2 redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \ 3 3 nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \ 4 exec-date.shtml 4 exec-date.shtml index.html~ 5 5 SUBDIRS=go indexfile expire -
branches/lighttpd-1.4.x/tests/mod-access.t
r1374 r1871 9 9 use strict; 10 10 use IO::Socket; 11 use Test::More tests => 3;11 use Test::More tests => 4; 12 12 use LightyTest; 13 13 … … 24 24 ok($tf->handle_http($t) == 0, 'forbid access to ...~'); 25 25 26 $t->{REQUEST} = ( <<EOF 27 GET /index.html~/ HTTP/1.0 28 EOF 29 ); 30 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; 31 ok($tf->handle_http($t) == 0, '#1230 - forbid access to ...~ - trailing slash'); 32 26 33 ok($tf->stop_proc == 0, "Stopping lighttpd"); 27 34 -
branches/lighttpd-1.4.x/tests/prepare.sh
r1374 r1871 26 26 cp $srcdir/docroot/www/*.html \ 27 27 $srcdir/docroot/www/*.php \ 28 $srcdir/docroot/www/*.html~ \ 28 29 $srcdir/docroot/www/*.pl \ 29 30 $srcdir/docroot/www/*.fcgi \

