Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd various updates from <henrik%gulbra.net@localhost> / fre...



details:   https://anonhg.NetBSD.org/src/rev/8f2f4e49beea
branches:  trunk
changeset: 940701:8f2f4e49beea
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Oct 15 04:21:53 2020 +0000

description:
various updates from <henrik%gulbra.net@localhost> / freebsd.  the list from Henrik:

bozohttpd.8:
    o Added -d flag to the man page
    o Moved -E flag in man page to keep alphabetic order
    o Grammar fix for description of -E flag in man page
    o Moved a word in the man description for the -f flag
    o Made -f imply -b as a backwards-compatible shortcut
    o Updated man description of -n to mention Lua scripts
    o Moved -z below -Z to keep the uppercase options first

bozohttpd.c:
    o Removed obsolete comment about ~user missing cgi-bin support
    o Removed "/* ARGSUSED */" lines; was that a macro or a reminder?
    o Added USE_ARG macro call for sig, which was otherwise not used
    o Added USE_ARG macro call for msg (only used if debug is enabled)

bozohttpd.h:
    o Fixed typo in the include guard (BOZOHTTOPD_H_ -> BOZOHTTPD_H_)
    o Renamed have_all to have_core; it didn't mean "all" options

content-bozo.c:
    o Added USE_ARG macro call for signo, which was otherwise not used
    o Made -f imply -b as a backwards-compatible shortcut

main.c:
    o Simplified -b text to be symmetric with that for the -f option
    o Updated -C text to make "suffix" explicit; it's better than "arg"
    o Changed to only show the -E description if have_user is true
    o Always show the -e option, which incorrectly used the -E logic
    o Renamed have_all to have_core; it didn't mean "all" options
    o Added three missing tabs for the description of the -G option
    o Updated -L text to make "prefix" explicit; it's better than "arg"
    o Updated -M text to make "suffix" explicit; it's slightly better
    o Added a previously missing description for the -n option
    o Documented the otherwise obscure valid types for the -T option
    o Shortened "username" to "user" to match the actual help text
    o Moved handling of -c below that for -C to standardize the order
    o Broke the enabling test for -C into two lines for consistency
    o Inverted the enabling test for -E; this is what was meant, right?
    o Removed the enabling test for -e, which should always be enabled

ssl-bozo.c:
    o Added USE_ARG for httpd, which is not used if SSL has been excluded

diffstat:

 libexec/httpd/CHANGES        |   5 ++-
 libexec/httpd/bozohttpd.8    |  44 +++++++++++++++++---------------
 libexec/httpd/bozohttpd.c    |   9 +++--
 libexec/httpd/bozohttpd.h    |  12 ++++----
 libexec/httpd/cgi-bozo.c     |   4 +-
 libexec/httpd/content-bozo.c |   5 +--
 libexec/httpd/daemon-bozo.c  |  16 +++++++----
 libexec/httpd/main.c         |  59 +++++++++++++++++++++++--------------------
 libexec/httpd/ssl-bozo.c     |  17 ++++++++----
 9 files changed, 94 insertions(+), 77 deletions(-)

diffs (truncated from 525 to 300 lines):

diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/CHANGES
--- a/libexec/httpd/CHANGES     Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/CHANGES     Thu Oct 15 04:21:53 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.43 2020/10/15 02:19:23 mrg Exp $
+$NetBSD: CHANGES,v 1.44 2020/10/15 04:21:53 mrg Exp $
 
 changes in bozohttpd 20201014:
        o  also set -D_GNU_SOURCE in Makefile.boot.  from
@@ -6,6 +6,9 @@
        o  fix array size botch (assertion, not exploitable.)  from
           martin%netbsd.org@localhost.
        o  also match %2F as well as %2f.  from leah%vuxu.org@localhost.
+       o  many manual and help fixes.  clean ups for higher lint levels,
+          consistency/style clean ups.  various option fixes including made
+          -f imply -b.  from <henrik%gulbra.net@localhost> for freebsd.
 
 changes in bozohttpd 20200912:
        o  add .m4a and .m4v file extensions.
diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/bozohttpd.8
--- a/libexec/httpd/bozohttpd.8 Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/bozohttpd.8 Thu Oct 15 04:21:53 2020 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: bozohttpd.8,v 1.85 2020/10/15 02:19:23 mrg Exp $
+.\"    $NetBSD: bozohttpd.8,v 1.86 2020/10/15 04:21:53 mrg Exp $
 .\"
 .\"    $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
 .\"
