1
0
mirror of https://github.com/apache/httpd.git synced 2025-11-11 02:42:23 +03:00
Commit Graph

233 Commits

Author SHA1 Message Date
Daniel Ruggeri
023e47cb2f Add helper function to execute command w args and get one line of output. Allow AuthLDAPBindPassword to have exec: argument like SSLPassPhraseDialog
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1433478 13f79535-47bb-0310-9956-ffa450edef68
2013-01-15 16:00:44 +00:00
Stefan Fritsch
40431c8d75 Add some caching for password hash validation.
Password hash functions must be expensive in order to be secure. But
if they have to be re-evaluated for every request, performance
suffers.

As a minimal remedy, cache the most recent result for every
connection. This gives a great performance boost if a web browser
does many requests on the same connection with the same
user+password.  In principle, this may keep the plain text password
around longer than before. But in practice, there won't be much
difference since user+password can already remain in some unused
data bucket for longer than the request duration.

A proper solution still needs to be found for connections from
proxies which may carry requests for many different users.

While it currently only requires the conn_rec, the new
ap_password_validate() function takes username and request_rec to
allow future extensions, like detection of brute-force attempts.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1427548 13f79535-47bb-0310-9956-ffa450edef68
2013-01-01 20:16:30 +00:00
Stefan Fritsch
f726113d33 Add an option to enforce stricter HTTP conformance
This is a first stab, the checks will likely have to be revised.
For now, we check

 * if the request line contains control characters
 * if the request uri has fragment or username/password
 * that the request method is standard or registered with RegisterHttpMethod
 * that the request protocol is of the form HTTP/[1-9]+.[0-9]+,
   or missing for 0.9
 * if there is garbage in the request line after the protocol
 * if any request header contains control characters
 * if any request header has an empty name
 * for the host name in the URL or Host header:
   - if an IPv4 dotted decimal address: Reject octal or hex values, require
     exactly four parts
   - if a DNS host name: Reject non-alphanumeric characters besides '.' and
     '-'. As a side effect, this rejects multiple Host headers.
 * if any response header contains control characters
 * if any response header has an empty name
 * that the Location response header (if present) has a valid scheme and is
   absolute

If we have a host name both from the URL and the Host header, we replace the
Host header with the value from the URL to enforce RFC conformance.

There is a log-only mode, but the loglevels of the logged messages need some
thought/work. Currently, the  checks for incoming data log for 'core' and the
checks for outgoing data log for 'http'. Maybe we need a way to configure the
loglevels separately from the core/http loglevels.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1426877 13f79535-47bb-0310-9956-ffa450edef68
2012-12-30 01:23:24 +00:00
Stefan Fritsch
91c6296f27 remove unnecessary cast
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1422712 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 23:16:55 +00:00
Stefan Fritsch
c39c61637e add new ap_bin2hex() utility function
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1422549 13f79535-47bb-0310-9956-ffa450edef68
2012-12-16 11:49:14 +00:00
Jeff Trawick
af3f141309 follow-up to r1389481: find/use getloadavg() prototype on Solaris
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1397716 13f79535-47bb-0310-9956-ffa450edef68
2012-10-12 20:22:33 +00:00
Jeff Trawick
24ec4aff0e follow up to r1390564: we just need scope, not control structure
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1397710 13f79535-47bb-0310-9956-ffa450edef68
2012-10-12 20:01:46 +00:00
Joe Orton
44cb002091 Extract some more data through the server load API:
* include/httpd.h (struct ap_sload_t): Add bytes_served, access_count
  fields.

* server/util.c (ap_get_sload): Fill in those fields.

