NetBSD Problem Report #54785
From www@netbsd.org Wed Dec 18 22:01:37 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 8BE097A153
for <gnats-bugs@gnats.NetBSD.org>; Wed, 18 Dec 2019 22:01:37 +0000 (UTC)
Message-Id: <20191218220136.811467A1C8@mollari.NetBSD.org>
Date: Wed, 18 Dec 2019 22:01:36 +0000 (UTC)
From: edgar@pettijohn-web.com
Reply-To: edgar@pettijohn-web.com
To: gnats-bugs@NetBSD.org
Subject: bozo_set_defaults() returns 0 on sucess instead of 1
X-Send-Pr-Version: www-1.0
>Number: 54785
>Category: lib
>Synopsis: bozo_set_defaults() returns 0 on sucess instead of 1
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 18 22:05:00 +0000 2019
>Closed-Date: Mon Mar 14 06:00:36 +0000 2022
>Last-Modified: Sun Feb 04 06:15:01 +0000 2024
>Originator: Edgar Pettijohn
>Release: 9.0_RC1 12/18/2019
>Organization:
>Environment:
9.0_RC1 NetBSD 9.0_RC1 (GENERIC) #0: Wed Nov 27 16:14:52 UTC 2019 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
libbozohttpd.3 claims bozo_set_defaults will return 1 on success and 0 on failure. This is incorrect.
>How-To-Repeat:
#include <bozohttpd.h>
#include <err.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
bozohttpd_t httpd;
bozoprefs_t prefs;
bozo_httpreq_t *request;
/* this will fail but shouldn't */
if (!bozo_set_defaults(&httpd, &prefs))
err(1, "bozo_set_defaults");
if (!bozo_set_pref(&httpd, &prefs, "bind address", "127.0.0.1"))
err(1, "set_pref: bind address");
if (!bozo_set_pref(&httpd, &prefs, "port number", "5000"))
err(1, "set_pref: port number");
if (!bozo_set_pref(&httpd, &prefs, "background", "1"))
err(1, "set_pref: background");
bozo_setup(&httpd, &prefs, NULL, "/var/www");
do {
if ((request = bozo_read_request(&httpd)) != NULL) {
bozo_process_request(request);
bozo_clean_request(request);
}
} while (httpd.background);
return 0;
}
>Fix:
Either change the code or the manual. Personally think it would be better to change the code so the return value is in line with others.
Index: bozohttpd.c
===================================================================
RCS file: /cvsroot/src/libexec/httpd/bozohttpd.c,v
retrieving revision 1.86.4.4
diff -u -r1.86.4.4 bozohttpd.c
--- bozohttpd.c 12 Jun 2019 10:32:00 -0000 1.86.4.4
+++ bozohttpd.c 18 Dec 2019 21:50:43 -0000
@@ -2465,19 +2465,19 @@
(void) memset(prefs, 0x0, sizeof(*prefs));
/* set up default values */
- if (!bozo_set_pref(httpd, prefs, "server software", SERVER_SOFTWARE))
+ if (bozo_set_pref(httpd, prefs, "server software", SERVER_SOFTWARE))
rv = 1;
- if (!bozo_set_pref(httpd, prefs, "index.html", INDEX_HTML))
+ if (bozo_set_pref(httpd, prefs, "index.html", INDEX_HTML))
rv = 1;
- if (!bozo_set_pref(httpd, prefs, "public_html", PUBLIC_HTML))
+ if (bozo_set_pref(httpd, prefs, "public_html", PUBLIC_HTML))
rv = 1;
- if (!bozo_set_pref(httpd, prefs, "ssl timeout", SSL_TIMEOUT))
+ if (bozo_set_pref(httpd, prefs, "ssl timeout", SSL_TIMEOUT))
rv = 1;
- if (!bozo_set_pref(httpd, prefs, "initial timeout", INITIAL_TIMEOUT))
+ if (bozo_set_pref(httpd, prefs, "initial timeout", INITIAL_TIMEOUT))
rv = 1;
- if (!bozo_set_pref(httpd, prefs, "header timeout", HEADER_WAIT_TIME))
+ if (bozo_set_pref(httpd, prefs, "header timeout", HEADER_WAIT_TIME))
rv = 1;
- if (!bozo_set_pref(httpd, prefs, "request timeout", TOTAL_MAX_REQ_TIME))
+ if (bozo_set_pref(httpd, prefs, "request timeout", TOTAL_MAX_REQ_TIME))
rv = 1;
return rv;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Mon, 14 Mar 2022 06:00:36 +0000
State-Changed-Why:
fixed, thanks for the report, sorry it took so long to handle.
From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54785 CVS commit: src/libexec/httpd
Date: Mon, 14 Mar 2022 05:58:36 +0000
Module Name: src
Committed By: mrg
Date: Mon Mar 14 05:58:36 UTC 2022
Modified Files:
src/libexec/httpd: bozohttpd.c
Log Message:
in bozo_init_prefs(), default to returning 1 (success) and if a
bozo_set_pref() fails, return 0 instead. fixes PR#54785 but with
a different patch.
To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/libexec/httpd/bozohttpd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54785 CVS commit: pkgsrc/www/bozohttpd
Date: Sun, 4 Feb 2024 06:13:49 +0000
Module Name: pkgsrc
Committed By: mrg
Date: Sun Feb 4 06:13:49 UTC 2024
Modified Files:
pkgsrc/www/bozohttpd: Makefile distinfo
Log Message:
update to bozohttpd 20240126.
changes include:
o add some more default mime types.
o fix memory leaks. from shm.
o fix reading 2 bytes beyond '%', possibly not mapped. from shm.
o support openssl 3. from christos.
o add -q option to not log. from martin.
o fix default return value of bozo_set_defaults(), PR#54785.
o remove obsolete .bzdirect handling.
o new "-m tlsversion" option to set the minimum TLS version
available. partially from <sunil@nimmagadda.net>.
o extend the list of available ciphers to include most of the
openssl "HIGH" with some additional disables. retain the current
list of bad options. should deal with PR#51278.
To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 pkgsrc/www/bozohttpd/Makefile
cvs rdiff -u -r1.77 -r1.78 pkgsrc/www/bozohttpd/distinfo
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.