/* 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\"/>");
+ /* Also offer non-SASL authentication
+ cprintf("<auth xmlns=\"http://jabber.org/features/iq-auth\"/>"); */
}
/* Offer binding and sessions as part of our feature set */
safestrncpy(XMPP->iq_query_xmlns, supplied_el, sizeof XMPP->iq_query_xmlns);
}
+ else if (!strcasecmp(el, "bind")) {
+ XMPP->bind_requested = 1;
+ }
+
else if (!strcasecmp(el, "iq")) {
for (i=0; attr[i] != NULL; i+=2) {
if (!strcasecmp(attr[i], "type")) {
/*
* If this <iq> stanza was a "bind" attempt, process it ...
*/
- else if ( (!IsEmptyStr(XMPP->iq_id)) && (!IsEmptyStr(XMPP->iq_client_resource)) ) {
+ else if (
+ (XMPP->bind_requested)
+ && (!IsEmptyStr(XMPP->iq_id))
+ && (!IsEmptyStr(XMPP->iq_client_resource))
+ && (CC->logged_in)
+ ) {
/* Generate the "full JID" of the client resource */
XMPP->iq_client_resource[0] = 0;
XMPP->iq_session = 0;
XMPP->iq_query_xmlns[0] = 0;
+ XMPP->bind_requested = 0;
}
else if (!strcasecmp(el, "auth")) {
char message_to[256];
char *message_body; /* Message body in transit */
int html_tag_level; /* <html> tag nesting level */
+
+ int bind_requested; /* In this stanza, client is asking server to bind a resource. */
};
#define XMPP ((struct citxmpp *)CC->session_specific_data)
jabber_iq_roster_query();
}
+ else if (!strcasecmp(query_xmlns, "jabber:iq:auth:query")) {
+ cprintf("<query xmlns=\"jabber:iq:auth\">"
+ "<username/><password/><resource/>"
+ "</query>"
+ );
+ }
+
/*
* 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.