Submitted by: Jan Kaluza <jkaluza redhat.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393338 13f79535-47bb-0310-9956-ffa450edef68
2012-10-03 08:20:50 +00:00
Jim Jagielski
ade3b53bb5 wrap var inits in the macro w/ a do-while.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1390564 13f79535-47bb-0310-9956-ffa450edef68
2012-09-26 15:28:27 +00:00
Jim Jagielski
b633191c6d More accurate counts of busy and ready/idle
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1390562 13f79535-47bb-0310-9956-ffa450edef68
2012-09-26 15:24:23 +00:00
Jim Jagielski
1722688cb3 Break out loadavg from Apache load.... one is quick, the other
isn't so much, and so why load things up when wanting just
the server loadavg?

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389564 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 20:50:58 +00:00
Jim Jagielski
1b69b60f1d minor name change, but I expect most will just want/need/use
the current load average, so simplify the name

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389506 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 18:17:50 +00:00
Jim Jagielski
1134cfb81d Would be nice to have some sort of canonical definition
of server loading for Apache. So create a struct that
holds some useful data. The hope is that for those
platforms that lack getloadavg(), people will write
replacements.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1389481 13f79535-47bb-0310-9956-ffa450edef68
2012-09-24 16:56:58 +00:00
Daniel Gruno
c5c6e82715 make the CT check in ap_parse_form_data case-insensitive
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1372419 13f79535-47bb-0310-9956-ffa450edef68
2012-08-13 13:37:15 +00:00
Daniel Gruno
62bdc76f18 Ditch the !, since that would result in the opposite of what was intended
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1372349 13f79535-47bb-0310-9956-ffa450edef68
2012-08-13 10:03:06 +00:00
Daniel Gruno
568fe20713 core: use a cheaper way of matching the content-type when parsing form data
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1372305 13f79535-47bb-0310-9956-ffa450edef68
2012-08-13 08:07:07 +00:00
Daniel Gruno
bdc02db4a3 core:
Be less strict when checking whether Content-Type is set to "application/x-www-form-urlencoded" 
when parsing POST data, or we risk losing data with an appended charset.

PR 53698
Reported by: Petter Berntsen < sluggr gmail.com >

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1372054 13f79535-47bb-0310-9956-ffa450edef68
2012-08-12 07:45:55 +00:00
Stefan Fritsch
0d77ab651b make varbuf functions treat AP_VARBUF_UNKNOWN consistently, improve docs
ap_varbuf_pdup(): copying the whole buffer in case strlen ==
AP_VARBUF_UNKNOWN does not make sense as the caller can not set
the exact buffer size, only a minimum. No API change as previously
the behavior with AP_VARBUF_UNKNOWN was undocumented.

regsub_core(): Checking for vb->buf is useless, it cannot be NULL
unless ap_varbuf_init has not been called.

ap_varbuf_cfg_getline(): Initially, allocate enough memory to hold
an empty line. If strlen == AP_VARBUF_UNKNOWN, use strlen(buf) instead
of undefined behavior.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1359884 13f79535-47bb-0310-9956-ffa450edef68
2012-07-10 20:19:03 +00:00
Stefan Fritsch
a1b0be3dcb Make ap_regcomp() return AP_REG_ESPACE if out of memory. Make ap_pregcomp()
abort if out of memory.

This raises the minimum PCRE requirement to version 6.0, released in 2005.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1343109 13f79535-47bb-0310-9956-ffa450edef68
2012-05-27 21:40:00 +00:00
Stefan Fritsch
4942a552fd Fix treatment of regex backreferences.
r904765 only made half of the necessary changes to remove the use
of '&' as an alias for '$0' and allow to escape any character with a
backslash.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1307067 13f79535-47bb-0310-9956-ffa450edef68
2012-03-29 19:24:04 +00:00
William A. Rowe Jr
2aa21a62b1 Clean up size_t abuse, part 2. ap_malloc/calloc/realloc are explicitly
excluded from this cleanup as they must be signature identical to the
clib functions, and although the definition of size_t has been flakey,
the definition of those functions appears to be generally clean since
ANSI C.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1228323 13f79535-47bb-0310-9956-ffa450edef68
2012-01-06 18:15:08 +00:00
Stefan Fritsch
91ce790cd3 Limit length of lines in .htaccess to 8K again, to reduce DoS potential.
Make ap_varbuf_cfg_getline() strictly enforce the max_len parameter.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1213338 13f79535-47bb-0310-9956-ffa450edef68
2011-12-12 17:50:33 +00:00
Stefan Fritsch
92e366007c Add lots of unique tags to error log messages
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1209766 13f79535-47bb-0310-9956-ffa450edef68
2011-12-02 23:02:04 +00:00
Stefan Fritsch
fd962221ea Fix integer overflow in ap_pregsub. This can be triggered e.g.
with mod_setenvif via a malicious .htaccess