@@ -34,14 +34,14 @@
 .Nd hyper text transfer protocol version 1.1 daemon
 .Sh SYNOPSIS
 .Nm
-.Op Fl EGHVXefhnsu
+.Op Fl EGHVXdefhnsu
 .Op Fl C Ar suffix cgihandler
 .Op Fl I Ar port
 .Op Fl L Ar prefix script
 .Op Fl M Ar suffix type encoding encoding11
 .Op Fl P Ar pidfile
 .Op Fl R Ar readme
-.Op Fl S Ar server_software
+.Op Fl S Ar version
 .Op Fl T Ar type timeout
 .Op Fl U Ar username
 .Op Fl Z Ar cert privkey
@@ -120,6 +120,14 @@
 translation using
 .Fl E
 switch.
+.It Fl d
+Enables debug support.
+.It Fl E
+Enables CGI/1.1 interface for
+.Em ~user
+translation.
+Note that enabling this support implies that users can run commands
+as the web server user. This may have security implications.
 .It Fl e
 Causes
 .Nm
@@ -131,9 +139,11 @@
 .It Fl f
 Stops the
 .Fl b
-flag from
+flag from detaching
 .Nm
-detaching from the tty and going into the background.
+from the tty and going into the background. This implies the
+.Fl b
+flag.
 .It Fl G
 Get the
 .Nm
@@ -212,12 +222,10 @@
 .It Fl n
 Stops
 .Nm
-from doing IP address to name resolution of hosts for setting the
+from doing IP address to name resolution of remote hosts.
+This affects the
 .Ev REMOTE_HOST
-variable before running a CGI program.
-This option has no effect without the
-.Fl c
-option.
+environment variable for CGI programs and Lua scripts.
 .It Fl P Ar pidfile
 Causes
 .Nm
@@ -237,9 +245,9 @@
 When directory indexing is enabled, include the contents of the file
 .Ar readme
 in the footer of the directory index.
-.It Fl S Ar server_software
+.It Fl S Ar version
 Sets the internal server version to
-.Ar server_software .
+.Ar version .
 .It Fl s
 Forces logging to be set to stderr always.
 .It Fl T Ar type timeout
@@ -290,12 +298,6 @@
 (but see the
 .Fl p
 option above).
-.It Fl E
-Enables CGI/1.1 interface for
-.Em ~user
-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 backup virtual host directory to the
 .Ar slashdir
@@ -330,15 +332,15 @@
 .Dq index.html
 to
 .Ar index .
-.It Fl z Ar ciphers
-Sets the list of SSL ciphers (see
-.Xr SSL_CTX_set_cipher_list 3 ) .
 .It Fl Z Ar certificate_path privatekey_path
 Sets the path to the server certificate file and the private key file
 in PEM format.
 It also causes
 .Nm
 to start SSL mode.
+.It Fl z Ar ciphers
+Sets the list of SSL ciphers (see
+.Xr SSL_CTX_set_cipher_list 3 ) .
 .El
 .Pp
 Note that in
diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/bozohttpd.c Thu Oct 15 04:21:53 2020 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: bozohttpd.c,v 1.122 2020/10/15 02:19:23 mrg Exp $      */
+/*     $NetBSD: bozohttpd.c,v 1.123 2020/10/15 04:21:53 mrg Exp $      */
 
 /*     $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $      */
 
 /*
- * Copyright (c) 1997-2019 Matthew R. Green
+ * Copyright (c) 1997-2020 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,6 @@
  *     - CGI/1.1 this will only be provided for "system" scripts
  *     - automatic "missing trailing slash" redirections
  *     - configurable translation of /~user/ to ~user/public_html,
- *       however, this does not include cgi-bin support
  *     - access lists via libwrap via inetd/tcpd
  *     - virtual hosting
  *     - not that we do not even pretend to understand MIME, but
@@ -373,6 +372,7 @@
 static void
 alarmer(int sig)
 {
+       USE_ARG(sig);
        bozo_timeout_hit = 1;
 }
 
@@ -2192,7 +2192,6 @@
 #endif /* !NO_BLOCKLIST_SUPPORT */
 
 /* the follow functions and variables are used in handling HTTP errors */
-/* ARGSUSED */
 int
 bozo_http_error(bozohttpd_t *httpd, int code, bozo_httpreq_t *request,
                const char *msg)
@@ -2205,6 +2204,8 @@
        int     size;
        bozoheaders_t *hdr;
 
