s_client -proxy / -starttls shouldn't be mutually exclusive
authorVita Batrla <vitezslav.batrla@oracle.com>
Fri, 18 Mar 2022 21:02:50 +0000 (22:02 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 5 May 2022 11:37:54 +0000 (13:37 +0200)
commit2ff09a3f7b875a9f4367c1fb2d0e24fa51dd7674
tree3b7e4a3c8788c395c5f20f396b3e4e92641cfbfe
parent9ddab6a008c6614f7858d5ae971a7e4afc19ca15
s_client -proxy / -starttls shouldn't be mutually exclusive

The option -proxy of openssl s_client works fine. The option
-starttls also works fine. However, try putting both of them
on command line. It breaks, these options don't work together.

The problem is that -proxy option is implemented using starttls_proto
(the option parsing code sets it to PROTO_CONNECT) and -starttls option
overwrites the same variable again based on argument value.

The suggested fix is to independently handle -proxy option before
-starttls so the s_client can connect through HTTP proxy server and
then use STARTTLS command.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17925)

(cherry picked from commit 802cacf34f2db9111becb4f0d3aa00460df13a19)
apps/s_client.c