Skip to content

Commit

Permalink
[telepathy-sasl-signon] Only trigger CredentialsNeedUpdate for specif…
Browse files Browse the repository at this point in the history
…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 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion telepathy-sasl-signon/empathy-uoa-auth-handler.c
Expand Up @@ -200,10 +200,23 @@ auth_cb (GObject *source,
if (!empathy_sasl_auth_finish (channel, result, &error))
{
DEBUG ("SASL Mechanism error: %s", error->message);
g_clear_error (&error);

// 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
{
DEBUG ("Auth on %s suceeded", tp_proxy_get_object_path (channel));
Expand Down

0 comments on commit f5d465d

Please sign in to comment.