1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Explicitly set the authorization id during the PLAIN handshake

On error show the user the message sent by the server.
This commit is contained in:
LemonBoy 2015-09-11 22:09:47 +02:00
parent 171b67441d
commit 6645d0d38d

View File

@ -47,8 +47,7 @@ static void sasl_fail (IRC_SERVER_REC *server, const char *data, const char *fro
server->sasl_timeout = -1; server->sasl_timeout = -1;
} }
g_critical("Authentication failed, make sure your credentials are correct and that the mechanism " g_critical("Authentication failed with reason \"%s\"", data);
"you have selected is supported by this server.");
/* Terminate the negotiation */ /* Terminate the negotiation */
cap_finish_negotiation(server); cap_finish_negotiation(server);
@ -93,15 +92,15 @@ static void sasl_step (IRC_SERVER_REC *server, const char *data, const char *fro
switch (conn->sasl_mechanism) { switch (conn->sasl_mechanism) {
case SASL_MECHANISM_PLAIN: case SASL_MECHANISM_PLAIN:
/* At this point we assume that conn->{username, password} are non-NULL. /* At this point we assume that conn->sasl_{username, password} are non-NULL.
* The PLAIN mechanism expects a NULL-separated string composed by the authorization identity, the * The PLAIN mechanism expects a NULL-separated string composed by the authorization identity, the
* authentication identity and the password. * authentication identity and the password.
* The authorization identity field is optional and can be omitted, the server will derive the * The authorization identity field is explicitly set to the user provided username.
* identity by looking at the credentials provided.
* The whole request is then encoded in base64. */ * The whole request is then encoded in base64. */
req = g_string_new(NULL); req = g_string_new(NULL);
g_string_append(req, conn->sasl_username);
g_string_append_c(req, '\0'); g_string_append_c(req, '\0');
g_string_append(req, conn->sasl_username); g_string_append(req, conn->sasl_username);
g_string_append_c(req, '\0'); g_string_append_c(req, '\0');