CVE-2011-3607
http://www.halfdog.net/Security/2011/ApacheModSetEnvIfIntegerOverflow/


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1198940 13f79535-47bb-0310-9956-ffa450edef68
2011-11-07 21:13:40 +00:00
Stefan Fritsch
05eb254d1b No need to zero memory that we will overwrite anyway
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1198934 13f79535-47bb-0310-9956-ffa450edef68
2011-11-07 21:04:40 +00:00
Jim Jagielski
95ced96d65 Remove magic numbers; ensure that an invalid nmatch is corrected
tagged

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1194912 13f79535-47bb-0310-9956-ffa450edef68
2011-10-29 16:07:16 +00:00
Graham Leggett
b84938b043 mod_include: Add support for application/x-www-form-urlencoded encoding
and decoding.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1194870 13f79535-47bb-0310-9956-ffa450edef68
2011-10-29 11:13:37 +00:00
Stefan Fritsch
308d06fd8d Improve handling of maxlen = APR_SIZE_MAX, noticed by Jim.
Use apr_pregsub_ex() and maxlen = 0 for unlimited in mod_substitute.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1189985 13f79535-47bb-0310-9956-ffa450edef68
2011-10-27 20:15:36 +00:00
Stefan Fritsch
04ca93ecff Limit ap_pregsub() to 64K, add ap_pregsub_ex() for longer strings and with
better error reporting. Modify ap_varbuf_regsub() to be similar to
ap_pregsub_ex().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1188950 13f79535-47bb-0310-9956-ffa450edef68
2011-10-25 22:29:13 +00:00
Eric Covener
95457d4698 flip operator in comment for r1182887 and add some whitespace
to highlight the restriction on nmatch.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1183007 13f79535-47bb-0310-9956-ffa450edef68
2011-10-13 17:41:41 +00:00
Jim Jagielski
2632a97856 Force the honoring of AP_MAX_REG_MATCH
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1182887 13f79535-47bb-0310-9956-ffa450edef68
2011-10-13 14:49:39 +00:00
Stefan Fritsch
caf0908cf5 Shut up gcc/glibc warning about ignoring write()'s return value.
This may actually fix a real bug in case the error log is directed to a FIFO.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180334 13f79535-47bb-0310-9956-ffa450edef68
2011-10-08 07:54:31 +00:00
Stefan Fritsch
e1fc6f9d0c Some varbuf enhancements:
- Introduce new ap_varbuf_pdup() and ap_varbuf_regsub() functions.
- Fix some bugs in ap_varbuf_strmemcat().
- Make ap_varbuf.buf point to an empty string if no buffer has been allocated,
  yet.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1176018 13f79535-47bb-0310-9956-ffa450edef68
2011-09-26 20:05:09 +00:00
Jim Jagielski
427c85bd23 Cleanup effort in prep for GA push:
Trim trailing whitespace... no func change



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1174751 13f79535-47bb-0310-9956-ffa450edef68
2011-09-23 13:39:32 +00:00
Stefan Fritsch
01ed21af9d Add wrappers for malloc, calloc, realloc that check for out of memory
situations.  Use them in most places where malloc, and friends are used.
This results in clean error messages in an out of memory situation instead of
segfaulting or silently malfunctioning. In some places, it just allows to
remove some logging code.

PR 51568, PR 51569, PR 51571.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172686 13f79535-47bb-0310-9956-ffa450edef68
2011-09-19 16:25:42 +00:00
Eric Covener
f868cec39b Give a slightly more direct hint when no global ServerName is set. I still
think this buries the lead, but it's hard to rewrite to change the emphasis
yet maintain googleability.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1172410 13f79535-47bb-0310-9956-ffa450edef68
2011-09-19 01:36:39 +00:00
Stefan Fritsch
84a104bb22 Add ap_varbuf API for resizable buffers.
Increase length limit of lines in the configuration file to 16MB.
Increase length limit of lines in the group file to 16MB.

