summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2021-03-30 16:05:56 +0000
committerclaudio <claudio@openbsd.org>2021-03-30 16:05:56 +0000
commit3d03f852eb32f3322e6ecc9b79ae0c74d056306b (patch)
treed8e84d958c02bbe2d9b6b8269100aae4cccd24d5 /usr.sbin
parentSome cards announce support for the NTB16 format, but that support does not (diff)
downloadwireguard-openbsd-3d03f852eb32f3322e6ecc9b79ae0c74d056306b.tar.xz
wireguard-openbsd-3d03f852eb32f3322e6ecc9b79ae0c74d056306b.zip
Make http_new() take care of all the error handling. By closing the
outfd and sending back the failure report via http_fail(). This was partially done in the failure case of http_resolv() and resulted in double failure reports in that case. With and OK tb@, previous version OK deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rpki-client/http.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c
index 04a1a4b7ab2..c9a0a725d0c 100644
--- a/usr.sbin/rpki-client/http.c
+++ b/usr.sbin/rpki-client/http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: http.c,v 1.11 2021/03/29 15:37:04 claudio Exp $ */
+/* $OpenBSD: http.c,v 1.12 2021/03/30 16:05:56 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@@ -402,6 +402,8 @@ http_new(size_t id, char *uri, char *modified_since, int outfd)
if (http_parse_uri(uri, &host, &port, &path) == -1) {
free(uri);
free(modified_since);
+ close(outfd);
+ http_fail(id);
return NULL;
}
@@ -1197,10 +1199,7 @@ proc_http(char *bind_addr, int fd)
io_str_read(fd, &mod);
h = http_new(id, uri, mod, outfd);
- if (h == NULL) {
- close(outfd);
- http_fail(id);
- } else
+ if (h != NULL) {
for (i = 0; i < MAX_CONNECTIONS; i++) {
if (http_conns[i] != NULL)
continue;
@@ -1209,6 +1208,7 @@ proc_http(char *bind_addr, int fd)
http_conns[i] = NULL;
break;
}
+ }
}
if (pfds[MAX_CONNECTIONS].revents & POLLOUT) {
switch (msgbuf_write(&msgq)) {