Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[telepathy-sasl-signon] Only trigger CredentialsNeedUpdate for specif…
…ic SASL errors

Unfortunately, telepathy's AuthenticationFailed error arrives for many
normal cases, like a connection reset during authentication. We cannot
invalidate credentials indiscriminately.

Instead, watch for the two specific wocky errors that indicate the
server probably rejected our credentials and signal only for those.
  • Loading branch information
John Brooks committed Dec 20, 2013
1 parent 057112d commit f5d465d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions telepathy-sasl-signon/empathy-uoa-auth-handler.c
Expand Up @@ -200,9 +200,22 @@ auth_cb (GObject *source,
if (!empathy_sasl_auth_finish (channel, result, &error))
{
DEBUG ("SASL Mechanism error: %s", error->message);
g_clear_error (&error);

request_password (ctx);
// If the error looks like credential failure, set the CredentialsNeedUpdate flag.
// We cannot set the flag for all SASL errors, because this includes things like a
// connection reset during authentication.
if (strstr(error->message, "WOCKY_AUTH_ERROR_FAILURE") ||
strstr(error->message, "WOCKY_AUTH_ERROR_NOT_AUTHORIZED"))
{
request_password (ctx);
}
else
{
DEBUG ("Auth on %s failed", tp_proxy_get_object_path (channel));
auth_context_done (ctx);
}

g_clear_error (&error);
}
else
{
Expand Down

0 comments on commit f5d465d

Please sign in to comment.