diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-05-25 17:32:26 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-06-13 15:13:21 +0200 |
commit | 5a2ba207ed94e79db606f80cf2873367e2a843bf (patch) | |
tree | 9b55b4b8961424cc144ed24092fed7c0a960e9e2 /apps/ocsp.c | |
parent | 1693135564d00e34ca9f41ff785b5d60e3500415 (diff) |
Add request URL path checking and status responses to HTTP server
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11998)
Diffstat (limited to 'apps/ocsp.c')
-rw-r--r-- | apps/ocsp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/ocsp.c b/apps/ocsp.c index fd03611fe9..6095e6b2f6 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -234,7 +234,7 @@ int ocsp_main(int argc, char **argv) int noCAfile = 0, noCApath = 0, noCAstore = 0; int accept_count = -1, add_nonce = 1, noverify = 0, use_ssl = -1; int vpmtouched = 0, badsig = 0, i, ignore_err = 0, nmin = 0, ndays = -1; - int req_text = 0, resp_text = 0, ret = 1; + int req_text = 0, resp_text = 0, res, ret = 1; int req_timeout = -1; long nsec = MAX_VALIDITY_PERIOD, maxage = -1; unsigned long sign_flags = 0, verify_flags = 0, rflags = 0; @@ -629,13 +629,17 @@ redo_accept: #endif req = NULL; - if (!do_responder(&req, &cbio, acbio, req_timeout)) + res = do_responder(&req, &cbio, acbio, req_timeout); + if (res == 0) goto redo_accept; if (req == NULL) { - resp = OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, - NULL); - send_ocsp_response(cbio, resp); + if (res == 1) { + resp = + OCSP_response_create(OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, + NULL); + send_ocsp_response(cbio, resp); + } goto done_resp; } } @@ -1151,7 +1155,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio, { #ifndef OPENSSL_NO_SOCK return http_server_get_asn1_req(ASN1_ITEM_rptr(OCSP_RESPONSE), - (ASN1_VALUE **)preq, pcbio, acbio, + (ASN1_VALUE **)preq, NULL, pcbio, acbio, prog, 1 /* accept_get */, timeout); #else BIO_printf(bio_err, |