Source-Changes-HG archive

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

[src/trunk]: src/libexec/httpd send close_notify for the ssl connection befor...



details:   https://anonhg.NetBSD.org/src/rev/3eb0ab0c482b
branches:  trunk
changeset: 942785:3eb0ab0c482b
user:      spz <spz%NetBSD.org@localhost>
date:      Thu Aug 20 05:46:31 2020 +0000

description:
send close_notify for the ssl connection before closing the TCP connection
Thanks to Dr. Thomas Orgis for reporting the issue.

diffstat:

 libexec/httpd/bozohttpd.c |   4 +++-
 libexec/httpd/bozohttpd.h |   4 +++-
 libexec/httpd/cgi-bozo.c  |   4 +++-
 libexec/httpd/ssl-bozo.c  |  11 ++++++++++-
 4 files changed, 19 insertions(+), 4 deletions(-)

diffs (86 lines):

diff -r a88de8e3a994 -r 3eb0ab0c482b libexec/httpd/bozohttpd.c
--- a/libexec/httpd/bozohttpd.c Thu Aug 20 03:09:34 2020 +0000
+++ b/libexec/httpd/bozohttpd.c Thu Aug 20 05:46:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.c,v 1.117 2020/07/13 09:38:57 jruoho Exp $   */
+/*     $NetBSD: bozohttpd.c,v 1.118 2020/08/20 05:46:31 spz Exp $      */
 
 /*     $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $      */
 
@@ -1912,6 +1912,8 @@
  cleanup:
        close(fd);
  cleanup_nofd:
+       /* If SSL enabled send close_notify. */
+       bozo_ssl_shutdown(request->hr_httpd);
        close(STDIN_FILENO);
        close(STDOUT_FILENO);
        /*close(STDERR_FILENO);*/
diff -r a88de8e3a994 -r 3eb0ab0c482b libexec/httpd/bozohttpd.h
--- a/libexec/httpd/bozohttpd.h Thu Aug 20 03:09:34 2020 +0000
+++ b/libexec/httpd/bozohttpd.h Thu Aug 20 05:46:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bozohttpd.h,v 1.62 2020/07/11 08:10:52 jruoho Exp $    */
+/*     $NetBSD: bozohttpd.h,v 1.63 2020/08/20 05:46:31 spz Exp $       */
 
 /*     $eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $       */
 
@@ -312,6 +312,7 @@
 #define bozo_ssl_set_ciphers(w, x)                     bozo_noop
 #define bozo_ssl_init(x)                               bozo_noop
 #define bozo_ssl_accept(x)                             (0)
+#define bozo_ssl_shutdown(x)                           bozo_noop
 #define bozo_ssl_destroy(x)                            bozo_noop
 #define have_ssl                                       (0)
 #else
@@ -319,6 +320,7 @@
 void   bozo_ssl_set_ciphers(bozohttpd_t *, const char *);
 void   bozo_ssl_init(bozohttpd_t *);
 int    bozo_ssl_accept(bozohttpd_t *);
+void   bozo_ssl_shutdown(bozohttpd_t *);
 void   bozo_ssl_destroy(bozohttpd_t *);
 #define have_ssl                                       (1)
 #endif
diff -r a88de8e3a994 -r 3eb0ab0c482b libexec/httpd/cgi-bozo.c
--- a/libexec/httpd/cgi-bozo.c  Thu Aug 20 03:09:34 2020 +0000
+++ b/libexec/httpd/cgi-bozo.c  Thu Aug 20 05:46:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgi-bozo.c,v 1.49 2019/12/06 05:53:20 mrg Exp $        */
+/*     $NetBSD: cgi-bozo.c,v 1.50 2020/08/20 05:46:31 spz Exp $        */
 
 /*     $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $        */
 
@@ -637,6 +637,8 @@
                /* child reader/writer */
                close(STDIN_FILENO);
                finish_cgi_output(httpd, request, sv[0], nph);
+               /* if we do SSL, send a SSL_shutdown now */
+               bozo_ssl_shutdown(request->hr_httpd);
                /* if we're done output, our parent is useless... */
                kill(getppid(), SIGKILL);
                debug((httpd, DEBUG_FAT, "done processing cgi output"));
diff -r a88de8e3a994 -r 3eb0ab0c482b libexec/httpd/ssl-bozo.c
--- a/libexec/httpd/ssl-bozo.c  Thu Aug 20 03:09:34 2020 +0000
+++ b/libexec/httpd/ssl-bozo.c  Thu Aug 20 05:46:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ssl-bozo.c,v 1.26 2019/02/28 08:28:21 mrg Exp $        */
+/*     $NetBSD: ssl-bozo.c,v 1.27 2020/08/20 05:46:31 spz Exp $        */
 
 /*     $eterna: ssl-bozo.c,v 1.15 2011/11/18 09:21:15 mrg Exp $        */
 
@@ -287,6 +287,15 @@
 }
 
 void
+bozo_ssl_shutdown(bozohttpd_t *httpd)
+{
+       const sslinfo_t *sslinfo = httpd->sslinfo;
+
+       if (sslinfo && sslinfo->bozossl)
+               SSL_shutdown(sslinfo->bozossl);
+}
+
+void
 bozo_ssl_destroy(bozohttpd_t *httpd)
 {
        const sslinfo_t *sslinfo = httpd->sslinfo;



Home | Main Index | Thread Index | Old Index