PR: 45888, 50824, 43084

Windows and Netware build changes are untested.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1157354 13f79535-47bb-0310-9956-ffa450edef68
2011-08-13 09:06:35 +00:00
Stefan Fritsch
51692222f6 Various code cleanup
PR: 51398
Submitted by: Christophe Jaillet <christophe jaillet wanadoo fr>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138627 13f79535-47bb-0310-9956-ffa450edef68
2011-06-22 20:45:34 +00:00
Stefan Fritsch
255f723fef We already have ap_str_tolower(), so also add ap_str_toupper() function and use
it where possible.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1138617 13f79535-47bb-0310-9956-ffa450edef68
2011-06-22 20:24:27 +00:00
Stefan Fritsch
c9fd2623da Introduce ap_(get|set)_core_module_config() functions/macros and use them
everywhere.

We know that the core module has module_index 0. Therefore we can save
some pointer operations in ap_get_module_config(cv, &core_module) and
ap_set_module_config(cv, &core_module, val). As these are called rather often,
this may actually have some (small) measurable effect.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1132781 13f79535-47bb-0310-9956-ffa450edef68
2011-06-06 21:26:56 +00:00
Stefan Fritsch
7b61bedb2f Change the ap_cfg_getline() and ap_cfg_getc() to return an error code.
Also:
- Make ap_cfg_getline() return APR_ENOSPC if a config line is too long.
- Add ap_pcfg_strerror() function to convert ap_cfg_getline's return value
  into a nice message.
- Adjust definition of ap_configfile_t accordingly.

Not bumping MMN because it has already been bumped today.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1086756 13f79535-47bb-0310-9956-ffa450edef68
2011-03-29 21:29:34 +00:00
Daniel Earl Poirier
fdaaf209c5 core: AllowEncodedSlashes new option NoDecode to allow encoded slashes
in request URL path info but not decode them. Change behavior of option
"On" to decode the encoded slashes as 2.0 and 2.2 do.  PR 35256,
PR 46830.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1082196 13f79535-47bb-0310-9956-ffa450edef68
2011-03-16 16:45:25 +00:00
Jim Jagielski
ec88a92d83 Expose "new" ap_parse_form_data() function instead of requiring
mod_request for any module that may want to parse form data...

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1072099 13f79535-47bb-0310-9956-ffa450edef68
2011-02-18 18:40:31 +00:00
Stefan Fritsch
6e108fd44f Make ap_pstr2_alnum accept const char dest
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1061695 13f79535-47bb-0310-9956-ffa450edef68
2011-01-21 09:03:52 +00:00
Stefan Fritsch
58f17628ac Move ap_resolve_env to core.c, in preparation for adding mod_define-like
variable support.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1061444 13f79535-47bb-0310-9956-ffa450edef68
2011-01-20 18:37:47 +00:00
Stefan Fritsch
4092815c5c Fix compile error
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1060996 13f79535-47bb-0310-9956-ffa450edef68
2011-01-19 21:23:34 +00:00
Jim Jagielski
334ae2f5a2 Make it clear that '_' is a possible char and accepted
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1060802 13f79535-47bb-0310-9956-ffa450edef68
2011-01-19 13:08:08 +00:00
Jim Jagielski
a713db09d4 Make the balancer shared memory slot more human readable. But we need
to make it a "safe" filename, so create 2 funcs which do that.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1060657 13f79535-47bb-0310-9956-ffa450edef68
2011-01-19 02:41:49 +00:00
Stefan Fritsch
cf0e2c3a46 Fix some Windows build issues
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039204 13f79535-47bb-0310-9956-ffa450edef68
2010-11-25 22:27:17 +00:00
Stefan Fritsch
e32977e84f Another ooops: properly return APR_SUCCESS
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032169 13f79535-47bb-0310-9956-ffa450edef68
2010-11-06 22:16:25 +00:00