Commit Graph

240 Commits

Author SHA1 Message Date
wiz 2aa6701c2b Remove trailing whitespace. 2018-08-24 14:24:50 +00:00
martin 48f4f2396c Bump date 2018-08-24 11:43:13 +00:00
martin bf2f242dcd Add support for remapping requested paths via a .bzredirect file.
Fixes PR 52772. Ok: mrg@
2018-08-24 11:41:16 +00:00
mrg 05225295cb fix output since protocol agnostic change went in.
XXX: i thought someone hooked this into atf already, please do :)
2018-08-24 10:04:41 +00:00
sevan 658d9240b5 remove definition of LUA_USE_APICHECK, it is a build time option for Lua
itself. Not for modules.
2018-05-11 20:19:25 +00:00
sevan 3186d74c3d Do not try and process empty requests. This resolves a crash when issuing a
carriage return to read_request() in foreground mode.
In the C daemon, a NULL check is performed on bozo_read_request in main.c
before moving on to bozo_process_request & bozo_clean_request. Here,
process_request & clean_request just return instead.
2018-05-04 19:45:27 +00:00
christos d9ca995a53 fix the rest of the compilers. 2018-05-04 18:07:23 +00:00
christos c1e5495798 fix lint 2018-05-04 18:06:44 +00:00
sevan 89bb3c6008 Unbreak script for Lua 5.3.
This change breaks support for older releases of Lua.
2018-05-02 00:03:27 +00:00
sevan f11f7afd13 Pass the expected httpd instance when calling set_pref()
process_request() only takes a single argument.
2018-05-02 00:00:30 +00:00
sevan babdc61a7b Enable checking arguments for validity.
Remove disabled code.
Fix function parameters.
Add support for Lua 5.3
2018-05-01 23:51:53 +00:00
christos 5f8b254caf - need string.h
- cast options to long for OpenSSL-1.1
2018-02-06 15:48:46 +00:00
maya 501cede865 Use a protocol-agnostic URL (don't degrade HTTPS->HTTP)
Suggested by Travis Paul in PR bin/52958.
2018-01-28 13:37:39 +00:00
wiz ffa84063eb 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.
2017-11-28 12:22:27 +00:00
martin e9e7c8e344 PR bin/52194: bozohttpd fails to exec scripts via the -C mechanism
sometimes with EFAULT due to not NULL terminated environment.
2017-11-28 10:33:51 +00:00
mrg 803cb099d6 s/u_int/unsigned/.
from Jan Danielsson.  increases/fixes portability.
2017-10-05 04:22:41 +00:00
mrg 68bd8b44d6 fix ordering of a couple of words. from Edgar Pettijohn in PR#52375.
thanks!
2017-07-07 07:05:49 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
alnsn 9a921db489 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.
2017-05-28 22:37:36 +00:00
riastradh ef315f7931 Remove MKCRYPTO option.
Originally, MKCRYPTO was introduced because the United States
classified cryptography as a munition and restricted its export.  The
export controls were substantially relaxed fifteen years ago, and are
essentially irrelevant for software with published source code.

In the intervening time, nobody bothered to remove the option after
its motivation -- the US export restriction -- was eliminated.  I'm
not aware of any other operating system that has a similar option; I
expect it is mainly out of apathy for churn that we still have it.
Today, cryptography is an essential part of modern computing -- you
can't use the internet responsibly without cryptography.

The position of the TNF board of directors is that TNF makes no
representation that MKCRYPTO=no satisfies any country's cryptography
regulations.

My personal position is that the availability of cryptography is a
basic human right; that any local laws restricting it to a privileged
few are fundamentally immoral; and that it is wrong for developers to
spend effort crippling cryptography to work around such laws.

As proposed on tech-crypto, tech-security, and tech-userlevel to no
objections:

https://mail-index.netbsd.org/tech-crypto/2017/05/06/msg000719.html
https://mail-index.netbsd.org/tech-security/2017/05/06/msg000928.html
https://mail-index.netbsd.org/tech-userlevel/2017/05/06/msg010547.html

P.S.  Reviewing all the uses of MKCRYPTO in src revealed a lot of
*bad* crypto that was conditional on it, e.g. DES in telnet...  That
should probably be removed too, but on the grounds that it is bad,
not on the grounds that it is (nominally) crypto.
2017-05-21 15:28:36 +00:00
mrg 002f468d50 uh, this is actually called 20170201 :-) 2017-02-05 01:55:03 +00:00
mrg 7dd016e517 fix the prototype for bozo_set_pref(). from cfkoch 2017-02-04 01:32:54 +00:00
mrg 630f2c0b49 call this bozohttpd 20170201. 2017-01-31 14:36:09 +00:00
mrg 2c19cec69e - fix a bug in cgi processing. from Dennis Lindroos.
- add a testcase for this, and expand test-simple to handle additional
  args to bozohttpd for eg, cgi-bin setting.
