Commit Graph

2046 Commits (d2b7c7bad289359298235d595788b5952d222d2e)
 

Author SHA1 Message Date
Glenn Strauss d2b7c7bad2 remove excess initializers (fix compiler warnings) 7 years ago
Glenn Strauss ed3065cfb2 [CMake] fix clang -Wcast-align warnings in lemon.c 7 years ago
Glenn Strauss 177f5509bd [SCons] define with_geoip for SCons build 7 years ago
Glenn Strauss 9e6524fef5 [SCons] fix syntax error in SConstruct 7 years ago
Glenn Strauss 4ba57b2f67 [SCons] define with_krb5 for SCons build 7 years ago
Glenn Strauss e9ee22c204 [autobuild] skip two new tests if no fcgi-auth 7 years ago
Glenn Strauss 8576341df3 silence warnings from clang ccc-analyzer
rewrite some (generally correct) code for clang ccc-analyzer to be
able to recognize the patterns instead of issuing spurious warnings.
7 years ago
Glenn Strauss 1c1a63786e [mod_auth] mod_authn_gssapi Kerberos auth backend (fixes #1899)
module status: experimental; more testing and review needed

Kerberos library calls have been preserved from original patch set
and should be reviewed.

module has been quickly tested with Basic auth (Use over TLS!)

SPNEGO -has not- been tested.  Again, kerberos library calls have
been preserved from original patch set.  YMMV. (Use over TLS!)

x-ref:
  "Kerberos/GSSAPI Delegation Support"
  https://redmine.lighttpd.net/issues/1899
7 years ago
Glenn Strauss 7ba06c71a6 [mod_auth] structured data, register auth schemes
- parse auth.* directives into structured data during config processing
- register auth schemes (basic, digest, extern, ...) for extensibility
- remove auth.debug directive
7 years ago
Glenn Strauss 381aaae363 remove unused array type TYPE_COUNT data_count
(unused type, and very similar to TYPE_INTEGER data_integer,
 differing only in initial value and how dup inserts are merged)
7 years ago
Glenn Strauss 2b7e7fb0b2 [mod_deflate] fix longjmp clobber compiler warning
(workaround to avoid compiler warnings with and without --enable-mmap)
7 years ago
Glenn Strauss 20a2a0d2e3 remove unused sys-mmap.h from stat_cache.c 7 years ago
Glenn Strauss 2af88b2357 [autobuild] test_configfile might need vector.c (fixes #2752)
needed to build on Solaris using Oracle Solaris Studio (thx petrs)

x-ref:
  "vector_realloc missing when linking test_configfile"
  https://redmine.lighttpd.net/issues/2752
7 years ago
Glenn Strauss cb1a3c6299 backport mod_deflate to lighttpd 1.4 (fixes #1824, fixes #2753)
lots of fixes and improvements

limitations: see comments at top of mod_deflate.c

missing functionality: encode streaming response
  (module currently requires response be collected before being sent)

potential functionality: addition of compressed file cache would
  allow mod_deflate to fully supplant mod_compress in lighttpd 1.4.x

x-ref:
  "Adding mod_deflate to 1.4.xx"
  https://redmine.lighttpd.net/issues/1824
  "mod_deflate backport compile error if ENABLE_MMAP not defined"
  https://redmine.lighttpd.net/issues/2753

github: closes #67
7 years ago
Glenn Strauss 7b7350ee19 [mod_fastcgi] allow authorizer, responder for same path/ext (#321)
allow authorizer and responder to be configured for same path or ext

x-ref:
  "mod_fastcgi authorizers cannot protect fastcgi responders"
  https://redmine.lighttpd.net/issues/321
7 years ago
Glenn Strauss dc91e40657 dynamic handlers store debug flag in handler_ctx
(for persistence across multiple re-entries into routines upon
 receiving fdevent)

(setting module debug flag in global scope is still recommended
 since there are places where p->conf.debug is checked since
 handler_ctx might not be available at all points)
7 years ago
Christoph Kreutzer 7ef569b204 [tests] test coverage for issues (#321, #322)
FastCGI Authorizer support with FastCGI Responders

x-ref:
  "mod_fastcgi authorizers cannot protect fastcgi responders"
  http://redmine.lighttpd.net/issues/321

x-ref:
  "FastCGI Authorizer support for Variable-name variable passing"
  http://redmine.lighttpd.net/issues/322
7 years ago
Glenn Strauss 2dcfe1733e [mod_fastcgi] Authorizer support with Responder (fixes #321, fixes #322)
import Variable-* from FastCGI authorizer response into con->environment
restart request after FastCGI authorizer if no fastcgi.server docroot

(thx Christoph Kreutzer for initial patch attempt)

x-ref:
  "mod_fastcgi authorizers cannot protect fastcgi responders"
  http://redmine.lighttpd.net/issues/321

x-ref:
  "FastCGI Authorizer support for Variable-name variable passing"
  http://redmine.lighttpd.net/issues/322

github: closes #70
7 years ago
Glenn Strauss 5dfe21acc9 [mod_geoip] add to default build (fixes #2705, fixes #2101, fixes #2092, fixes #2025, fixes #1962, fixes #1938)
(add to default build to reduce distributor package maintenance)

x-ref:
  "broken module API since 1.4.38"
  https://redmine.lighttpd.net/issues/2705
  "lighttpd-1.4.24 fails to compile with mod_geoip.c"
  https://redmine.lighttpd.net/issues/2101
  "unsafe sprintfs mod_geoip"
  https://redmine.lighttpd.net/issues/2092
  "mod_geoip crashes lighttpd 1.5.x on FreeBSD 7.2 AMD64"
  https://redmine.lighttpd.net/issues/2025
  "mod_geoip"
  https://redmine.lighttpd.net/issues/1962
  "lighttpd 1.4 crashes on FreeBSD 7.0 AMD64 when mod_geoip compiled in"
  https://redmine.lighttpd.net/issues/1938
7 years ago
Glenn Strauss ab935a2b96 [mod_uploadprogress] add to default build
(module is distributed in Gentoo)
(add to default build to reduce distributor package maintenance)
7 years ago
Glenn Strauss b9f245f263 [mod_cgi] permit CGI exec of unreadable files (fixes #2374)
CGI target might be executable (+x), but not readable (-r)

x-ref:
  "lighttpd-1.4.29 cannot execute unreadable CGIs"
  https://redmine.lighttpd.net/issues/2374
7 years ago
Glenn Strauss ae91578895 [mod_auth] mod_authn_mysql.c MySQL auth backend (fixes #752, fixes #1845)
(automatically load mod_authn_mysql with mod_auth for compatibility with
 existing config usage via patches in various distros, e.g. FreeBSD)

x-ref:
  "mySQL auth"
  https://redmine.lighttpd.net/issues/752
  "MySQL Digest Authentication"
  https://redmine.lighttpd.net/issues/1845
7 years ago
Glenn Strauss 17b2a38721 [mod_auth] remove empty mod_auth.h 7 years ago
Glenn Strauss cde68b7b23 [mod_auth] http_auth_md5_hex2bin()
Note: http_auth_backend_t digest interface returns result as a
binary MD5 (16-bytes) so that caller consistently converts to
lowercase before using it in further digest calculation.

(Alternatively, the http_auth_backend_t digest interface could have
 taken a 33-char buffer and returned an explicitly lowercased hex str)
7 years ago
Glenn Strauss ede5ea2d83 fix mis-cast in unused code
For correctness, fix cast to (fdnode *) in #ifdef __WIN32 code.
(lighttpd compiles under cygwin, but not under native _WIN32)

(thx ToApolytoXaos)
7 years ago
Glenn Strauss 40f16d52db [core] fix crash if ready events on abandoned fd (fixes #2748)
x-ref:
  "1.4.40/1.4.41 uploads to CGI may cause crash (SIGABRT)"
  https://redmine.lighttpd.net/issues/2748
7 years ago
Glenn Strauss 3c24ec7393 [mod_auth] terminate salt for CRYPT-MD5-NTLM 7 years ago
Glenn Strauss 65efc2eda8 [mod_auth] support CRYPT-MD5-NTLM algorithm (fixes #1743)
(based on patch submitted in #1743)
(minimally tested using example in #1743 with password 'test')

x-ref:
  "[PATCH] Add support for CRYPT-MD5-NTLM"
  https://redmine.lighttpd.net/issues/1743
7 years ago
Glenn Strauss 9e7083582d [mod_auth] include base.h for USE_OPENSSL def 7 years ago
Glenn Strauss 6ec66c4dce [core] better DragonFlyBSD support (fixes #2746)
(thx xenu)

x-ref:
  "[PATCH] better DragonFlyBSD support; fix crash"
  https://redmine.lighttpd.net/issues/2746
7 years ago
Glenn Strauss b22269c2f3 [mod_auth] extensible interface for auth backends
Merge branch 'feature-auth-reorg' into gmaster
7 years ago
Glenn Strauss 4b3a91e64b [mod_auth] extensible interface for auth backends
create new, extensible interface for (additional) auth backends

attempt to handle HANDLER_WAIT_FOR_EVENT returned by auth backends
to allow for async auth backends (e.g. to mysql database)

separate auth backends from mod_auth and http_auth
  mod_authn_file.c htdigest, htpasswd, plain auth backends
  mod_authn_ldap.c ldap auth backend
add http_auth.c to common_sources for auth backend registration

(mod_authn_file could be three separate modules, but no need for now)
7 years ago
Glenn Strauss 3dcca966f4 [mod_auth] refactor out auth backend code
separate routines for each auth backend in http_auth.c,
move ldap backend init from mod_auth.c to http_auth.c
7 years ago
Glenn Strauss 81b2d1f020 [mod_auth] refactor out auth backend code
move basic and digest code into mod_auth.c,
and leave auth backend code in http_auth.c
7 years ago
Glenn Strauss 31250a9af8 [mod_auth] refactor out auth backend code
separate subroutines in http_auth.c
7 years ago
Glenn Strauss cb24958c01 [mod_auth] Digest auth fails after rewrite (fixes #2745)
(affects lighttpd 1.4.41)

x-ref:
  "HTTP digest + rewrite fails with: digest: auth failed: uri mismatch (1.4.41)"
  https://redmine.lighttpd.net/issues/2745
7 years ago
Glenn Strauss cfa3d27fc3 [mod_dirlisting] js column sort for dirlist table (fixes #613, fixes #2315)
copied javascript from mod_status and from lighttpd2 mod_dirlist

modified and specialized for stable dirlist sorting by name

Partial implementation of Apache autoindex request query arguments
  (https://httpd.apache.org/docs/current/en/mod/mod_autoindex.html)
If query string is supplied, allow specifying initial column to sort
  ?C=N name (default)
  ?C=M last-modified, then by name
  ?C=S size, then by name
  ?C=T type, then by name
  ?C=D type, then by name
and O=[AD] can be added for descending or ascending order, e.g.
  ?C=N&O=D descending (default)
  ?C=N&O=A ascending

(While functional, no effort was made on js performance.
 Patches welcome)

New directive dir-listing.external-js for user to replace sorting js

Note: dir-listing.external-js or default js sorting is enabled only
if dir-listing.auto-layout = "enable" (which is the default)

x-ref:
  "client-selectable directory list sorting"
  https://redmine.lighttpd.net/issues/613
  "dir-listing.external-js"
  https://redmine.lighttpd.net/issues/2315
7 years ago
Glenn Strauss 09a663b95b [mod_dirlisting] dirlist does not handle POST 7 years ago
Glenn Strauss 27f85dbdf4 [core] proxy,scgi omit shutdown() to backend (fixes #2743)
Due to the POLLHUP behavior triggered on *BSD/Darwin, the shutdown()
had previously been limited to local connections.  If interested in
squeezing the last bits of performance out of a machine, an admin
should configure local connections to be AF_UNIX instead of AF_INET
or AF_INET6 to localhost.  The reason the shutdown() was originally
added in mod_proxy and mod_scgi was to aggressively reduce the number
of potential sockets in TIME_WAIT held by lighttpd.
(See commit:923688d2 "drain backend socket/pipe bufs upon FDEVENT_HUP",
 done for reliability given the aforementioned *BSD/Darwin behavior.)
When using AF_UNIX, the TIME_WAIT issue does not exist, ergo, the
recommendation is to use AF_UNIX for local sockets, when available.
Using AF_UNIX sockets is a better solution to eliminate TIME_WAIT
than is TCP shutdown() half-close which, as we have seen, might not
be handled well by frameworks which are more complex than basic read
request, send response, and close.

x-ref:
  "1.4.40/41 mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin"
  https://redmine.lighttpd.net/issues/2743
7 years ago
Glenn Strauss 7e2090b96b [core] do not enter handler twice after read body
do not enter handler a second time in connection_state_machine()
after read body completes if dynamic handler is still waiting for event
and CON_STATE_READ_POST transitioned to CON_STATE_HANDLE_REQUEST
7 years ago
Glenn Strauss 666b9fd726 [core] enforce wait for POLLWR after EINPROGRESS (fixes #2744)
mod_fastcgi, mod_scgi, and mod_proxy must enforce wait for POLLWR
after EINPROGRESS or else getsockopt(fd, SOL_SOCKET, SO_ERROR, ...)
may succeed even though socket connection is not yet established,
and subsequent writev() will fail ENOTCONN.

(thx pkubaj)

x-ref:
 "1.4.40/41 writev failed: Socket is not connected (fastcgi,scgi,proxy)"
  https://redmine.lighttpd.net/issues/2744
7 years ago
Glenn Strauss 4bc06bfc0b [core] check if client half-closed TCP if POLLHUP (#2743)
Check if client half-closed TCP connection if POLLHUP is received.
This more robustly handles if client called shutdown(fd, SHUT_WR).

This patch reverts commit:ab05eb7c which should now be handled properly.
(Time will tell.)

x-ref:
  "1.4.40/41 mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin"
  https://redmine.lighttpd.net/issues/2743
7 years ago
Glenn Strauss 1de652f40b [mod_proxy,mod_scgi] shutdown remote only if local (#2743)
shutdown(fd, SHUT_WR) after sending request to proxy or SCGI
only if remote is local and platform is not *BSD or Darwin.

The reason this fix is special-casing *BSD and Darwin is that the Single
Unix Specification and POSIX.1-2013 clearly specify that POLLHUP event
should be returned by poll only when the stream is no longer writable.
A half-closed socket that is still writable clearly does not match that
condition, yet that is what I am seeing on Darwin (El Capitan), and
presumably what others are seeing on *BSD, from which Apple originally
inherited the Darwin TCP stack.

Single Unix Specification (SUSv2) from 1997
(yes, that is nearly 20 years ago):
http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.html

    POLLHUP
    The device has been disconnected. This event and POLLOUT are
    mutually exclusive; a stream can never be writable if a hangup has
    occurred. However, this event and POLLIN, POLLRDNORM, POLLRDBAND or
    POLLPRI are not mutually exclusive. This flag is only valid in the
    revents bitmask; it is ignored in the events member.

Updated version of The Open Group Base Specifications Issue 7
(published in 2013):
http://pubs.opengroup.org/onlinepubs/9699919799/

    POLLHUP
    A device has been disconnected, or a pipe or FIFO has been closed
    by the last process that had it open for writing. Once set, the
    hangup state of a FIFO shall persist until some process opens the
    FIFO for writing or until all read-only file descriptors for the
    FIFO are closed.  This event and POLLOUT are mutually-exclusive;
    a stream can never be writable if a hangup has occurred. However,
    this event and POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not
    mutually-exclusive. This flag is only valid in the revents bitmask;
    it shall be ignored in the events member.

x-ref:
  "1.4.40/41 mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin"
  https://redmine.lighttpd.net/issues/2743
7 years ago
Glenn Strauss 156bea3859 [TLS] SSL_shutdown() only if handshake finished
avoid noise in logs due to calling SSL_shutdown() on a connection
that has not yet completed TLS handshake
7 years ago
Glenn Strauss ccd817d3c9 - next is 1.4.42 7 years ago
Glenn Strauss 29fa805695 [doc] NEWS 7 years ago
Glenn Strauss fbae795dfa [cmake] set cmake_minimum_required to 2.8.2
CHECK_SYMBOL_EXISTS() is available in CMake >= 2.8.0
Clang is supported in CMake >= 2.8.2
7 years ago
Stefan Bühler 46b0e01217 [cmake] enable warnings for GCC and Clang
Also set -Wno-cast-align for lemon; lemon is only the parser generator, either
it crashes or it works.
7 years ago
Stefan Bühler f7b3745552 [cmake] always define _GNU_SOURCE
first.h only defines _GNU_SOURCE if no config.h is present.
7 years ago
Glenn Strauss 5863d05ec1 [security] encode quoting chars in HTML and XML
(affects mod_dirlisting, mod_ssi, mod_status)
7 years ago