コード例 #1
0
static void
infinoted_pam_log_error(const char* username,
                        const char* detail,
                        int error_code,
                        GError** error)
{
  const char* msg;

  if(error_code == 0)
    msg = _("Entry not found");
  else
    msg = strerror(error_code);

  infinoted_util_log_error(
    _("Error while checking groups of user \"%s\", %s: %s."),
    username,
    detail,
    msg
  );

  /* TODO: use g_set_error_literal in glib 2.18 */
  g_set_error(
    error,
    inf_authentication_detail_error_quark(),
    INF_AUTHENTICATION_DETAIL_ERROR_SERVER_ERROR,
    "%s",
    inf_authentication_detail_strerror(INF_AUTHENTICATION_DETAIL_ERROR_SERVER_ERROR)
  );
}
コード例 #2
0
void Gobby::AuthCommands::set_sasl_error(InfXmppConnection* connection,
                                         const gchar* message)
{
	GError* error = g_error_new_literal(
		inf_authentication_detail_error_quark(),
		INF_AUTHENTICATION_DETAIL_ERROR_AUTHENTICATION_FAILED,
		message
	);

	inf_xmpp_connection_set_sasl_error(connection, error);
	g_error_free(error);
}
コード例 #3
0
void Gobby::AuthCommands::browser_error_callback(InfcBrowser* browser,
                                                 GError* error)
{
	// The Browser already displays errors inline, but we want
	// auth-related error messages to show up in the status bar.

	InfXmlConnection* connection = infc_browser_get_connection(browser);
	g_assert(INF_IS_XMPP_CONNECTION(connection));

	InfXmppConnection* xmpp = INF_XMPP_CONNECTION(connection);
	RetryMap::iterator iter = m_retries.find(xmpp);
	if(iter == m_retries.end())
		iter = insert_retry_info(xmpp);
	Glib::ustring& last_password(iter->second.last_password);
	Glib::ustring old_password;

	old_password.swap(last_password);

	if(error->domain ==
	     g_quark_from_static_string("INF_XMPP_CONNECTION_AUTH_ERROR"))
	{
		// Authentication failed for some reason, maybe because the
		// server aborted authentication. If we were querying a
		// password then close the dialog now.
		delete iter->second.password_dialog;
		iter->second.password_dialog = NULL;

		const GError* sasl_error =
			inf_xmpp_connection_get_sasl_error(xmpp);
		if(sasl_error != NULL &&
		   sasl_error->domain ==
		     inf_authentication_detail_error_quark())
		{
			handle_error_detail(xmpp, sasl_error,
			                    old_password,
			                    last_password);
		}
		else if(sasl_error != NULL)
		{
			show_error(sasl_error, m_statusbar, connection);
		}
		else
		{
			show_error(error, m_statusbar, connection);
		}
	}
	else if(error->domain == inf_gsasl_error_quark())
	{
		show_error(error, m_statusbar, connection);
	}
}
コード例 #4
0
static void
infinoted_startup_sasl_callback_set_error(InfXmppConnection* connection,
                                          InfAuthenticationDetailError code,
                                          const GError* error)
{
  GError* own_error;
  own_error = NULL;

  if(!error)
  {
    own_error = g_error_new_literal(
      inf_authentication_detail_error_quark(),
      code,
      inf_authentication_detail_strerror(code)
    );

    inf_xmpp_connection_set_sasl_error(connection, own_error);
    g_error_free(own_error);
  }
  else
  {
    inf_xmpp_connection_set_sasl_error(connection, error);
  }
}