From 033602a4cb26bddbac35e4c39257d6225f29ebd8 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Tue, 28 Jun 2005 23:13:59 +0000 Subject: [PATCH] Fixed two bugs. The first bug was that if no stream:features was received, we did not proceed with legacy authentication. The second bug was that if no resource was specified, legacy authentication must fail, and this condition was not being detected. --- src/auth.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/auth.c b/src/auth.c index 14dc037..922bc65 100644 --- a/src/auth.c +++ b/src/auth.c @@ -63,6 +63,9 @@ static int _handle_missing_features(xmpp_conn_t * const conn, { xmpp_debug(conn->ctx, "xmpp", "didn't get stream features"); + /* legacy auth will be attempted */ + _auth(conn); + return 0; } @@ -448,9 +451,17 @@ static void _auth(xmpp_conn_t * const conn) return; } str = xmpp_jid_resource(conn->ctx, conn->jid); - if (str) + if (str) { xmpp_stanza_set_text(authdata, str); - xmpp_free(conn->ctx, str); + xmpp_free(conn->ctx, str); + } else { + xmpp_stanza_release(authdata); + xmpp_stanza_release(iq); + xmpp_error(conn->ctx, "auth", + "Cannot authenticate without resource"); + xmpp_disconnect(conn); + return; + } xmpp_stanza_add_child(child, authdata); xmpp_stanza_release(authdata);