+       USE_ARG(msg);
+
        debug((httpd, DEBUG_FAT, "bozo_http_error %d: %s", code, msg));
        if (header == NULL || reason == NULL) {
                bozoerr(httpd, 1,
diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/bozohttpd.h
--- a/libexec/httpd/bozohttpd.h Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/bozohttpd.h Thu Oct 15 04:21:53 2020 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: bozohttpd.h,v 1.64 2020/10/15 02:19:23 mrg Exp $       */
+/*     $NetBSD: bozohttpd.h,v 1.65 2020/10/15 04:21:53 mrg Exp $       */
 
 /*     $eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $       */
 
 /*
- * Copyright (c) 1997-2019 Matthew R. Green
+ * Copyright (c) 1997-2020 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,8 +29,8 @@
  * SUCH DAMAGE.
  *
  */
-#ifndef BOZOHTTOPD_H_
-#define BOZOHTTOPD_H_  1
+#ifndef BOZOHTTPD_H_
+#define BOZOHTTPD_H_   1
 
 #include "netbsd_queue.h"
 
@@ -307,7 +307,7 @@
 
 #define bozo_noop      do { /* nothing */ } while (/*CONSTCOND*/0)
 
-#define have_all                                       (1)
+#define have_core                                      (1)
 
 /* ssl-bozo.c */
 #ifdef NO_SSL_SUPPORT
@@ -459,4 +459,4 @@
 
 extern volatile sig_atomic_t   bozo_timeout_hit;
 
-#endif /* BOZOHTTOPD_H_ */
+#endif /* BOZOHTTPD_H_ */
diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/cgi-bozo.c
--- a/libexec/httpd/cgi-bozo.c  Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/cgi-bozo.c  Thu Oct 15 04:21:53 2020 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: cgi-bozo.c,v 1.50 2020/08/20 05:46:31 spz Exp $        */
+/*     $NetBSD: cgi-bozo.c,v 1.51 2020/10/15 04:21:53 mrg Exp $        */
 
 /*     $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $        */
 
 /*
- * Copyright (c) 1997-2019 Matthew R. Green
+ * Copyright (c) 1997-2020 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/content-bozo.c
--- a/libexec/httpd/content-bozo.c      Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/content-bozo.c      Thu Oct 15 04:21:53 2020 +0000
@@ -1,9 +1,9 @@
-/*     $NetBSD: content-bozo.c,v 1.18 2020/09/12 14:44:25 rhialto Exp $        */
+/*     $NetBSD: content-bozo.c,v 1.19 2020/10/15 04:21:53 mrg Exp $    */
 
 /*     $eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $    */
 
 /*
- * Copyright (c) 1997-2018 Matthew R. Green
+ * Copyright (c) 1997-2020 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -213,7 +213,6 @@
 /*
  * given the file name, return a valid Content-Type: value.
  */
-/* ARGSUSED */
 const char *
 bozo_content_type(bozo_httpreq_t *request, const char *file)
 {
diff -r 48bab355534d -r 8f2f4e49beea libexec/httpd/daemon-bozo.c
--- a/libexec/httpd/daemon-bozo.c       Thu Oct 15 02:54:10 2020 +0000
+++ b/libexec/httpd/daemon-bozo.c       Thu Oct 15 04:21:53 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: daemon-bozo.c,v 1.21 2019/01/17 07:46:16 mrg Exp $     */
+/*     $NetBSD: daemon-bozo.c,v 1.22 2020/10/15 04:21:53 mrg Exp $     */
 
 /*     $eterna: daemon-bozo.c,v 1.24 2011/11/18 09:21:15 mrg Exp $     */
 
@@ -62,26 +62,27 @@
 #ifndef INFTIM
 #define INFTIM -1
 #endif
+#ifndef USE_ARG
+#define USE_ARG(x)     /*LINTED*/(void)&(x)
+#endif
 
 static const char* pidfile_path = NULL;
 static pid_t pidfile_pid = 0;
 
-/* ARGSUSED */
 static void
 sigchild(int signo)
 {
-
+       USE_ARG(signo);
        while (waitpid(-1, NULL, WNOHANG) > 0)
                /* nothing */;
 }
 
 /* Signal handler to exit in a controlled manner.  This ensures that
  * any atexit(3) handlers are properly executed. */
-/* ARGSUSED */
 BOZO_DEAD static void
 controlled_exit(int signo)
 {
-
+       USE_ARG(signo);
        exit(EXIT_SUCCESS);



Home | Main Index | Thread Index | Old Index