diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/CHANGES libexec/httpd/CHANGES --- /usr/7/src/libexec/httpd/CHANGES 2016-04-15 13:19:39.000000000 -0700 +++ libexec/httpd/CHANGES 2016-08-19 17:36:41.000000000 -0700 @@ -1,4 +1,7 @@ -$eterna: CHANGES,v 1.78 2011/11/18 01:25:11 mrg Exp $ +$NetBSD: CHANGES,v 1.24 2016/08/20 00:36:41 mrg Exp $ + +changes in bozohttpd 20160517: + o add a bozo_get_version() function which returns the version number changes in bozohttpd 20160415: o add search-word support for CGI diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/bozohttpd.8 libexec/httpd/bozohttpd.8 --- /usr/7/src/libexec/httpd/bozohttpd.8 2016-04-15 13:19:39.000000000 -0700 +++ libexec/httpd/bozohttpd.8 2016-12-11 12:40:41.000000000 -0800 @@ -2,7 +2,7 @@ .\" .\" $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $ .\" -.\" Copyright (c) 1997-2015 Matthew R. Green +.\" Copyright (c) 1997-2016 Matthew R. Green .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 12, 2015 +.Dd December 11, 2016 .Dt BOZOHTTPD 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nd hyper text transfer protocol version 1.1 daemon .Sh SYNOPSIS .Nm -.Op Fl EHVXefhnsu +.Op Fl EGHVXefhnsu .Op Fl C Ar suffix cgihandler .Op Fl I Ar port .Op Fl L Ar prefix script @@ -132,6 +132,10 @@ Stops the flag from .Nm detaching from the tty and going into the background. +.It Fl G +Get the +.Nm +version string, print it on standard output, and exit. .It Fl H Causes directory index mode to hide files and directories that start with a period, except for @@ -272,8 +276,9 @@ translation. Note that enabling this support implies that users can run commands as web server user, this may have security implications. .It Fl V -Sets the default virtual host directory to -.Ar slashdir . +Sets the backup virtual host directory to the +.Ar slashdir +argument. If no directory exists in .Ar virtualroot for the request, then @@ -526,7 +531,7 @@ The focus has always been simplicity and and regular code audits. This manual documents .Nm -version 20150501. +version 20160720. .Sh AUTHORS .An -nosplit .Nm diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/bozohttpd.c libexec/httpd/bozohttpd.c --- /usr/7/src/libexec/httpd/bozohttpd.c 2016-04-15 13:19:39.000000000 -0700 +++ libexec/httpd/bozohttpd.c 2016-12-11 12:40:41.000000000 -0800 @@ -3,7 +3,7 @@ /* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */ /* - * Copyright (c) 1997-2015 Matthew R. Green + * Copyright (c) 1997-2016 Matthew R. Green * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,7 +109,7 @@ #define INDEX_HTML "index.html" #endif #ifndef SERVER_SOFTWARE -#define SERVER_SOFTWARE "bozohttpd/20160415" +#define SERVER_SOFTWARE "bozohttpd/20160720" #endif #ifndef DIRECT_ACCESS_FILE #define DIRECT_ACCESS_FILE ".bzdirect" @@ -2244,6 +2244,7 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs extern char **environ; static char *cleanenv[1] = { NULL }; uid_t uid; + int uidset = 0; char *chrootdir; char *username; char *portnum; @@ -2339,6 +2340,7 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs bozoerr(httpd, 1, "setgid(%u): %s", pw->pw_gid, strerror(errno)); uid = pw->pw_uid; + uidset = 1; } /* * handle chroot. @@ -2353,7 +2355,7 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs strerror(errno)); } - if (username != NULL && setuid(uid) == -1) + if (uidset && setuid(uid) == -1) bozoerr(httpd, 1, "setuid(%d): %s", uid, strerror(errno)); /* @@ -2375,3 +2377,9 @@ bozo_setup(bozohttpd_t *httpd, bozoprefs return 1; } + +int +bozo_get_version(char *buf, size_t size) +{ + return snprintf(buf, size, "%s", SERVER_SOFTWARE); +} diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/bozohttpd.h libexec/httpd/bozohttpd.h --- /usr/7/src/libexec/httpd/bozohttpd.h 2016-04-15 13:19:39.000000000 -0700 +++ libexec/httpd/bozohttpd.h 2016-06-01 17:28:23.000000000 -0700 @@ -367,4 +367,6 @@ bozoheaders_t *addmerge_replheader(bozo_ int bozo_set_pref(bozohttpd_t *, bozoprefs_t *, const char *, const char *); char *bozo_get_pref(bozoprefs_t *, const char *); +int bozo_get_version(char */*buf*/, size_t /*size*/); + #endif /* BOZOHTTOPD_H_ */ diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/cgi-bozo.c libexec/httpd/cgi-bozo.c --- /usr/7/src/libexec/httpd/cgi-bozo.c 2016-04-15 13:24:30.000000000 -0700 +++ libexec/httpd/cgi-bozo.c 2016-05-01 00:33:59.000000000 -0700 @@ -333,12 +333,12 @@ parse_search_string(bozo_httpreq_t *requ parse_err: - free (*args); free (str); - *args = NULL; + free (*args); + free(args); *args_len = 0; - return 0; + return NULL; } diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/content-bozo.c libexec/httpd/content-bozo.c --- /usr/7/src/libexec/httpd/content-bozo.c 2016-04-15 01:22:12.000000000 -0700 +++ libexec/httpd/content-bozo.c 2016-07-20 16:54:22.000000000 -0700 @@ -62,16 +62,16 @@ static bozo_content_map_t static_content { ".pac", "application/x-ns-proxy-autoconfig", "", "", NULL }, { ".pa", "application/x-ns-proxy-autoconfig", "", "", NULL }, { ".tar", "multipart/x-tar", "", "", NULL }, - { ".gtar", "multipart/x-gtar", "", "", NULL }, - { ".tar.Z", "multipart/x-tar", "x-compress", "compress", NULL }, - { ".tar.gz", "multipart/x-tar", "x-gzip", "gzip", NULL }, - { ".taz", "multipart/x-tar", "x-gzip", "gzip", NULL }, - { ".tgz", "multipart/x-tar", "x-gzip", "gzip", NULL }, - { ".tar.z", "multipart/x-tar", "x-pack", "x-pack", NULL }, - { ".Z", "application/x-compress", "x-compress", "compress", NULL }, - { ".gz", "application/x-gzip", "x-gzip", "gzip", NULL }, - { ".z", "unknown", "x-pack", "x-pack", NULL }, - { ".bz2", "application/x-bzip2", "x-bzip2", "x-bzip2", NULL }, + { ".gtar", "application/x-gtar-compressed", "", "", NULL }, + { ".tar.Z", "application/x-gtar-compressed", "", "", NULL }, + { ".tar.gz", "application/x-gtar-compressed", "", "", NULL }, + { ".taz", "application/x-gtar-compressed", "", "", NULL }, + { ".tgz", "application/x-gtar-compressed", "", "", NULL }, + { ".tar.z", "application/x-gtar-compressed", "", "", NULL }, + { ".Z", "application/x-compress", "", "", NULL }, + { ".gz", "application/x-gzip", "", "", NULL }, + { ".z", "unknown", "", "", NULL }, + { ".bz2", "application/x-bzip2", "", "", NULL }, { ".ogg", "application/x-ogg", "", "", NULL }, { ".mkv", "video/x-matroska", "", "", NULL }, { ".xbel", "text/xml", "", "", NULL }, diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/main.c libexec/httpd/main.c --- /usr/7/src/libexec/httpd/main.c 2016-04-15 01:22:12.000000000 -0700 +++ libexec/httpd/main.c 2016-10-04 14:33:19.000000000 -0700 @@ -4,7 +4,7 @@ /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp */ /* - * Copyright (c) 1997-2014 Matthew R. Green + * Copyright (c) 1997-2016 Matthew R. Green * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -101,6 +101,7 @@ usage(bozohttpd_t *httpd, char *progname bozowarn(httpd, " -v virtualroot\tenable virtual host support " "in this directory"); + bozowarn(httpd, " -V\t\tUnknown virtual hosts go to `slashdir'"); #ifndef NO_DIRINDEX_SUPPORT bozowarn(httpd, " -X\t\t\tenable automatic directory index support"); @@ -118,6 +119,7 @@ usage(bozohttpd_t *httpd, char *progname " and private key file\n" "\t\t\tin pem format and enable bozohttpd in SSL mode"); #endif /* NO_SSL_SUPPORT */ + bozowarn(httpd, " -G print version number and exit"); bozoerr(httpd, 1, "%s failed to start", progname); } @@ -148,7 +150,7 @@ main(int argc, char **argv) */ while ((c = getopt(argc, argv, - "C:EHI:L:M:P:S:U:VXZ:bc:defhi:np:st:uv:x:z:")) != -1) { + "C:EGHI:L:M:P:S:U:VXZ:bc:defhi:np:st:uv:x:z:")) != -1) { switch (c) { case 'L': @@ -351,6 +353,15 @@ main(int argc, char **argv) #endif /* NO_DIRINDEX_SUPPORT */ + case 'G': + { + char version[128]; + + bozo_get_version(version, sizeof(version)); + printf("bozohttpd version %s\n", version); + } + return 0; + default: usage(&httpd, progname); /* NOTREACHED */ diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/testsuite/Makefile libexec/httpd/testsuite/Makefile --- /usr/7/src/libexec/httpd/testsuite/Makefile 2016-04-15 01:22:12.000000000 -0700 +++ libexec/httpd/testsuite/Makefile 2016-09-24 12:43:43.000000000 -0700 @@ -7,26 +7,31 @@ BOZOHTTPD?= ../bozohttpd BOZOHTTPD?= ../debug/bozohttpd-debug WGET?= wget DATA?= $(.CURDIR)/data +VERBOSE?= yes + +.if ${VERBOSE} != "yes" +SILENT= @ +.else +SILENT= +.endif + all: clean: - for a in $(SIMPLETESTS); do \ - rm -f tmp.$$a.out; \ + for a in $(SIMPLETESTS) $(BIGFILETESTS); do \ + rm -f tmp.$$a.out tmp.$$a.err; \ done check: check-simple check-bigfile check-simple: .for a in $(SIMPLETESTS) - echo "Running test $a" - $(BOZOHTTPD) "$(DATA)" < $(.CURDIR)/$a.in > tmp.$a.out || true - $(.CURDIR)/html_cmp $(.CURDIR)/$a.out tmp.$a.out + ${SILENT}$(.CURDIR)/test-simple "$a" "${BOZOHTTPD}" "${DATA}" "${VERBOSE}" .endfor check-bigfile: .for a in $(BIGFILETESTS) - echo "Running test $a" - $(.CURDIR)/test-bigfile "$a" "${BOZOHTTPD}" "${WGET}" "$(DATA)" + ${SILENT}$(.CURDIR)/test-bigfile "$a" "${BOZOHTTPD}" "${WGET}" "${DATA}" "${VERBOSE}" .endfor .include diff -bwpur -x .CVS -I '$NetBSD:' /usr/7/src/libexec/httpd/testsuite/test-bigfile libexec/httpd/testsuite/test-bigfile --- /usr/7/src/libexec/httpd/testsuite/test-bigfile 2016-04-15 01:22:12.000000000 -0700 +++ libexec/httpd/testsuite/test-bigfile 2016-09-24 12:43:43.000000000 -0700 @@ -4,6 +5,13 @@ test="$1" # partial4000 or partial8000 bozohttpd="$2" wget="$3" datadir="$4" +verbose="$5" + +if [ "yes" = "$verbose" ]; then + echo "Running test $test" +else + exec 2>tmp.$test.err +fi bozotestport=11111 @@ -23,5 +31,6 @@ if cmp ./bigfile ${datadir}/bigfile; the exit 0 else rm -f ./bigfile + [ "yes" = "$verbose" ] || echo "Failed test $test: `cat tmp.$test.err`" exit 1 fi Only in libexec/httpd/testsuite: test-simple