PROTO_CONNECT,
PROTO_IRC,
PROTO_POSTGRES,
- PROTO_LMTP
+ PROTO_LMTP,
+ PROTO_NNTP
} PROTOCOL_CHOICE;
static const OPT_PAIR services[] = {
{"irc", PROTO_IRC},
{"postgres", PROTO_POSTGRES},
{"lmtp", PROTO_LMTP},
+ {"nntp", PROTO_NNTP},
{NULL, 0}
};
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 (;;) {
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>