Began (but did not complete) implementation
authorArt Cancro <ajc@citadel.org>
Thu, 6 Dec 2007 05:11:05 +0000 (05:11 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 6 Dec 2007 05:11:05 +0000 (05:11 +0000)
of XEP-0078 - non-SASL authentication for Jabber sessions.
This is a deprecated protocol but some clients (such as
CenterIM) still seem to use it.

citadel/modules/jabber/serv_xmpp.c
citadel/modules/jabber/serv_xmpp.h
citadel/modules/jabber/xmpp_query_namespace.c
citadel/modules/jabber/xmpp_sasl_service.c

index a75d6e146974260aa291caadaa8e27d958ec0b3c..964d66573805f186fc39bd09fb7f1e0385453d03 100644 (file)
@@ -89,6 +89,9 @@ void xmpp_stream_start(void *data, const char *supplied_el, const char **attr)
        if (!CC->logged_in) {
                /* If we're not logged in yet, offer SASL as our feature set */
                xmpp_output_auth_mechs();
+
+               /* Also offer non-SASL authentication */
+               cprintf("<auth xmlns=\"http://jabber.org/features/iq-auth\"/>");
        }
 
        /* Offer binding and sessions as part of our feature set */
index b3d55d09fe9babd4460a24a216e25df563ae1ad1..e0805a6939a0ee208dbec8b80e56f7c9c5081152 100644 (file)
@@ -60,3 +60,4 @@ void xmpp_process_events(void);
 void xmpp_presence_notify(char *, char *);
 void jabber_roster_item(struct CitContext *);
 void jabber_send_message(char *, char *);
+void jabber_offer_non_sasl_authentication(void);
index 5cca906393f3b0b0c1827462e54cc37c99c39d55..f1d49a188ebde6ae72c449f80371a7a175a055f5 100644 (file)
@@ -113,10 +113,15 @@ void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_x
        /*
         * Is this a query we know how to handle?
         */
+
        if (!strcasecmp(query_xmlns, "jabber:iq:roster:query")) {
                jabber_iq_roster_query();
        }
 
+       else if (!strcasecmp(query_xmlns, "jabber:iq:auth")) {
+               jabber_offer_non_sasl_authentication();
+       }
+
        /*
         * End of query result.  If we didn't hit any known namespaces then we will
         * have simply delivered an empty result stanza, which should be ok.
index 2595423d82002a3305fca0c0ed21488f98d8dbc7..41458597404a9ced5466c985e03dbdc0a14f61b1 100644 (file)
@@ -119,4 +119,17 @@ void xmpp_sasl_auth(char *sasl_auth_mech, char *authstring) {
        }
 }
 
+/*
+ * Offer non-SASL authentication to legacy clients.
+ */
+void jabber_offer_non_sasl_authentication(void) {
+       cprintf("<query xmlns=\"jabber:iq:auth\">"
+               "<username/>"
+               "<password/>"
+               /* "<digest/>" */
+               /* "<resource/>" */
+               "</query>"
+       );
+}
+
 #endif /* HAVE_EXPAT */