Initial XMPP STARTTLS code; commented out because it doesn't work
authorArt Cancro <ajc@citadel.org>
Mon, 3 Dec 2007 06:33:25 +0000 (06:33 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 3 Dec 2007 06:33:25 +0000 (06:33 +0000)
citadel/modules/jabber/serv_xmpp.c

index 8ebe3a5bde3fd7c78b473076b79606e9695fe07f..210d19820c2dada7c46dae4d476570aa489427ef 100644 (file)
@@ -79,6 +79,13 @@ void xmpp_stream_start(void *data, const char *supplied_el, const char **attr)
        /* The features of this stream are... */
        cprintf("<stream:features>");
 
+#ifdef HAVE_OPENSSL_XXXX_COMMENTED_OUT
+       /* TLS encryption (but only if it isn't already active) */
+       if (!CC->redirect_ssl) {
+               cprintf("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'></starttls>");
+       }
+#endif
+
        if (!CC->logged_in) {
                /* If we're not logged in yet, offer SASL as our feature set */
                xmpp_output_auth_mechs();
@@ -291,6 +298,17 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                --XMPP->html_tag_level;
        }
 
+       else if (!strcasecmp(el, "starttls")) {
+#ifdef HAVE_OPENSSL
+       cprintf("<proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
+       CtdlModuleStartCryptoMsgs(NULL, NULL, NULL);
+       if (!CC->redirect_ssl) CC->kill_me = 1;
+#else
+       cprintf("<failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
+       CC->kill_me = 1;
+#endif
+       }
+
        XMPP->chardata_len = 0;
        if (XMPP->chardata_alloc > 0) {
                XMPP->chardata[0] = 0;