NetBSD Problem Report #52194

From martin@aprisoft.de  Tue Apr 25 09:41:21 2017
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 670107A111
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 25 Apr 2017 09:41:21 +0000 (UTC)
Message-Id: <20170425094109.754FE5CC762@emmas.aprisoft.de>
Date: Tue, 25 Apr 2017 11:41:09 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: httpd fails to exec cgi scripts outside of cgi-bin
X-Send-Pr-Version: 3.95

>Number:         52194
>Category:       bin
>Synopsis:       httpd fails to exec cgi scripts outside of cgi-bin
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 25 09:45:00 +0000 2017
>Closed-Date:    Fri Aug 24 11:39:41 +0000 2018
>Last-Modified:  Sat Nov 24 17:25:06 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 7.1
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD emmas.aprisoft.de 7.1 NetBSD 7.1 (EMMAS) #6: Tue Mar 14 16:38:26 CET 2017 martin@emmas.aprisoft.de:/var/nbsd/src-7/sys/arch/i386/compile/EMMAS i386
Architecture: i386
Machine: i386
>Description:

When invoked with "-C .pl /usr/pkg/bin/perl", httpd should run cgi scripts
that match the .pl suffix in the document tree.

This fails for me in 7.1 with an EFAULT from execvpe() of the interpreter.
Even with the patch below, it still does not work (not sure if argv for the
interpreter is correctly constructed, and -d does not seem to work)

>How-To-Repeat:
n/a

>Fix:
Not sure if this is the right way:

Index: cgi-bozo.c
===================================================================
RCS file: /cvsroot/src/libexec/httpd/cgi-bozo.c,v
retrieving revision 1.25.2.7
diff -u -p -r1.25.2.7 cgi-bozo.c
--- cgi-bozo.c	12 Feb 2017 22:07:17 -0000	1.25.2.7
+++ cgi-bozo.c	25 Apr 2017 09:35:34 -0000
@@ -587,6 +587,8 @@ bozo_process_cgi(bozo_httpreq_t *request
 		bozoerr(httpd, 1, "child socketpair failed: %s",
 				strerror(errno));

+	*curenvp = 0; 
+
 	/*
 	 * We create 2 procs: one to become the CGI, one read from
 	 * the CGI and output to the network, and this parent will

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/52194: httpd fails to exec cgi scripts outside of cgi-bin
Date: Wed, 26 Apr 2017 14:47:11 +0200

 Here is a simple method to reproduce it in -current as well.
 Extract below shar in a temp dir and then run the included ./dotest script.

 It will leave a background httpd and /bin/sh process around.

 Martin

 # This is a shell archive.  Save it in a file, remove anything before
 # this line, and then unpack it by entering "sh file".  Note, it may
 # create directories; files and directories will be owned by you and
 # have default permissions.
 #
 # This archive contains:
 #
 #	demo.sh
 #	dotest
 #	req
 #
 echo x - demo.sh
 sed 's/^X//' >demo.sh << 'END-of-demo.sh'
 X#! /bin/sh
 X
 Xprintf "Content-Type: plain/text\n\n"
 X
 Xprintf "Command line args:\n"
 Xecho *
 X
 Xprintf "\nEnvironment:\n"
 Xenv
 END-of-demo.sh
 echo x - dotest
 sed 's/^X//' >dotest << 'END-of-dotest'
 X#! /bin/sh
 X
 Xexec /usr/libexec/httpd -d -d -d -d -d -d -s -C .sh /bin/sh . www.test.com < req > resp
 END-of-dotest
 echo x - req
 sed 's/^X//' >req << 'END-of-req'
 XGET /demo.sh HTTP/1.1
 XHost: www.test.com
 END-of-req
 exit


From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/52194: httpd fails to exec cgi scripts outside of cgi-bin
Date: Wed, 26 Apr 2017 15:18:12 +0200

 --pf9I7BMVVzbSWLtt
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 Here is a patch that seems to fix the issue for me. I increased the
 number of environment string pointers allocated to enforce a NULL termination.
 The other change adds the script name as argv[1] to the interpreter invocation
 if not running in /cgi-bin/ where the files are supposedly self-executable.

 Its not clear to me if the addeded strdup() causes a memory leak.

 Martin

 --pf9I7BMVVzbSWLtt
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch

 Index: cgi-bozo.c
 ===================================================================
 RCS file: /cvsroot/src/libexec/httpd/cgi-bozo.c,v
 retrieving revision 1.37
 diff -u -p -r1.37 cgi-bozo.c
 --- cgi-bozo.c	31 Jan 2017 14:36:09 -0000	1.37
 +++ cgi-bozo.c	26 Apr 2017 13:15:05 -0000
 @@ -456,6 +456,8 @@ bozo_process_cgi(bozo_httpreq_t *request
  		    "search_string[%zu]: `%s'", i, search_string_argv[i]));
  	}

 +	debug((httpd, DEBUG_FAT, "allocating %zu argv pointers",
 +	    3 + search_string_argc));
  	argv = bozomalloc(httpd, sizeof(*argv) * (3 + search_string_argc));

  	ix = 0;
 @@ -476,6 +478,9 @@ bozo_process_cgi(bozo_httpreq_t *request
  	}

  	argv[ix++] = path;
 +	if (cgihandler) {
 +		argv[ix++] = bozostrdup(httpd, request, command);
 +	}

  	/* copy search-string args */
  	for (i = 0; i < search_string_argc; i++)
 @@ -487,7 +492,7 @@ bozo_process_cgi(bozo_httpreq_t *request
  	type = request->hr_content_type;
  	clen = request->hr_content_length;

 -	envpsize = 13 + request->hr_nheaders + 
 +	envpsize = 14 + request->hr_nheaders + 
  	    (info && *info ? 1 : 0) +
  	    (query && *query ? 1 : 0) +
  	    (type && *type ? 1 : 0) +

 --pf9I7BMVVzbSWLtt--

Responsible-Changed-From-To: bin-bug-people->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sun, 09 Jul 2017 10:55:27 +0000
Responsible-Changed-Why:
I'll handle it


State-Changed-From-To: open->analyzed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 09 Jul 2017 10:55:27 +0000
State-Changed-Why:
There is nothing wrong wiht httpd, but script interpreters it can execute
have to be able to figure out their script themselves from the CGI
environment.
While it might be possible to slightly improve this situation, Mateusz
and I agreed to make this a documentation change only.


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: src/libexec/httpd
Date: Tue, 28 Nov 2017 10:33:52 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Tue Nov 28 10:33:51 UTC 2017

 Modified Files:
 	src/libexec/httpd: cgi-bozo.c

 Log Message:
 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.


 To generate a diff of this commit:
 cvs rdiff -u -r1.38 -r1.39 src/libexec/httpd/cgi-bozo.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: src/libexec/httpd
Date: Tue, 28 Nov 2017 12:22:27 +0000

 Module Name:	src
 Committed By:	wiz
 Date:		Tue Nov 28 12:22:27 UTC 2017

 Modified Files:
 	src/libexec/httpd: bozohttpd.8

 Log Message:
 Document script handler issues with httpd(8).
 From martin@, addressing PR 52194.

 While here, use American spelling consistently and upper-case some
 abbreviations.

 Bump date.


 To generate a diff of this commit:
 cvs rdiff -u -r1.67 -r1.68 src/libexec/httpd/bozohttpd.8

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-8] src/libexec/httpd
Date: Mon, 4 Dec 2017 19:44:13 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Mon Dec  4 19:44:13 UTC 2017

 Modified Files:
 	src/libexec/httpd [netbsd-8]: cgi-bozo.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #409):
 	libexec/httpd/cgi-bozo.c: revision 1.39
 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.


 To generate a diff of this commit:
 cvs rdiff -u -r1.37 -r1.37.4.1 src/libexec/httpd/cgi-bozo.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-7-0] src/libexec/httpd
