* more debugging
authorArt Cancro <ajc@citadel.org>
Mon, 22 Feb 2010 19:02:14 +0000 (19:02 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 22 Feb 2010 19:02:14 +0000 (19:02 +0000)
citadel/modules/xmpp/serv_xmpp.c
citadel/modules/xmpp/xmpp_query_namespace.c

index 0b7da46e9cf755380a2e2acb456fb9f0db4e77bd..c239ee56b435991ba07dad990de16a731142829c 100644 (file)
@@ -207,7 +207,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                }
        }
 
-       if (!strcasecmp(el, "username")) {              /* NON SASL ONLY */
+       else if (!strcasecmp(el, "username")) {         /* NON SASL ONLY */
                if (XMPP->chardata_len > 0) {
                        safestrncpy(XMPP->iq_client_username, XMPP->chardata,
                                sizeof XMPP->iq_client_username);
@@ -215,7 +215,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                }
        }
 
-       if (!strcasecmp(el, "password")) {              /* NON SASL ONLY */
+       else if (!strcasecmp(el, "password")) {         /* NON SASL ONLY */
                if (XMPP->chardata_len > 0) {
                        safestrncpy(XMPP->iq_client_password, XMPP->chardata,
                                sizeof XMPP->iq_client_password);
@@ -253,10 +253,13 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                        }
 
                        /*
-                        * Unknown queries ... return the XML equivalent of a blank stare
+                        * Unknown query ... return the XML equivalent of a blank stare
                         */
                        else {
-                               CtdlLogPrintf(CTDL_DEBUG, "Unknown query; <service-unavailable/>\n");
+                               CtdlLogPrintf(CTDL_DEBUG,
+                                       "Unknown query <%s> - returning <service-unavailable/>\n",
+                                       el
+                               );
                                cprintf("<iq type=\"error\" id=\"%s\">", XMPP->iq_id);
                                cprintf("<error code=\"503\" type=\"cancel\">"
                                        "<service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
@@ -374,12 +377,12 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
 
        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;
+               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;
+               cprintf("<failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
+               CC->kill_me = 1;
 #endif
        }
 
@@ -387,6 +390,10 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                XMPP->ping_requested = 1;
        }
 
+       else {
+               CtdlLogPrintf(CTDL_DEBUG, "Ignoring unknown tag <%s>\n", el);
+       }
+
        XMPP->chardata_len = 0;
        if (XMPP->chardata_alloc > 0) {
                XMPP->chardata[0] = 0;
index 5bfe7ae11641fd11ed2210ab2d311831432134a3..6dad562b399ac1d16f642a00ff6d770ff7c8998c 100644 (file)
@@ -158,17 +158,21 @@ void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_x
                );
        }
 
+       /*
+        * If we didn't hit any known query namespaces then we should deliver a
+        * "service unavailable" error (see RFC3921 section 2.4 and 11.1.5.4)
+        */
+
        else {
-               CtdlLogPrintf(CTDL_DEBUG, "Unknown namespace; returning <service-unavailable/>\n");
+               CtdlLogPrintf(CTDL_DEBUG,
+                       "Unknown query namespace '%s' - returning <service-unavailable/>\n",
+                       query_xmlns
+               );
                cprintf("<error code=\"503\" type=\"cancel\">"
                        "<service-unavailable xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
                        "</error>"
                );
        }
 
-       /*
-        * End of query result.  If we didn't hit any known namespaces then we should
-        * deliver a "service unavailable" error (see RFC3921 section 2.4 and 11.1.5.4)
-        */
        cprintf("</iq>");
 }