Hi,
i'm not an ssl hacker at all, but while debugging openssl -starttls
issues against an xmpp server, i stumbled upon
https://rt.openssl.org/Ticket/Display.html?id=2860&user=guest&pass=guest
which fixes some issue with -starttls xmpp and adds the possibility to
use -xmpphost in case there's some virtualhost. Backported the patch to
libressl and applied style(9), works fine here in basic testing against
prosody, before -starttls xmpp host was just stalling. I havent touched
the documentation chunks since i dont really know if we still use the
pod format or...
comments/feedback welcome.
Landry
Index: s_client.c
===================================================================
RCS file: /cvs/src/usr.bin/openssl/s_client.c,v
retrieving revision 1.13
diff -u -r1.13 s_client.c
--- s_client.c 14 Apr 2015 12:56:36 -0000 1.13
+++ s_client.c 6 Jul 2015 11:36:07 -0000
@@ -335,6 +335,7 @@
char *port = PORT_STR;
int full_log = 1;
char *host = SSL_HOST_NAME;
+ char *xmpphost = NULL;
char *proxy = NULL, *connect = NULL;
char *cert_file = NULL, *key_file = NULL;
int cert_format = FORMAT_PEM, key_format = FORMAT_PEM;
@@ -415,6 +416,10 @@
if (--argc < 1)
goto bad;
proxy = *(++argv);
+ } else if (strcmp(*argv,"-xmpphost") == 0) {
+ if (--argc < 1)
+ goto bad;
+ xmpphost= *(++argv);
} else if (strcmp(*argv, "-verify") == 0) {
verify = SSL_VERIFY_PEER;
if (--argc < 1)
@@ -985,13 +990,16 @@
int seen = 0;
BIO_printf(sbio, "<stream:stream "
"xmlns:stream='http://etherx.jabber.org/streams' "
- "xmlns='jabber:client' to='%s' version='1.0'>", host);
+ "xmlns='jabber:client' to='%s' version='1.0'>", xmpphost?
xmpphost:host);
seen = BIO_read(sbio, mbuf, BUFSIZZ);
mbuf[seen] = 0;
- while (!strstr(mbuf, "<starttls
xmlns='urn:ietf:params:xml:ns:xmpp-tls'")) {
- if (strstr(mbuf, "/stream:features>"))
- goto shut;
+ while (!strstr(mbuf, "<starttls
xmlns='urn:ietf:params:xml:ns:xmpp-tls'") &&
+ !strstr(mbuf, "<starttls
xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"")) {
seen = BIO_read(sbio, mbuf, BUFSIZZ);
+
+ if (seen <= 0)
+ goto shut;
+
mbuf[seen] = 0;
}
BIO_printf(sbio, "<starttls
xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");