Date: Wed, 3 Jan 2018 20:30:06 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan  3 20:30:06 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-7-0]: cgi-bozo.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #1533):
 	libexec/httpd/cgi-bozo.c: revision 1.39
 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.


 To generate a diff of this commit:
 cvs rdiff -u -r1.25.2.2.2.4 -r1.25.2.2.2.5 src/libexec/httpd/cgi-bozo.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-7-1] src/libexec/httpd
Date: Wed, 3 Jan 2018 20:30:08 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan  3 20:30:08 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-7-1]: cgi-bozo.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #1533):
 	libexec/httpd/cgi-bozo.c: revision 1.39
 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.


 To generate a diff of this commit:
 cvs rdiff -u -r1.25.2.7 -r1.25.2.7.2.1 src/libexec/httpd/cgi-bozo.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-7] src/libexec/httpd
Date: Wed, 3 Jan 2018 20:30:10 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan  3 20:30:10 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-7]: cgi-bozo.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #1533):
 	libexec/httpd/cgi-bozo.c: revision 1.39
 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.


 To generate a diff of this commit:
 cvs rdiff -u -r1.25.2.7 -r1.25.2.8 src/libexec/httpd/cgi-bozo.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 24 Aug 2018 11:39:41 +0000
State-Changed-Why:
Fixed and pulled up


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-8] src/libexec/httpd
Date: Sat, 24 Nov 2018 17:13:51 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov 24 17:13:51 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-8]: CHANGES auth-bozo.c bozohttpd.8
 	    bozohttpd.c bozohttpd.h cgi-bozo.c content-bozo.c daemon-bozo.c
 	    dir-index-bozo.c main.c ssl-bozo.c tilde-luzah-bozo.c
 	src/libexec/httpd/lua [netbsd-8]: bozo.lua glue.c optparse.lua
 	src/libexec/httpd/testsuite [netbsd-8]: Makefile html_cmp t3.out t5.out
 	    t6.out test-bigfile test-simple
 Added Files:
 	src/libexec/httpd/testsuite [netbsd-8]: t12.in t12.out t13.in t13.out
 	    t14.in t14.out t15.in t15.out
 	src/libexec/httpd/testsuite/data [netbsd-8]: .bzremap

 Log Message:
 Sync to HEAD (requested by mrg in ticket #1104)

 	libexec/httpd/testsuite/data/.bzremap           up to 1.1
 	libexec/httpd/testsuite/t12.out                 up to 1.1
 	libexec/httpd/testsuite/t12.in                  up to 1.1
 	libexec/httpd/testsuite/t13.out                 up to 1.1
 	libexec/httpd/testsuite/t13.in                  up to 1.1
 	libexec/httpd/testsuite/t14.out                 up to 1.1
 	libexec/httpd/testsuite/t14.in                  up to 1.1
 	libexec/httpd/testsuite/t15.out                 up to 1.1
 	libexec/httpd/testsuite/t15.in                  up to 1.1
 	libexec/httpd/CHANGES                           up to 1.28
 	libexec/httpd/auth-bozo.c                       up to 1.22
 	libexec/httpd/bozohttpd.8                       up to 1.74
 	libexec/httpd/bozohttpd.c                       up to 1.96
 	libexec/httpd/bozohttpd.h                       up to 1.56
 	libexec/httpd/cgi-bozo.c                        up to 1.44
 	libexec/httpd/content-bozo.c                    up to 1.16
 	libexec/httpd/daemon-bozo.c                     up to 1.19
 	libexec/httpd/dir-index-bozo.c                  up to 1.28
 	libexec/httpd/main.c                            up to 1.21
 	libexec/httpd/ssl-bozo.c                        up to 1.25
 	libexec/httpd/tilde-luzah-bozo.c                up to 1.16
 	libexec/httpd/lua/bozo.lua                      up to 1.3
 	libexec/httpd/lua/glue.c                        up to 1.5
 	libexec/httpd/lua/optparse.lua                  up to 1.2
 	libexec/httpd/testsuite/Makefile                up to 1.11
 	libexec/httpd/testsuite/html_cmp                up to 1.6
 	libexec/httpd/testsuite/t3.out                  up to 1.4
 	libexec/httpd/testsuite/t5.out                  up to 1.4
 	libexec/httpd/testsuite/t6.out                  up to 1.4
 	libexec/httpd/testsuite/test-bigfile            up to 1.5
 	libexec/httpd/testsuite/test-simple             up to 1.5

 Cosmetic changes to Lua binding in bozohttpd.

 - Don't use negative indicies to read arguments of Lua functions.
 - On error, return nil, "error string".
 - Use ssize_t for return values from bozo_read() and bozo_write().
 - Prefer lstring especially when if saves you from appending NUL and
   doing len + 1 which can potentially wraparound.
 - Don't mix C allocations with Lua functions marked with "m" in the Lua
   manual. Those functions may throw (longjump) and leak data allocated
   by C function. In one case, I use luaL_Buffer, in the other case,
   I rearranged calls a bit.

 fix ordering of a couple of words.  from Edgar Pettijohn in PR#52375.
 thanks!

 s/u_int/unsigned/.

 from Jan Danielsson.  increases/fixes portability.

 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.

 Document script handler issues with httpd(8).
 From martin@, addressing PR 52194.

 While here, use American spelling consistently and upper-case some
 abbreviations.

 Bump date.

 fix output since protocol agnostic change went in.

 XXX: i thought someone hooked this into atf already, please do :)

 Add support for remapping requested paths via a .bzredirect file.
 Fixes PR 52772. Ok: mrg@

 Bump date

 Remove trailing whitespace.

 use __func__ in debug().

 fix a denial of service attack against header contents, which
 is now bounded at 16KiB.  reported by JP.

 avoid memory leak in sending multiple auth headers.
 mostly mitigated by previous patch to limit total header size,
 but still a real problem here.

 note the changes present in bozohttpd 20181118:

 o  add url remap support via .bzremap file, from martin%netbsd.org@localhost
 o  handle redirections for any protocol, not just http:
 o  fix a denial of service attack against header contents, which
    is now bounded at 16KiB.  reported by JP.

 from CHANGES:

 o  reduce default timeouts, and add expand timeouts to handle the
    initial line, each header, and the total time spent
 o  add -T option to expose new timeout settings
 o  minor RFC fixes related to timeout handling responses

 old timeouts:
 60 seconds for initial request like, 60 seconds per header line,
 and no whole timeout (though the recent total header size changes
 do introduce one that would be about 11 hours.)
 new timeouts:
 30 seconds for initial request like, 10 seconds per header line,
 and a total request time of 600 seconds.

 the new global timeout is implemented using CLOCK_MONOTONIC, with
 a fallback to CLOCK_REALTIME if monotonic time is unavailable.

 reject multiple Host: headers.  besides being protocol standard,
 this closes one additional memory leak found by JP.  add a simple
 test to check this.

 clean up option and usage handling some.

 move some #if support into bozohttpd.h.

 fix previous: have_debug was reversed.

 also fix have_dynamic_content from the previous previous.  re-order
 the debug and dynamic content to match the same pattern as everything
 else so similar problems are less likely in the future.

 - move special files defines into bozohttpd.h, so we can ...
 - consolidate all the special file checks into
   bozo_check_special_files() so that all builds check the same
   list of special files, regardless of build options.
 - convert "(void)bozo_http_error(...); return -1;" into plain
   "return bozo_http_error(...);"
 - fix the call to bozo_check_special_files() to be used on all
   input types.  part of the fixes for failure to reject access
   to /.htpasswd as reported by JP on tech-security.
 - use warn_unused_result attribute on bozo_check_special_files(),
   and fix the failures to return failure.  second part of the
   htpasswd access fix.
 - update testsuite to use a fixed fake hostname.

 call this bozohttpd 20181121.

 two fixes reported by mouse:
 - don't check contents of 'st' if stat(2) failed.
 - round up instead of truncate.  now 10000 byte files say 10kB not 9kB.

 use MAP_SHARED for the bzremap file.  avoids netbsd kernel complaining:

 WARNING: defaulted mmap() share type to MAP_PRIVATE (pid 15478 command bozohttpd)

 many clean ups:
 - keep a list of special files and their human names
 - remove (void) casts on bozo_http_error()
 - fix a few more misuses of bozo_http_error()
 - rename check_mapping() to check_remap() and perform some CSE
 - switch away from ``%s'' to '%s'
 - remove a bunch of #ifdef using new have_feature defines

 alpha sort the option switch.

 add an assert() check on array bounds.

 minor style fixes.  simplify bozo_match_content_map().


 To generate a diff of this commit:
 cvs rdiff -u -r1.25 -r1.25.4.1 src/libexec/httpd/CHANGES
 cvs rdiff -u -r1.18 -r1.18.8.1 src/libexec/httpd/auth-bozo.c
 cvs rdiff -u -r1.65 -r1.65.4.1 src/libexec/httpd/bozohttpd.8
 cvs rdiff -u -r1.86.4.1 -r1.86.4.2 src/libexec/httpd/bozohttpd.c
 cvs rdiff -u -r1.47 -r1.47.4.1 src/libexec/httpd/bozohttpd.h
 cvs rdiff -u -r1.37.4.1 -r1.37.4.2 src/libexec/httpd/cgi-bozo.c
 cvs rdiff -u -r1.14 -r1.14.6.1 src/libexec/httpd/content-bozo.c
 cvs rdiff -u -r1.17 -r1.17.8.1 src/libexec/httpd/daemon-bozo.c
 cvs rdiff -u -r1.25 -r1.25.8.1 src/libexec/httpd/dir-index-bozo.c
 cvs rdiff -u -r1.16 -r1.16.6.1 src/libexec/httpd/main.c
 cvs rdiff -u -r1.22 -r1.22.8.1 src/libexec/httpd/ssl-bozo.c
 cvs rdiff -u -r1.14 -r1.14.8.1 src/libexec/httpd/tilde-luzah-bozo.c
 cvs rdiff -u -r1.2 -r1.2.8.1 src/libexec/httpd/lua/bozo.lua \
     src/libexec/httpd/lua/glue.c
 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.44.1 src/libexec/httpd/lua/optparse.lua
 cvs rdiff -u -r1.7 -r1.7.4.1 src/libexec/httpd/testsuite/Makefile
 cvs rdiff -u -r1.5 -r1.5.6.1 src/libexec/httpd/testsuite/html_cmp
 cvs rdiff -u -r0 -r1.1.4.2 src/libexec/httpd/testsuite/t12.in \
     src/libexec/httpd/testsuite/t12.out src/libexec/httpd/testsuite/t13.in \
     src/libexec/httpd/testsuite/t13.out
 cvs rdiff -u -r0 -r1.1.2.2 src/libexec/httpd/testsuite/t14.in \
     src/libexec/httpd/testsuite/t14.out src/libexec/httpd/testsuite/t15.in \
     src/libexec/httpd/testsuite/t15.out
 cvs rdiff -u -r1.3 -r1.3.38.1 src/libexec/httpd/testsuite/t3.out \
     src/libexec/httpd/testsuite/t5.out src/libexec/httpd/testsuite/t6.out
 cvs rdiff -u -r1.4 -r1.4.4.1 src/libexec/httpd/testsuite/test-bigfile
 cvs rdiff -u -r1.4 -r1.4.10.1 src/libexec/httpd/testsuite/test-simple
 cvs rdiff -u -r0 -r1.1.4.2 src/libexec/httpd/testsuite/data/.bzremap

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-7] src/libexec/httpd
Date: Sat, 24 Nov 2018 17:22:59 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov 24 17:22:58 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-7]: CHANGES Makefile auth-bozo.c bozohttpd.8
 	    bozohttpd.c bozohttpd.h cgi-bozo.c content-bozo.c daemon-bozo.c
 	    dir-index-bozo.c lua-bozo.c main.c ssl-bozo.c tilde-luzah-bozo.c
 	src/libexec/httpd/libbozohttpd [netbsd-7]: Makefile
 	src/libexec/httpd/lua [netbsd-7]: bozo.lua glue.c optparse.lua
 	src/libexec/httpd/testsuite [netbsd-7]: Makefile html_cmp t3.out t5.out
 	    t6.out test-bigfile test-simple
 Added Files:
 	src/libexec/httpd/testsuite [netbsd-7]: t12.in t12.out t13.in t13.out
 	    t14.in t14.out t15.in t15.out
 	src/libexec/httpd/testsuite/data [netbsd-7]: .bzremap

 Log Message:
 Sync to HEAD (requested by mrg in ticket #1655):

 	libexec/httpd/testsuite/data/.bzremap           up to 1.1
 	libexec/httpd/testsuite/t12.out                 up to 1.1
 	libexec/httpd/testsuite/t12.in                  up to 1.1
 	libexec/httpd/testsuite/t13.out                 up to 1.1
 	libexec/httpd/testsuite/t13.in                  up to 1.1
 	libexec/httpd/testsuite/t14.out                 up to 1.1
 	libexec/httpd/testsuite/t14.in                  up to 1.1
 	libexec/httpd/testsuite/t15.out                 up to 1.1
 	libexec/httpd/testsuite/t15.in                  up to 1.1
 	libexec/httpd/CHANGES                           up to 1.28
 	libexec/httpd/Makefile                          up to 1.27
 	libexec/httpd/auth-bozo.c                       up to 1.22
 	libexec/httpd/bozohttpd.8                       up to 1.74
 	libexec/httpd/bozohttpd.c                       up to 1.96
 	libexec/httpd/bozohttpd.h                       up to 1.56
 	libexec/httpd/cgi-bozo.c                        up to 1.44
 	libexec/httpd/content-bozo.c                    up to 1.16
 	libexec/httpd/daemon-bozo.c                     up to 1.19
 	libexec/httpd/dir-index-bozo.c                  up to 1.28
 	libexec/httpd/lua-bozo.c                        up to 1.15
 	libexec/httpd/main.c                            up to 1.21
 	libexec/httpd/ssl-bozo.c                        up to 1.25
 	libexec/httpd/tilde-luzah-bozo.c                up to 1.16
 	libexec/httpd/libbozohttpd/Makefile             up to 1.3
 	libexec/httpd/lua/bozo.lua                      up to 1.3
 	libexec/httpd/lua/glue.c                        up to 1.5
 	libexec/httpd/lua/optparse.lua                  up to 1.2
 	libexec/httpd/testsuite/Makefile                up to 1.11
 	libexec/httpd/testsuite/html_cmp                up to 1.6
 	libexec/httpd/testsuite/t3.out                  up to 1.4
 	libexec/httpd/testsuite/t5.out                  up to 1.4
 	libexec/httpd/testsuite/t6.out                  up to 1.4
 	libexec/httpd/testsuite/test-bigfile            up to 1.5
 	libexec/httpd/testsuite/test-simple             up to 1.5

 Cosmetic changes to Lua binding in bozohttpd.

 - Don't use negative indicies to read arguments of Lua functions.
 - On error, return nil, "error string".
 - Use ssize_t for return values from bozo_read() and bozo_write().
 - Prefer lstring especially when if saves you from appending NUL and
   doing len + 1 which can potentially wraparound.
 - Don't mix C allocations with Lua functions marked with "m" in the Lua
   manual. Those functions may throw (longjump) and leak data allocated
   by C function. In one case, I use luaL_Buffer, in the other case,
   I rearranged calls a bit.

 fix ordering of a couple of words.  from Edgar Pettijohn in PR#52375.
 thanks!

 s/u_int/unsigned/.

 from Jan Danielsson.  increases/fixes portability.

 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.

 Document script handler issues with httpd(8).
 From martin@, addressing PR 52194.

 While here, use American spelling consistently and upper-case some
 abbreviations.

 Bump date.

 fix output since protocol agnostic change went in.

 XXX: i thought someone hooked this into atf already, please do :)

 Add support for remapping requested paths via a .bzredirect file.
 Fixes PR 52772. Ok: mrg@

 Bump date

 Remove trailing whitespace.

 use __func__ in debug().

 fix a denial of service attack against header contents, which
 is now bounded at 16KiB.  reported by JP.

 avoid memory leak in sending multiple auth headers.
 mostly mitigated by previous patch to limit total header size,
 but still a real problem here.

 note the changes present in bozohttpd 20181118:

 o  add url remap support via .bzremap file, from martin%netbsd.org@localhost
 o  handle redirections for any protocol, not just http:
 o  fix a denial of service attack against header contents, which
    is now bounded at 16KiB.  reported by JP.

 from CHANGES:

 o  reduce default timeouts, and add expand timeouts to handle the
    initial line, each header, and the total time spent
 o  add -T option to expose new timeout settings
 o  minor RFC fixes related to timeout handling responses

 old timeouts:
 60 seconds for initial request like, 60 seconds per header line,
 and no whole timeout (though the recent total header size changes
 do introduce one that would be about 11 hours.)
 new timeouts:
 30 seconds for initial request like, 10 seconds per header line,
 and a total request time of 600 seconds.

 the new global timeout is implemented using CLOCK_MONOTONIC, with
 a fallback to CLOCK_REALTIME if monotonic time is unavailable.

 reject multiple Host: headers.  besides being protocol standard,
 this closes one additional memory leak found by JP.  add a simple
 test to check this.

 clean up option and usage handling some.

 move some #if support into bozohttpd.h.

 fix previous: have_debug was reversed.

 also fix have_dynamic_content from the previous previous.  re-order
 the debug and dynamic content to match the same pattern as everything
 else so similar problems are less likely in the future.

 - move special files defines into bozohttpd.h, so we can ...
 - consolidate all the special file checks into
   bozo_check_special_files() so that all builds check the same
   list of special files, regardless of build options.
 - convert "(void)bozo_http_error(...); return -1;" into plain
   "return bozo_http_error(...);"
 - fix the call to bozo_check_special_files() to be used on all
   input types.  part of the fixes for failure to reject access
   to /.htpasswd as reported by JP on tech-security.
 - use warn_unused_result attribute on bozo_check_special_files(),
   and fix the failures to return failure.  second part of the
   htpasswd access fix.
 - update testsuite to use a fixed fake hostname.

 call this bozohttpd 20181121.

 two fixes reported by mouse:
 - don't check contents of 'st' if stat(2) failed.
 - round up instead of truncate.  now 10000 byte files say 10kB not 9kB.

 use MAP_SHARED for the bzremap file.  avoids netbsd kernel complaining:

 WARNING: defaulted mmap() share type to MAP_PRIVATE (pid 15478 command bozohttpd)

 many clean ups:
 - keep a list of special files and their human names
 - remove (void) casts on bozo_http_error()
 - fix a few more misuses of bozo_http_error()
 - rename check_mapping() to check_remap() and perform some CSE
 - switch away from ``%s'' to '%s'
 - remove a bunch of #ifdef using new have_feature defines

 alpha sort the option switch.

 add an assert() check on array bounds.

 minor style fixes.  simplify bozo_match_content_map().


 To generate a diff of this commit:
 cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/libexec/httpd/CHANGES
 cvs rdiff -u -r1.22.2.2 -r1.22.2.3 src/libexec/httpd/Makefile
 cvs rdiff -u -r1.13.2.2 -r1.13.2.3 src/libexec/httpd/auth-bozo.c
 cvs rdiff -u -r1.46.4.8 -r1.46.4.9 src/libexec/httpd/bozohttpd.8
 cvs rdiff -u -r1.56.2.9 -r1.56.2.10 src/libexec/httpd/bozohttpd.c
 cvs rdiff -u -r1.33.2.6 -r1.33.2.7 src/libexec/httpd/bozohttpd.h
 cvs rdiff -u -r1.25.2.8 -r1.25.2.9 src/libexec/httpd/cgi-bozo.c
 cvs rdiff -u -r1.10.2.4 -r1.10.2.5 src/libexec/httpd/content-bozo.c
 cvs rdiff -u -r1.16.4.1 -r1.16.4.2 src/libexec/httpd/daemon-bozo.c
 cvs rdiff -u -r1.19.4.2 -r1.19.4.3 src/libexec/httpd/dir-index-bozo.c
 cvs rdiff -u -r1.10.2.2 -r1.10.2.3 src/libexec/httpd/lua-bozo.c
 cvs rdiff -u -r1.8.2.2 -r1.8.2.3 src/libexec/httpd/main.c
 cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/libexec/httpd/ssl-bozo.c
 cvs rdiff -u -r1.10.4.1 -r1.10.4.2 src/libexec/httpd/tilde-luzah-bozo.c
 cvs rdiff -u -r1.2 -r1.2.10.1 src/libexec/httpd/libbozohttpd/Makefile
 cvs rdiff -u -r1.1.1.1.30.1 -r1.1.1.1.30.2 src/libexec/httpd/lua/bozo.lua \
     src/libexec/httpd/lua/glue.c
 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.30.1 src/libexec/httpd/lua/optparse.lua
 cvs rdiff -u -r1.4.24.3 -r1.4.24.4 src/libexec/httpd/testsuite/Makefile
 cvs rdiff -u -r1.4.18.1 -r1.4.18.2 src/libexec/httpd/testsuite/html_cmp
 cvs rdiff -u -r0 -r1.1.6.2 src/libexec/httpd/testsuite/t12.in \
     src/libexec/httpd/testsuite/t12.out src/libexec/httpd/testsuite/t13.in \
     src/libexec/httpd/testsuite/t13.out
 cvs rdiff -u -r0 -r1.1.4.2 src/libexec/httpd/testsuite/t14.in \
     src/libexec/httpd/testsuite/t14.out src/libexec/httpd/testsuite/t15.in \
     src/libexec/httpd/testsuite/t15.out
 cvs rdiff -u -r1.3 -r1.3.24.1 src/libexec/httpd/testsuite/t3.out \
     src/libexec/httpd/testsuite/t5.out src/libexec/httpd/testsuite/t6.out
 cvs rdiff -u -r1.1.1.1.30.3 -r1.1.1.1.30.4 \
     src/libexec/httpd/testsuite/test-bigfile
 cvs rdiff -u -r1.2.4.3 -r1.2.4.4 src/libexec/httpd/testsuite/test-simple
 cvs rdiff -u -r0 -r1.1.6.2 src/libexec/httpd/testsuite/data/.bzremap

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-7-1] src/libexec/httpd
Date: Sat, 24 Nov 2018 17:23:21 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov 24 17:23:21 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-7-1]: CHANGES Makefile auth-bozo.c
 	    bozohttpd.8 bozohttpd.c bozohttpd.h cgi-bozo.c content-bozo.c
 	    daemon-bozo.c dir-index-bozo.c lua-bozo.c main.c ssl-bozo.c
 	    tilde-luzah-bozo.c
 	src/libexec/httpd/libbozohttpd [netbsd-7-1]: Makefile
 	src/libexec/httpd/lua [netbsd-7-1]: bozo.lua glue.c optparse.lua
 	src/libexec/httpd/testsuite [netbsd-7-1]: Makefile html_cmp t3.out
 	    t5.out t6.out test-bigfile test-simple
 Added Files:
 	src/libexec/httpd/testsuite [netbsd-7-1]: t12.in t12.out t13.in t13.out
 	    t14.in t14.out t15.in t15.out
 	src/libexec/httpd/testsuite/data [netbsd-7-1]: .bzremap

 Log Message:
 Sync to HEAD (requested by mrg in ticket #1655):

 	libexec/httpd/testsuite/data/.bzremap           up to 1.1
 	libexec/httpd/testsuite/t12.out                 up to 1.1
 	libexec/httpd/testsuite/t12.in                  up to 1.1
 	libexec/httpd/testsuite/t13.out                 up to 1.1
 	libexec/httpd/testsuite/t13.in                  up to 1.1
 	libexec/httpd/testsuite/t14.out                 up to 1.1
 	libexec/httpd/testsuite/t14.in                  up to 1.1
 	libexec/httpd/testsuite/t15.out                 up to 1.1
 	libexec/httpd/testsuite/t15.in                  up to 1.1
 	libexec/httpd/CHANGES                           up to 1.28
 	libexec/httpd/Makefile                          up to 1.27
 	libexec/httpd/auth-bozo.c                       up to 1.22
 	libexec/httpd/bozohttpd.8                       up to 1.74
 	libexec/httpd/bozohttpd.c                       up to 1.96
 	libexec/httpd/bozohttpd.h                       up to 1.56
 	libexec/httpd/cgi-bozo.c                        up to 1.44
 	libexec/httpd/content-bozo.c                    up to 1.16
 	libexec/httpd/daemon-bozo.c                     up to 1.19
 	libexec/httpd/dir-index-bozo.c                  up to 1.28
 	libexec/httpd/lua-bozo.c                        up to 1.15
 	libexec/httpd/main.c                            up to 1.21
 	libexec/httpd/ssl-bozo.c                        up to 1.25
 	libexec/httpd/tilde-luzah-bozo.c                up to 1.16
 	libexec/httpd/libbozohttpd/Makefile             up to 1.3
 	libexec/httpd/lua/bozo.lua                      up to 1.3
 	libexec/httpd/lua/glue.c                        up to 1.5
 	libexec/httpd/lua/optparse.lua                  up to 1.2
 	libexec/httpd/testsuite/Makefile                up to 1.11
 	libexec/httpd/testsuite/html_cmp                up to 1.6
 	libexec/httpd/testsuite/t3.out                  up to 1.4
 	libexec/httpd/testsuite/t5.out                  up to 1.4
 	libexec/httpd/testsuite/t6.out                  up to 1.4
 	libexec/httpd/testsuite/test-bigfile            up to 1.5
 	libexec/httpd/testsuite/test-simple             up to 1.5

 Cosmetic changes to Lua binding in bozohttpd.

 - Don't use negative indicies to read arguments of Lua functions.
 - On error, return nil, "error string".
 - Use ssize_t for return values from bozo_read() and bozo_write().
 - Prefer lstring especially when if saves you from appending NUL and
   doing len + 1 which can potentially wraparound.
 - Don't mix C allocations with Lua functions marked with "m" in the Lua
   manual. Those functions may throw (longjump) and leak data allocated
   by C function. In one case, I use luaL_Buffer, in the other case,
   I rearranged calls a bit.

 fix ordering of a couple of words.  from Edgar Pettijohn in PR#52375.
 thanks!

 s/u_int/unsigned/.

 from Jan Danielsson.  increases/fixes portability.

 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.

 Document script handler issues with httpd(8).
 From martin@, addressing PR 52194.

 While here, use American spelling consistently and upper-case some
 abbreviations.

 Bump date.

 fix output since protocol agnostic change went in.

 XXX: i thought someone hooked this into atf already, please do :)

 Add support for remapping requested paths via a .bzredirect file.
 Fixes PR 52772. Ok: mrg@

 Bump date

 Remove trailing whitespace.

 use __func__ in debug().

 fix a denial of service attack against header contents, which
 is now bounded at 16KiB.  reported by JP.

 avoid memory leak in sending multiple auth headers.
 mostly mitigated by previous patch to limit total header size,
 but still a real problem here.

 note the changes present in bozohttpd 20181118:

 o  add url remap support via .bzremap file, from martin%netbsd.org@localhost
 o  handle redirections for any protocol, not just http:
 o  fix a denial of service attack against header contents, which
    is now bounded at 16KiB.  reported by JP.

 from CHANGES:

 o  reduce default timeouts, and add expand timeouts to handle the
    initial line, each header, and the total time spent
 o  add -T option to expose new timeout settings
 o  minor RFC fixes related to timeout handling responses

 old timeouts:
 60 seconds for initial request like, 60 seconds per header line,
 and no whole timeout (though the recent total header size changes
 do introduce one that would be about 11 hours.)
 new timeouts:
 30 seconds for initial request like, 10 seconds per header line,
 and a total request time of 600 seconds.

 the new global timeout is implemented using CLOCK_MONOTONIC, with
 a fallback to CLOCK_REALTIME if monotonic time is unavailable.

 reject multiple Host: headers.  besides being protocol standard,
 this closes one additional memory leak found by JP.  add a simple
 test to check this.

 clean up option and usage handling some.

 move some #if support into bozohttpd.h.

 fix previous: have_debug was reversed.

 also fix have_dynamic_content from the previous previous.  re-order
 the debug and dynamic content to match the same pattern as everything
 else so similar problems are less likely in the future.

 - move special files defines into bozohttpd.h, so we can ...
 - consolidate all the special file checks into
   bozo_check_special_files() so that all builds check the same
   list of special files, regardless of build options.
 - convert "(void)bozo_http_error(...); return -1;" into plain
   "return bozo_http_error(...);"
 - fix the call to bozo_check_special_files() to be used on all
   input types.  part of the fixes for failure to reject access
   to /.htpasswd as reported by JP on tech-security.
 - use warn_unused_result attribute on bozo_check_special_files(),
   and fix the failures to return failure.  second part of the
   htpasswd access fix.
 - update testsuite to use a fixed fake hostname.

 call this bozohttpd 20181121.

 two fixes reported by mouse:
 - don't check contents of 'st' if stat(2) failed.
 - round up instead of truncate.  now 10000 byte files say 10kB not 9kB.

 use MAP_SHARED for the bzremap file.  avoids netbsd kernel complaining:

 WARNING: defaulted mmap() share type to MAP_PRIVATE (pid 15478 command bozohttpd)

 many clean ups:
 - keep a list of special files and their human names
 - remove (void) casts on bozo_http_error()
 - fix a few more misuses of bozo_http_error()
 - rename check_mapping() to check_remap() and perform some CSE
 - switch away from ``%s'' to '%s'
 - remove a bunch of #ifdef using new have_feature defines

 alpha sort the option switch.

 add an assert() check on array bounds.

 minor style fixes.  simplify bozo_match_content_map().


 To generate a diff of this commit:
 cvs rdiff -u -r1.19.2.5 -r1.19.2.5.2.1 src/libexec/httpd/CHANGES
 cvs rdiff -u -r1.22.2.2 -r1.22.2.2.4.1 src/libexec/httpd/Makefile
 cvs rdiff -u -r1.13.2.2 -r1.13.2.2.4.1 src/libexec/httpd/auth-bozo.c
 cvs rdiff -u -r1.46.4.8 -r1.46.4.8.2.1 src/libexec/httpd/bozohttpd.8
 cvs rdiff -u -r1.56.2.8 -r1.56.2.8.2.1 src/libexec/httpd/bozohttpd.c
 cvs rdiff -u -r1.33.2.6 -r1.33.2.6.2.1 src/libexec/httpd/bozohttpd.h
 cvs rdiff -u -r1.25.2.7.2.1 -r1.25.2.7.2.2 src/libexec/httpd/cgi-bozo.c
 cvs rdiff -u -r1.10.2.4 -r1.10.2.4.2.1 src/libexec/httpd/content-bozo.c
 cvs rdiff -u -r1.16.4.1 -r1.16.4.1.4.1 src/libexec/httpd/daemon-bozo.c
 cvs rdiff -u -r1.19.4.2 -r1.19.4.2.4.1 src/libexec/httpd/dir-index-bozo.c
 cvs rdiff -u -r1.10.2.2 -r1.10.2.2.4.1 src/libexec/httpd/lua-bozo.c
 cvs rdiff -u -r1.8.2.2 -r1.8.2.2.2.1 src/libexec/httpd/main.c
 cvs rdiff -u -r1.18.2.1 -r1.18.2.1.4.1 src/libexec/httpd/ssl-bozo.c
 cvs rdiff -u -r1.10.4.1 -r1.10.4.1.4.1 src/libexec/httpd/tilde-luzah-bozo.c
 cvs rdiff -u -r1.2 -r1.2.20.1 src/libexec/httpd/libbozohttpd/Makefile
 cvs rdiff -u -r1.1.1.1.30.1 -r1.1.1.1.30.1.4.1 src/libexec/httpd/lua/bozo.lua \
     src/libexec/httpd/lua/glue.c
 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.40.1 src/libexec/httpd/lua/optparse.lua
 cvs rdiff -u -r1.4.24.3 -r1.4.24.3.2.1 src/libexec/httpd/testsuite/Makefile
 cvs rdiff -u -r1.4.18.1 -r1.4.18.1.2.1 src/libexec/httpd/testsuite/html_cmp
 cvs rdiff -u -r0 -r1.1.8.2 src/libexec/httpd/testsuite/t12.in \
     src/libexec/httpd/testsuite/t12.out src/libexec/httpd/testsuite/t13.in \
     src/libexec/httpd/testsuite/t13.out
 cvs rdiff -u -r0 -r1.1.6.2 src/libexec/httpd/testsuite/t14.in \
     src/libexec/httpd/testsuite/t14.out src/libexec/httpd/testsuite/t15.in \
     src/libexec/httpd/testsuite/t15.out
 cvs rdiff -u -r1.3 -r1.3.34.1 src/libexec/httpd/testsuite/t3.out \
     src/libexec/httpd/testsuite/t5.out src/libexec/httpd/testsuite/t6.out
 cvs rdiff -u -r1.1.1.1.30.3 -r1.1.1.1.30.3.2.1 \
     src/libexec/httpd/testsuite/test-bigfile
 cvs rdiff -u -r1.2.4.3 -r1.2.4.3.2.1 src/libexec/httpd/testsuite/test-simple
 cvs rdiff -u -r0 -r1.1.8.2 src/libexec/httpd/testsuite/data/.bzremap

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52194 CVS commit: [netbsd-7-0] src/libexec/httpd
Date: Sat, 24 Nov 2018 17:23:48 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov 24 17:23:48 UTC 2018

 Modified Files:
 	src/libexec/httpd [netbsd-7-0]: CHANGES Makefile auth-bozo.c
 	    bozohttpd.8 bozohttpd.c bozohttpd.h cgi-bozo.c content-bozo.c
 	    daemon-bozo.c dir-index-bozo.c lua-bozo.c main.c ssl-bozo.c
 	    tilde-luzah-bozo.c
 	src/libexec/httpd/libbozohttpd [netbsd-7-0]: Makefile
 	src/libexec/httpd/lua [netbsd-7-0]: bozo.lua glue.c optparse.lua
 	src/libexec/httpd/testsuite [netbsd-7-0]: Makefile html_cmp t3.out
 	    t5.out t6.out test-bigfile test-simple
 Added Files:
 	src/libexec/httpd/testsuite [netbsd-7-0]: t12.in t12.out t13.in t13.out
 	    t14.in t14.out t15.in t15.out
 	src/libexec/httpd/testsuite/data [netbsd-7-0]: .bzremap

 Log Message:
 Sync to HEAD (requested by mrg in ticket #1655):

 	libexec/httpd/testsuite/data/.bzremap           up to 1.1
 	libexec/httpd/testsuite/t12.out                 up to 1.1
 	libexec/httpd/testsuite/t12.in                  up to 1.1
 	libexec/httpd/testsuite/t13.out                 up to 1.1
 	libexec/httpd/testsuite/t13.in                  up to 1.1
 	libexec/httpd/testsuite/t14.out                 up to 1.1
 	libexec/httpd/testsuite/t14.in                  up to 1.1
 	libexec/httpd/testsuite/t15.out                 up to 1.1
 	libexec/httpd/testsuite/t15.in                  up to 1.1
 	libexec/httpd/CHANGES                           up to 1.28
 	libexec/httpd/Makefile                          up to 1.27
 	libexec/httpd/auth-bozo.c                       up to 1.22
 	libexec/httpd/bozohttpd.8                       up to 1.74
 	libexec/httpd/bozohttpd.c                       up to 1.96
 	libexec/httpd/bozohttpd.h                       up to 1.56
 	libexec/httpd/cgi-bozo.c                        up to 1.44
 	libexec/httpd/content-bozo.c                    up to 1.16
 	libexec/httpd/daemon-bozo.c                     up to 1.19
 	libexec/httpd/dir-index-bozo.c                  up to 1.28
 	libexec/httpd/lua-bozo.c                        up to 1.15
 	libexec/httpd/main.c                            up to 1.21
 	libexec/httpd/ssl-bozo.c                        up to 1.25
 	libexec/httpd/tilde-luzah-bozo.c                up to 1.16
 	libexec/httpd/libbozohttpd/Makefile             up to 1.3
 	libexec/httpd/lua/bozo.lua                      up to 1.3
 	libexec/httpd/lua/glue.c                        up to 1.5
 	libexec/httpd/lua/optparse.lua                  up to 1.2
 	libexec/httpd/testsuite/Makefile                up to 1.11
 	libexec/httpd/testsuite/html_cmp                up to 1.6
 	libexec/httpd/testsuite/t3.out                  up to 1.4
 	libexec/httpd/testsuite/t5.out                  up to 1.4
 	libexec/httpd/testsuite/t6.out                  up to 1.4
 	libexec/httpd/testsuite/test-bigfile            up to 1.5
 	libexec/httpd/testsuite/test-simple             up to 1.5

 Cosmetic changes to Lua binding in bozohttpd.

 - Don't use negative indicies to read arguments of Lua functions.
 - On error, return nil, "error string".
 - Use ssize_t for return values from bozo_read() and bozo_write().
 - Prefer lstring especially when if saves you from appending NUL and
   doing len + 1 which can potentially wraparound.
 - Don't mix C allocations with Lua functions marked with "m" in the Lua
   manual. Those functions may throw (longjump) and leak data allocated
   by C function. In one case, I use luaL_Buffer, in the other case,
   I rearranged calls a bit.

 fix ordering of a couple of words.  from Edgar Pettijohn in PR#52375.
 thanks!

 s/u_int/unsigned/.

 from Jan Danielsson.  increases/fixes portability.

 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
 sometimes with EFAULT due to not NULL terminated environment.

 Document script handler issues with httpd(8).
 From martin@, addressing PR 52194.

 While here, use American spelling consistently and upper-case some
 abbreviations.

 Bump date.

 fix output since protocol agnostic change went in.

 XXX: i thought someone hooked this into atf already, please do :)

 Add support for remapping requested paths via a .bzredirect file.
 Fixes PR 52772. Ok: mrg@

 Bump date

 Remove trailing whitespace.

 use __func__ in debug().

 fix a denial of service attack against header contents, which
 is now bounded at 16KiB.  reported by JP.

 avoid memory leak in sending multiple auth headers.
 mostly mitigated by previous patch to limit total header size,
 but still a real problem here.

 note the changes present in bozohttpd 20181118:

 o  add url remap support via .bzremap file, from martin%netbsd.org@localhost
 o  handle redirections for any protocol, not just http:
 o  fix a denial of service attack against header contents, which
    is now bounded at 16KiB.  reported by JP.

 from CHANGES:

 o  reduce default timeouts, and add expand timeouts to handle the
    initial line, each header, and the total time spent
 o  add -T option to expose new timeout settings
 o  minor RFC fixes related to timeout handling responses

 old timeouts:
 60 seconds for initial request like, 60 seconds per header line,
 and no whole timeout (though the recent total header size changes
 do introduce one that would be about 11 hours.)
 new timeouts:
 30 seconds for initial request like, 10 seconds per header line,
 and a total request time of 600 seconds.

 the new global timeout is implemented using CLOCK_MONOTONIC, with
 a fallback to CLOCK_REALTIME if monotonic time is unavailable.

 reject multiple Host: headers.  besides being protocol standard,
 this closes one additional memory leak found by JP.  add a simple
 test to check this.

 clean up option and usage handling some.

 move some #if support into bozohttpd.h.

 fix previous: have_debug was reversed.

 also fix have_dynamic_content from the previous previous.  re-order
 the debug and dynamic content to match the same pattern as everything
 else so similar problems are less likely in the future.

 - move special files defines into bozohttpd.h, so we can ...
 - consolidate all the special file checks into
   bozo_check_special_files() so that all builds check the same
   list of special files, regardless of build options.
 - convert "(void)bozo_http_error(...); return -1;" into plain
   "return bozo_http_error(...);"
 - fix the call to bozo_check_special_files() to be used on all
   input types.  part of the fixes for failure to reject access
   to /.htpasswd as reported by JP on tech-security.
 - use warn_unused_result attribute on bozo_check_special_files(),
   and fix the failures to return failure.  second part of the
   htpasswd access fix.
 - update testsuite to use a fixed fake hostname.

 call this bozohttpd 20181121.

 two fixes reported by mouse:
 - don't check contents of 'st' if stat(2) failed.
 - round up instead of truncate.  now 10000 byte files say 10kB not 9kB.

 use MAP_SHARED for the bzremap file.  avoids netbsd kernel complaining:

 WARNING: defaulted mmap() share type to MAP_PRIVATE (pid 15478 command bozohttpd)

 many clean ups:
 - keep a list of special files and their human names
 - remove (void) casts on bozo_http_error()
 - fix a few more misuses of bozo_http_error()
 - rename check_mapping() to check_remap() and perform some CSE
 - switch away from ``%s'' to '%s'
 - remove a bunch of #ifdef using new have_feature defines

 alpha sort the option switch.

 add an assert() check on array bounds.

 minor style fixes.  simplify bozo_match_content_map().


 To generate a diff of this commit:
 cvs rdiff -u -r1.19.2.1.2.3 -r1.19.2.1.2.4 src/libexec/httpd/CHANGES
 cvs rdiff -u -r1.22.2.1.2.1 -r1.22.2.1.2.2 src/libexec/httpd/Makefile
 cvs rdiff -u -r1.13.2.1.2.1 -r1.13.2.1.2.2 src/libexec/httpd/auth-bozo.c
 cvs rdiff -u -r1.46.4.4.2.3 -r1.46.4.4.2.4 src/libexec/httpd/bozohttpd.8
 cvs rdiff -u -r1.56.2.4.2.3 -r1.56.2.4.2.4 src/libexec/httpd/bozohttpd.c
 cvs rdiff -u -r1.33.2.2.2.3 -r1.33.2.2.2.4 src/libexec/httpd/bozohttpd.h
 cvs rdiff -u -r1.25.2.2.2.5 -r1.25.2.2.2.6 src/libexec/httpd/cgi-bozo.c
 cvs rdiff -u -r1.10.2.2.2.2 -r1.10.2.2.2.3 src/libexec/httpd/content-bozo.c
 cvs rdiff -u -r1.16.6.1 -r1.16.6.2 src/libexec/httpd/daemon-bozo.c
 cvs rdiff -u -r1.19.4.1.2.1 -r1.19.4.1.2.2 src/libexec/httpd/dir-index-bozo.c
 cvs rdiff -u -r1.10.2.1.2.1 -r1.10.2.1.2.2 src/libexec/httpd/lua-bozo.c
 cvs rdiff -u -r1.8.4.2 -r1.8.4.3 src/libexec/httpd/main.c
 cvs rdiff -u -r1.18.4.1 -r1.18.4.2 src/libexec/httpd/ssl-bozo.c
 cvs rdiff -u -r1.10.6.1 -r1.10.6.2 src/libexec/httpd/tilde-luzah-bozo.c
 cvs rdiff -u -r1.2 -r1.2.12.1 src/libexec/httpd/libbozohttpd/Makefile
 cvs rdiff -u -r1.1.1.1.32.1 -r1.1.1.1.32.2 src/libexec/httpd/lua/bozo.lua \
     src/libexec/httpd/lua/glue.c
 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.32.1 src/libexec/httpd/lua/optparse.lua
 cvs rdiff -u -r1.4.26.3 -r1.4.26.4 src/libexec/httpd/testsuite/Makefile
 cvs rdiff -u -r1.4.20.1 -r1.4.20.2 src/libexec/httpd/testsuite/html_cmp
 cvs rdiff -u -r0 -r1.1.10.2 src/libexec/httpd/testsuite/t12.in \
     src/libexec/httpd/testsuite/t12.out src/libexec/httpd/testsuite/t13.in \
     src/libexec/httpd/testsuite/t13.out
 cvs rdiff -u -r0 -r1.1.8.2 src/libexec/httpd/testsuite/t14.in \
     src/libexec/httpd/testsuite/t14.out src/libexec/httpd/testsuite/t15.in \
     src/libexec/httpd/testsuite/t15.out
 cvs rdiff -u -r1.3 -r1.3.26.1 src/libexec/httpd/testsuite/t3.out \
     src/libexec/httpd/testsuite/t5.out src/libexec/httpd/testsuite/t6.out
 cvs rdiff -u -r1.1.1.1.32.3 -r1.1.1.1.32.4 \
     src/libexec/httpd/testsuite/test-bigfile
 cvs rdiff -u -r1.2.6.3 -r1.2.6.4 src/libexec/httpd/testsuite/test-simple
 cvs rdiff -u -r0 -r1.1.10.2 src/libexec/httpd/testsuite/data/.bzremap

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.