[openssl-commits] [openssl] master update
Rich Salz
rsalz at openssl.org
Fri Feb 3 14:56:10 UTC 2017
The branch master has been updated
via 8f85aa6bd3737547634bbbe1e141f728674fb594 (commit)
from bc1dba209533f2033a4de0d93380fc0f485e6f7e (commit)
- Log -----------------------------------------------------------------
commit 8f85aa6bd3737547634bbbe1e141f728674fb594
Author: Robert Scheck <robert at fedoraproject.org>
Date: Sat Jan 28 00:52:27 2017 +0100
Add NNTP support (RFC 4642) to s_client ("-starttls nntp")
Reviewed-by: Andy Polyakov <appro at openssl.org>
Reviewed-by: Rich Salz <rsalz at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2310)
-----------------------------------------------------------------------
Summary of changes:
apps/s_client.c | 31 ++++++++++++++++++++++++++++++-
doc/man1/s_client.pod | 2 +-
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/apps/s_client.c b/apps/s_client.c
index 99770b9..d9dbe70 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -746,7 +746,8 @@ typedef enum PROTOCOL_choice {
PROTO_CONNECT,
PROTO_IRC,
PROTO_POSTGRES,
- PROTO_LMTP
+ PROTO_LMTP,
+ PROTO_NNTP
} PROTOCOL_CHOICE;
static const OPT_PAIR services[] = {
@@ -760,6 +761,7 @@ static const OPT_PAIR services[] = {
{"irc", PROTO_IRC},
{"postgres", PROTO_POSTGRES},
{"lmtp", PROTO_LMTP},
+ {"nntp", PROTO_NNTP},
{NULL, 0}
};
@@ -2172,6 +2174,33 @@ int s_client_main(int argc, char **argv)
goto shut;
}
break;
+ case PROTO_NNTP:
+ {
+ int foundit = 0;
+ BIO *fbio = BIO_new(BIO_f_buffer());
+
+ BIO_push(fbio, sbio);
+ BIO_gets(fbio, mbuf, BUFSIZZ);
+ /* STARTTLS command requires CAPABILITIES... */
+ BIO_printf(fbio, "CAPABILITIES\r\n");
+ (void)BIO_flush(fbio);
+ /* wait for multi-line CAPABILITIES response */
+ do {
+ mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
+ if (strstr(mbuf, "STARTTLS"))
+ foundit = 1;
+ } while (mbuf_len > 1 && mbuf[0] != '.');
+ (void)BIO_flush(fbio);
+ BIO_pop(fbio);
+ BIO_free(fbio);
+ if (!foundit)
+ BIO_printf(bio_err,
+ "Didn't find STARTTLS in server response,"
+ " trying anyway...\n");
+ BIO_printf(sbio, "STARTTLS\r\n");
+ BIO_read(sbio, sbuf, BUFSIZZ);
+ }
+ break;
}
for (;;) {
diff --git a/doc/man1/s_client.pod b/doc/man1/s_client.pod
index 2ebd682..fb1680a 100644
--- a/doc/man1/s_client.pod
+++ b/doc/man1/s_client.pod
@@ -437,7 +437,7 @@ command for more information.
send the protocol-specific message(s) to switch to TLS for communication.
B<protocol> is a keyword for the intended protocol. Currently, the only
supported keywords are "smtp", "pop3", "imap", "ftp", "xmpp", "xmpp-server",
-"irc", "postgres" and "lmtp".
+"irc", "postgres", "lmtp" and "nntp".
=item B<-xmpphost hostname>
More information about the openssl-commits
mailing list