Bug #2465

"ERROR: docroot is required for authorizer mode" although docroot is specified

Added by peex almost 2 years ago. Updated almost 2 years ago.

Status:FixedStart date:2013-01-04
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:mod_fastcgi
Target version:1.4.33
Missing in 1.5.x:No

Description

Bug description

I have tried out a mod_fastcgi configuration that included an FastCGI Authorizer. Various Ubuntu- and Debian-packages and also the current tarball of lighttpd gave this error:

2012-12-28 03:39:10: (log.c.166) server started
2012-12-28 03:39:10: (mod_fastcgi.c.1439) ERROR: docroot is required for authorizer mode.
2012-12-28 03:39:10: (server.c.938) Configuration of plugins failed. Going down.

After three days of fuddling, trying different variations, reading the mod_fastcgi documentation over and over again and searching the web all I found was this: http://redmine.lighttpd.net/boards/2/topics/3160 (unsolved).
I could not find any hint what could be wrong about my configuration so I suspected the config parser or mod_fastcgi of misinterpreting the configuration, although this seemed very unlikely on the other hand...

Cause & Solution

Out of desperation and just to be sure I dug into the parser and mod_fastcgi sources. Finally I found the cause: mod_fastcgi initializes the fcgi_mode buffer once with an empty value, which defaults to "responder". But as soon as one section in the configuration explicitly sets a mode, this buffer is overwritten and will not be reset. So as soon as one section in the config sets the "authoritzer" mode, this mode is assumed as default for every following section, too.

I will append a patch that solves this problem.

Workarounds

  1. Explicitly set "mode" for all sections (at least for them following an authorizer section)
  2. Ensure that no responder sections follow an authorizer in the config

Workaround hint for Ubuntu/Debian

If PHP is installed and activated for lighttpd by default there are three config files that are relevant for FastCGI:
  • /etc/lighttpd/lighttpd.conf - main config that also loads all configs from /etc/lighttpd/conf-enabled
  • /etc/lighttpd/conf-enabled/10-fastcgi.conf - general mod_fastcgi config
  • /etc/lighttpd/conf-enabled/15-fastcgi-php.conf - activate php as FastCGI responder

mod_fastcgi.c.diff Magnifier - Patch ("diff -u" output) (1004 Bytes) peex, 2013-01-04 04:05

Associated revisions

Revision 2864
Added by stbuehler almost 2 years ago

mod_fastcgi: fix mix up of "mode" => "authorizer" in other fastcgi configs (fixes #2465, thx peex)

History

#1 Updated by stbuehler almost 2 years ago

  • Target version set to 1.4.33

Thx, good catch.

Just one correction for your Workaround section: the order you put things into the config isn't always the order lighttpd interprets it in. use lighttpd -p to see the internal order.

Also I'm going to use a different patch; i think buffer_reset(fcgi_mode) each round should be good enough.

#2 Updated by stbuehler almost 2 years ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Applied in changeset r2864.

#3 Updated by peex almost 2 years ago

Thanks for the fix and the notice about the internal order.

Also available in: Atom