- fix objdir bugs in the testsuite.
2017-01-31 14:33:54 +00:00
abhinav b461520850 Fix typo: s/suport/support 2017-01-20 16:14:44 +00:00
schmonz 10c3be53a3 When testing non-verbosely, show diff on failure. ok mrg@ 2016-12-27 12:09:19 +00:00
abhinav cad7fa138e Fix sentences at a couple of places. 2016-12-21 09:33:08 +00:00
mrg 48524f008b there was a bug fix in july. call this 20160720. 2016-12-11 20:40:41 +00:00
mrg da548da125 update the -V documentation to be more clear about what it does.
inspired by Swift Griggs on netbsd-users.
2016-10-04 18:33:00 +00:00
mrg 5261f4fbc4 add -V to the usage() list. noted by Swift Griggs on netbsd-users. 2016-10-04 18:26:47 +00:00
schmonz 7ec9a291e1 Missed in previous: exit 1 if html_cmp says no match. 2016-09-26 00:21:22 +00:00
schmonz 268438cada Add a VERBOSE knob to the testsuite ("yes" by default, producing
basically the same output as before). When turned off, tests run
silently except when there's a failure.

Reviewed by mrg@.
2016-09-23 16:55:56 +00:00
mrg bfef5cee0b use netbsd rcsid 2016-08-20 00:36:41 +00:00
shm 1202090c01 Do not send encoding header for compressed formats. 2016-07-19 09:27:40 +00:00
mrg 9d18868a64 avoid an impossible case the compiler can't quite tell. 2016-06-30 13:17:48 +00:00
agc 205633288c As proposed in:
http://mail-index.netbsd.org/tech-userlevel/2016/05/18/msg009999.html

and

	https://www.netbsd.org/~agc/bozo-20160517.diff

add a patch to httpd to return the version string of httpd itself, and use the
-G option on the command line to enable this. This gives httpd the ability to
show, from the command line, what version is running.

	% /usr/build/obj/x86_64/usr/src/libexec/httpd/bozohttpd -G
	bozohttpd version bozohttpd/20160415
	%
2016-05-24 21:18:29 +00:00
christos f7945701d6 CID 1358679: Fix memory leak.
XXX: pullup 7
2016-04-24 18:24:47 +00:00
mrg 0a7cdc80ba use %zu instead of %lu for size_t. 2016-04-15 20:00:13 +00:00
mrg 27da98ff14 updates and bozohttpd 20160415:
o  add search-word support for CGI
o  fix a security issue in CGI suffix handler support which would
   allow remote code execution, from shm@netbsd.org
o  -C option supports now CGI scripts only
2016-04-15 17:57:21 +00:00
elric 591b978b80 Fix bug in cleanup of reply headers. 2016-01-02 20:35:59 +00:00
elric afe55bf842 Add the concept of ``reply headers'', that is a SIMPLEQ of headers that
will be included in the HTTP reply.  We define this as we are about to
add an authentication method that may need to have a conversation with
the client.
2016-01-02 18:40:13 +00:00
mrg 0841a79ea3 bump the version; we have real fixes now. 2015-12-31 04:58:43 +00:00
mrg 614a8b6713 redo the fix for rev 1.26 - instead of getting a new string wrong,
just delay the free until the parent has finished using them.
also, free query as well.

fixes PR#50374.
2015-12-31 04:39:16 +00:00
mrg 84411b5891 rewrite the redirection url generation code to use bozoasprintf(). 2015-12-29 04:30:33 +00:00
mrg c2e98309d5 - convert most asprintf() calls to bozoasprintf().
- don't call getpwuid(0) if we don't need to, or fail it it fails,
  and remove the 'username' member of bozohttpd_t since it is not
  used outside of bozo_setup().
2015-12-29 04:21:46 +00:00
mrg 881b8188de rename bozo_err/bozo_warn/bozo_asprintf to bozoerr/etc.
new rule is that function that mirror libc-style functions get no underscore.
2015-12-28 07:37:59 +00:00
mrg cff2d95613 several clean ups:
- bozostrdup() gains a request parameter, and uses it to determine
  what sort of error handling is required
- bozo_strdup() dies
- size_arrays() reduced slightly, pushing error handling into the caller
- convert to size_t for some array indices
- bozo_set_pref() and bozo_init_prefs() gain httpd parameters
- apply a bunch of manual CSE to vastly reduce the number of times the
  string "request->hr_httpd" appears.
- CGI parse_header() takes a request not httpd now

XXX: lua glue updated to call bozo_init_prefs() with htttpd parameter,
     but i'm only guessing here.
2015-12-27 10:21:35 +00:00
mrg 71e7babf6d fix running the testsuite from the build tree 2015-12-27 07:43:39 +00:00
christos f47ab3a37e Introduce bozo_strdup and bozo_asprintf to add error checking and reduce
code duplication.

Note that bozo_strdup is different that bozostrdup; the _ routines exit
loging error to syslog or stderr, whereas the non _ routines send error
responses to the http client.
2015-12-12 18:06:58 +00:00
christos 14ba256990 - restrict the default list of ciphers to something more secure
- restrict ssl options
From Travis Paul
2015-12-12 16:57:53 +00:00