summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2019-01-17 07:46:16 +0000
committermrg <mrg@NetBSD.org>2019-01-17 07:46:16 +0000
commit65b52e40da96893a5bb6bdbca8f031e4ac793a13 (patch)
tree118a435d37fa89ce82cbb1faf4d37bd3f387fd8f /libexec
parent9d81370fccdda1454167033134e36b3d7781fd22 (diff)
- call this 20190116
- adjust the directory indexing again: - don't include "index.html" in html headers - additional escaping of names - re-add top/bottom borders - adds an aquamarine table header - Zebra-stripes table rows using CSS instead of code all from "Rajeev V. Pillai" <rajeev_v_pillai@yahoo.com>
Diffstat (limited to 'libexec')
-rw-r--r--libexec/httpd/CHANGES7
-rw-r--r--libexec/httpd/bozohttpd.819
-rw-r--r--libexec/httpd/bozohttpd.c6
-rw-r--r--libexec/httpd/cgi-bozo.c4
-rw-r--r--libexec/httpd/daemon-bozo.c4
-rw-r--r--libexec/httpd/dir-index-bozo.c43
6 files changed, 52 insertions, 31 deletions
diff --git a/libexec/httpd/CHANGES b/libexec/httpd/CHANGES
index c6d151124fb..384ff969f56 100644
--- a/libexec/httpd/CHANGES
+++ b/libexec/httpd/CHANGES
@@ -1,8 +1,9 @@
-$NetBSD: CHANGES,v 1.35 2019/01/17 07:34:06 mrg Exp $
+$NetBSD: CHANGES,v 1.36 2019/01/17 07:46:16 mrg Exp $
changes in bozohttpd 20190116:
- o fix CGI '+' parameter handling, and a double free. from
- rajeev_v_pillai@yahoo.com
+ o fix CGI '+' parameter handling, some error checking, and a double
+ free. from rajeev_v_pillai@yahoo.com
+ o more directory indexing clean up. from rajeev_v_pillai@yahoo.com
changes in bozohttpd 20181215:
o fix .htpasswd bypass for authenticated users. reported by JP,
diff --git a/libexec/httpd/bozohttpd.8 b/libexec/httpd/bozohttpd.8
index 1ebef976f1c..167f6a26bd8 100644
--- a/libexec/httpd/bozohttpd.8
+++ b/libexec/httpd/bozohttpd.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: bozohttpd.8,v 1.77 2019/01/08 06:04:29 mrg Exp $
+.\" $NetBSD: bozohttpd.8,v 1.78 2019/01/17 07:46:16 mrg Exp $
.\"
.\" $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
.\"
@@ -597,7 +597,7 @@ The focus has always been simplicity and security, with minimal features
and regular code audits.
This manual documents
.Nm
-version 20181215.
+version 20190116.
.Sh AUTHORS
.An -nosplit
.Nm
@@ -632,7 +632,7 @@ provided cgi-bin support fixes, and more
.Aq Mt agc@NetBSD.org
cleaned up many internal interfaces, made
.Nm
-linkable as a library and provided the Lua binding.
+linkable as a library and provided the Lua binding
.It
.An DEGROOTE Arnaud
.Aq Mt degroote@NetBSD.org
@@ -688,7 +688,7 @@ provided many fixes and enhancements for the man page
fixed memory leaks, various issues with userdir support,
information disclosure issues, added support for using CGI handlers
with directory indexing, found several security issues and provided
-various other fixes.
+various other fixes
.It
.An Arnaud Lacombe
.Aq Mt alc@NetBSD.org
@@ -706,7 +706,7 @@ provided a cgi-bin fix
.Aq Mt jmmv@NetBSD.org
Added the
.Fl P
-option (pidfile support) and provided some man page fixes.
+option (pidfile support) and provided some man page fixes
.It
.An Luke Mewburn
.Aq Mt lukem@NetBSD.org
@@ -715,7 +715,8 @@ HTTP basic authorization support and much code clean up
.It
.An Rajeev V. Pillai
.Aq Mt rajeev_v_pillai@yahoo.com
-provided several fixes for virtual hosting and directory indexing
+provided several fixes for virtual hosting and directory indexing and
+fixes for CGI
.It
.An Jeremy C. Reed
.Aq Mt reed@NetBSD.org
@@ -737,11 +738,11 @@ provided minor compile fixes and a CGI content map fix
.Aq Mt rumble@ephemeral.org
provided the
.Fl V
-option.
+option
.It
.An Thor Lancelot Simon
.Aq Mt tls@NetBSD.org
-enhanced cgi-bin support.
+enhanced cgi-bin support
.It
.An Joerg Sonnenberger
.Aq Mt joerg@NetBSD.org
@@ -758,7 +759,7 @@ provided http authorization fixes
.Aq Mt xs@kittenz.org
provided chroot and change-to-user support, and other various fixes
.It
-Coyote Point provided various CGI fixes.
+Coyote Point provided various CGI fixes
.El
.Pp
There are probably others I have forgotten (let me know if you care)
diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c
index 787a9d57975..72b37ccb7e4 100644
--- a/libexec/httpd/bozohttpd.c
+++ b/libexec/httpd/bozohttpd.c
@@ -1,9 +1,9 @@
-/* $NetBSD: bozohttpd.c,v 1.107 2018/12/15 12:52:36 leot Exp $ */
+/* $NetBSD: bozohttpd.c,v 1.108 2019/01/17 07:46:16 mrg Exp $ */
/* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */
/*
- * Copyright (c) 1997-2018 Matthew R. Green
+ * Copyright (c) 1997-2019 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/20181215"
+#define SERVER_SOFTWARE "bozohttpd/20190116"
#endif
#ifndef PUBLIC_HTML
#define PUBLIC_HTML "public_html"
diff --git a/libexec/httpd/cgi-bozo.c b/libexec/httpd/cgi-bozo.c
index 9121dc26ffd..c9eea47dfe0 100644
--- a/libexec/httpd/cgi-bozo.c
+++ b/libexec/httpd/cgi-bozo.c
@@ -1,9 +1,9 @@
-/* $NetBSD: cgi-bozo.c,v 1.46 2019/01/17 07:34:06 mrg Exp $ */
+/* $NetBSD: cgi-bozo.c,v 1.47 2019/01/17 07:46:16 mrg Exp $ */
/* $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $ */
/*
- * Copyright (c) 1997-2018 Matthew R. Green
+ * Copyright (c) 1997-2019 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libexec/httpd/daemon-bozo.c b/libexec/httpd/daemon-bozo.c
index 3391c01b2b1..7d63a423b35 100644
--- a/libexec/httpd/daemon-bozo.c
+++ b/libexec/httpd/daemon-bozo.c
@@ -1,9 +1,9 @@
-/* $NetBSD: daemon-bozo.c,v 1.20 2019/01/17 07:34:06 mrg Exp $ */
+/* $NetBSD: daemon-bozo.c,v 1.21 2019/01/17 07:46:16 mrg Exp $ */
/* $eterna: daemon-bozo.c,v 1.24 2011/11/18 09:21:15 mrg Exp $ */
/*
- * Copyright (c) 1997-2018 Matthew R. Green
+ * Copyright (c) 1997-2019 Matthew R. Green
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/libexec/httpd/dir-index-bozo.c b/libexec/httpd/dir-index-bozo.c
index 858d5e562a9..1c0aa01e966 100644
--- a/libexec/httpd/dir-index-bozo.c
+++ b/libexec/httpd/dir-index-bozo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dir-index-bozo.c,v 1.29 2018/12/04 02:52:42 mrg Exp $ */
+/* $NetBSD: dir-index-bozo.c,v 1.30 2019/01/17 07:46:16 mrg Exp $ */
/* $eterna: dir-index-bozo.c,v 1.20 2011/11/18 09:21:15 mrg Exp $ */
@@ -56,8 +56,8 @@ bozo_dir_index(bozo_httpreq_t *request, const char *dirpath, int isindex)
struct dirent **de, **deo;
DIR *dp;
char buf[MAXPATHLEN];
- char *file = NULL, *printname = NULL;
- int k, j, i;
+ char *file = NULL, *printname = NULL, *p;
+ int k, j;
if (!isindex || !httpd->dir_indexing)
return 0;
@@ -106,20 +106,39 @@ bozo_dir_index(bozo_httpreq_t *request, const char *dirpath, int isindex)
#else
printname = bozostrdup(httpd, request, request->hr_file);
#endif /* !NO_USER_SUPPORT */
+ if ((p = strstr(printname, httpd->index_html)) != NULL) {
+ if (strcmp(printname, httpd->index_html) == 0)
+ strcpy(printname, "/"); /* is ``slashdir'' */
+ else
+ *p = '\0'; /* strip unwanted ``index_html'' */
+ }
+ if ((p = bozo_escape_html(httpd, printname)) != NULL) {
+ free(printname);
+ printname = p;
+ }
- bozo_printf(httpd, "<!DOCTYPE html>\r\n");
- bozo_printf(httpd, "<html><head><meta charset=\"utf-8\"/>\r\n");
- bozo_printf(httpd, "<style type=\"text/css\">tr.o {background:#f4f4f4;}</style>\r\n");
+ bozo_printf(httpd,
+ "<!DOCTYPE html>\r\n"
+ "<html><head><meta charset=\"utf-8\"/>\r\n"
+ "<style type=\"text/css\">\r\n"
+ "table {\r\n"
+ "\tborder-top: 1px solid black;\r\n"
+ "\tborder-bottom: 1px solid black;\r\n"
+ "}\r\n"
+ "th { background: aquamarine; }\r\n"
+ "tr:nth-child(even) { background: lavender; }\r\n"
+ "</style>\r\n");
bozo_printf(httpd, "<title>Index of %s</title></head>\r\n",
printname);
bozo_printf(httpd, "<body><h1>Index of %s</h1>\r\n",
printname);
- bozo_printf(httpd, "<table>\r\n<thead>\r\n");
- bozo_printf(httpd, "<tr class=\"o\"><th>Name<th>Last modified<th align=right>Size\r\n");
- bozo_printf(httpd, "<tbody>\r\n");
+ bozo_printf(httpd,
+ "<table cols=3>\r\n<thead>\r\n"
+ "<tr><th>Name<th>Last modified<th align=right>Size\r\n"
+ "<tbody>\r\n");
- for (j = k = scandir(dirpath, &de, NULL, alphasort), deo = de, i = 1;
- j--; de++, i++) {
+ for (j = k = scandir(dirpath, &de, NULL, alphasort), deo = de;
+ j--; de++) {
int nostat = 0;
char *name = (*de)->d_name;
char *urlname, *htmlname;
@@ -137,7 +156,7 @@ bozo_dir_index(bozo_httpreq_t *request, const char *dirpath, int isindex)
htmlname = bozo_escape_html(httpd, name);
if (htmlname == NULL)
htmlname = name;
- bozo_printf(httpd, "<tr class=\"%s\"><td>", (i & 1) ? "o" : "e");
+ bozo_printf(httpd, "<tr><td>");
if (strcmp(name, "..") == 0) {
bozo_printf(httpd, "<a href=\"../\">");
bozo_printf(httpd, "Parent Directory");