}
}
- 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);
}
}
- 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);
}
/*
- * 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\"/>"
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
}
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;
);
}
+ /*
+ * 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>");
}