mirror of https://github.com/openssl/openssl.git
Make '-name' option of the 's_client' more generic
And also make '-xmpphost' an alias of the '-name' option. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4524)
This commit is contained in:
parent
cc1c473d70
commit
8176431d59
|
|
@ -589,7 +589,7 @@ typedef enum OPTION_choice {
|
||||||
OPT_KEY, OPT_RECONNECT, OPT_BUILD_CHAIN, OPT_CAFILE, OPT_NOCAFILE,
|
OPT_KEY, OPT_RECONNECT, OPT_BUILD_CHAIN, OPT_CAFILE, OPT_NOCAFILE,
|
||||||
OPT_CHAINCAFILE, OPT_VERIFYCAFILE, OPT_NEXTPROTONEG, OPT_ALPN,
|
OPT_CHAINCAFILE, OPT_VERIFYCAFILE, OPT_NEXTPROTONEG, OPT_ALPN,
|
||||||
OPT_SERVERINFO, OPT_STARTTLS, OPT_SERVERNAME, OPT_NOSERVERNAME, OPT_ASYNC,
|
OPT_SERVERINFO, OPT_STARTTLS, OPT_SERVERNAME, OPT_NOSERVERNAME, OPT_ASYNC,
|
||||||
OPT_USE_SRTP, OPT_KEYMATEXPORT, OPT_KEYMATEXPORTLEN, OPT_SMTPHOST,
|
OPT_USE_SRTP, OPT_KEYMATEXPORT, OPT_KEYMATEXPORTLEN, OPT_PROTOHOST,
|
||||||
OPT_MAX_SEND_FRAG, OPT_SPLIT_SEND_FRAG, OPT_MAX_PIPELINES, OPT_READ_BUF,
|
OPT_MAX_SEND_FRAG, OPT_SPLIT_SEND_FRAG, OPT_MAX_PIPELINES, OPT_READ_BUF,
|
||||||
OPT_KEYLOG_FILE, OPT_EARLY_DATA, OPT_REQCAFILE,
|
OPT_KEYLOG_FILE, OPT_EARLY_DATA, OPT_REQCAFILE,
|
||||||
OPT_V_ENUM,
|
OPT_V_ENUM,
|
||||||
|
|
@ -655,7 +655,7 @@ const OPTIONS s_client_options[] = {
|
||||||
{"starttls", OPT_STARTTLS, 's',
|
{"starttls", OPT_STARTTLS, 's',
|
||||||
"Use the appropriate STARTTLS command before starting TLS"},
|
"Use the appropriate STARTTLS command before starting TLS"},
|
||||||
{"xmpphost", OPT_XMPPHOST, 's',
|
{"xmpphost", OPT_XMPPHOST, 's',
|
||||||
"Host to use with \"-starttls xmpp[-server]\""},
|
"Alias of -name option for \"-starttls xmpp[-server]\""},
|
||||||
OPT_R_OPTIONS,
|
OPT_R_OPTIONS,
|
||||||
{"sess_out", OPT_SESS_OUT, '>', "File to write SSL session to"},
|
{"sess_out", OPT_SESS_OUT, '>', "File to write SSL session to"},
|
||||||
{"sess_in", OPT_SESS_IN, '<', "File to read SSL session from"},
|
{"sess_in", OPT_SESS_IN, '<', "File to read SSL session from"},
|
||||||
|
|
@ -666,8 +666,8 @@ const OPTIONS s_client_options[] = {
|
||||||
{"keymatexportlen", OPT_KEYMATEXPORTLEN, 'p',
|
{"keymatexportlen", OPT_KEYMATEXPORTLEN, 'p',
|
||||||
"Export len bytes of keying material (default 20)"},
|
"Export len bytes of keying material (default 20)"},
|
||||||
{"fallback_scsv", OPT_FALLBACKSCSV, '-', "Send the fallback SCSV"},
|
{"fallback_scsv", OPT_FALLBACKSCSV, '-', "Send the fallback SCSV"},
|
||||||
{"name", OPT_SMTPHOST, 's',
|
{"name", OPT_PROTOHOST, 's',
|
||||||
"Hostname to use for \"-starttls lmtp\" or \"-starttls smtp\""},
|
"Hostname to use for \"-starttls lmtp\", \"-starttls smtp\" or \"-starttls xmpp[-server]\""},
|
||||||
{"CRL", OPT_CRL, '<', "CRL file to use"},
|
{"CRL", OPT_CRL, '<', "CRL file to use"},
|
||||||
{"crl_download", OPT_CRL_DOWNLOAD, '-', "Download CRL from distribution points"},
|
{"crl_download", OPT_CRL_DOWNLOAD, '-', "Download CRL from distribution points"},
|
||||||
{"CRLform", OPT_CRLFORM, 'F', "CRL format (PEM or DER) PEM is default"},
|
{"CRLform", OPT_CRLFORM, 'F', "CRL format (PEM or DER) PEM is default"},
|
||||||
|
|
@ -885,8 +885,7 @@ int s_client_main(int argc, char **argv)
|
||||||
char *passarg = NULL, *pass = NULL, *vfyCApath = NULL, *vfyCAfile = NULL;
|
char *passarg = NULL, *pass = NULL, *vfyCApath = NULL, *vfyCAfile = NULL;
|
||||||
char *ReqCAfile = NULL;
|
char *ReqCAfile = NULL;
|
||||||
char *sess_in = NULL, *crl_file = NULL, *p;
|
char *sess_in = NULL, *crl_file = NULL, *p;
|
||||||
char *xmpphost = NULL;
|
const char *protohost = NULL;
|
||||||
const char *ehlo = "mail.example.com";
|
|
||||||
struct timeval timeout, *timeoutp;
|
struct timeval timeout, *timeoutp;
|
||||||
fd_set readfds, writefds;
|
fd_set readfds, writefds;
|
||||||
int noCApath = 0, noCAfile = 0;
|
int noCApath = 0, noCAfile = 0;
|
||||||
|
|
@ -1058,10 +1057,9 @@ int s_client_main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case OPT_XMPPHOST:
|
case OPT_XMPPHOST:
|
||||||
xmpphost = opt_arg();
|
/* fall through, since this is an alias */
|
||||||
break;
|
case OPT_PROTOHOST:
|
||||||
case OPT_SMTPHOST:
|
protohost = opt_arg();
|
||||||
ehlo = opt_arg();
|
|
||||||
break;
|
break;
|
||||||
case OPT_VERIFY:
|
case OPT_VERIFY:
|
||||||
verify = SSL_VERIFY_PEER;
|
verify = SSL_VERIFY_PEER;
|
||||||
|
|
@ -2098,10 +2096,12 @@ int s_client_main(int argc, char **argv)
|
||||||
do {
|
do {
|
||||||
mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
|
mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
|
||||||
} while (mbuf_len > 3 && mbuf[3] == '-');
|
} while (mbuf_len > 3 && mbuf[3] == '-');
|
||||||
|
if (protohost == NULL)
|
||||||
|
protohost = "mail.example.com";
|
||||||
if (starttls_proto == (int)PROTO_LMTP)
|
if (starttls_proto == (int)PROTO_LMTP)
|
||||||
BIO_printf(fbio, "LHLO %s\r\n", ehlo);
|
BIO_printf(fbio, "LHLO %s\r\n", protohost);
|
||||||
else
|
else
|
||||||
BIO_printf(fbio, "EHLO %s\r\n", ehlo);
|
BIO_printf(fbio, "EHLO %s\r\n", protohost);
|
||||||
(void)BIO_flush(fbio);
|
(void)BIO_flush(fbio);
|
||||||
/*
|
/*
|
||||||
* Wait for multi-line response to end LHLO LMTP or EHLO SMTP
|
* Wait for multi-line response to end LHLO LMTP or EHLO SMTP
|
||||||
|
|
@ -2187,7 +2187,7 @@ int s_client_main(int argc, char **argv)
|
||||||
"xmlns:stream='http://etherx.jabber.org/streams' "
|
"xmlns:stream='http://etherx.jabber.org/streams' "
|
||||||
"xmlns='jabber:%s' to='%s' version='1.0'>",
|
"xmlns='jabber:%s' to='%s' version='1.0'>",
|
||||||
starttls_proto == PROTO_XMPP ? "client" : "server",
|
starttls_proto == PROTO_XMPP ? "client" : "server",
|
||||||
xmpphost ? xmpphost : host);
|
protohost ? protohost : host);
|
||||||
seen = BIO_read(sbio, mbuf, BUFSIZZ);
|
seen = BIO_read(sbio, mbuf, BUFSIZZ);
|
||||||
if (seen < 0) {
|
if (seen < 0) {
|
||||||
BIO_printf(bio_err, "BIO_read failed\n");
|
BIO_printf(bio_err, "BIO_read failed\n");
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ B<openssl> B<s_client>
|
||||||
[B<-serverpref>]
|
[B<-serverpref>]
|
||||||
[B<-starttls protocol>]
|
[B<-starttls protocol>]
|
||||||
[B<-xmpphost hostname>]
|
[B<-xmpphost hostname>]
|
||||||
|
[B<-name hostname>]
|
||||||
[B<-engine id>]
|
[B<-engine id>]
|
||||||
[B<-tlsextdebug>]
|
[B<-tlsextdebug>]
|
||||||
[B<-no_ticket>]
|
[B<-no_ticket>]
|
||||||
|
|
@ -514,6 +515,22 @@ specifies the host for the "to" attribute of the stream element.
|
||||||
If this option is not specified, then the host specified with "-connect"
|
If this option is not specified, then the host specified with "-connect"
|
||||||
will be used.
|
will be used.
|
||||||
|
|
||||||
|
This option is an alias of the B<-name> option for "xmpp" and "xmpp-server".
|
||||||
|
|
||||||
|
=item B<-name hostname>
|
||||||
|
|
||||||
|
This option is used to specify hostname information for various protocols
|
||||||
|
used with B<-starttls> option. Currently only "xmpp", "xmpp-server",
|
||||||
|
"smtp" and "lmtp" can utilize this B<-name> option.
|
||||||
|
|
||||||
|
If this option is used with "-starttls xmpp" or "-starttls xmpp-server",
|
||||||
|
if specifies the host for the "to" attribute of the stream element. If this
|
||||||
|
option is not specified, then the host specified with "-connect" will be used.
|
||||||
|
|
||||||
|
If this option is used with "-starttls lmtp" or "-starttls smtp", it specifies
|
||||||
|
the name to use in the "LMTP LHLO" or "SMTP EHLO" message, respectively. If
|
||||||
|
this option is not specified, then "mail.example.com" will be used.
|
||||||
|
|
||||||
=item B<-tlsextdebug>
|
=item B<-tlsextdebug>
|
||||||
|
|
||||||
Print out a hex dump of any TLS extensions received from the server.
|
Print out a hex dump of any TLS extensions received from the server.
|
||||||
|
|
@ -680,7 +697,8 @@ L<SSL_CTX_set_max_pipelines(3)>
|
||||||
|
|
||||||
=head1 HISTORY
|
=head1 HISTORY
|
||||||
|
|
||||||
The -no_alt_chains options was first added to OpenSSL 1.1.0.
|
The B<-no_alt_chains> option was first added to OpenSSL 1.1.0.
|
||||||
|
The B<-name> option was added in OpenSSL 1.1.1.
|
||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue