Пример #1
0
static gboolean
photos_thumbnailer_authorize_authenticated_peer (PhotosThumbnailer *self,
                                                 GIOStream *iostream,
                                                 GCredentials *credentials)
{
  g_autoptr (GCredentials) own_credentials = NULL;
  gboolean ret_val = FALSE;

  if (credentials == NULL)
    goto out;

  own_credentials = g_credentials_new ();

  {
    g_autoptr (GError) error = NULL;

    if (!g_credentials_is_same_user (credentials, own_credentials, &error))
      {
        g_warning ("Unable to authorize peer: %s", error->message);
        goto out;
      }
  }

  ret_val = TRUE;

 out:
  return ret_val;
}
Пример #2
0
gboolean
wxgtk_dbus_peer_is_authorized(GCredentials *peer_credentials)
{
    static GCredentials *own_credentials = g_credentials_new();
    GError *error = NULL;

    if (peer_credentials && g_credentials_is_same_user(peer_credentials, own_credentials, &error))
    {
        return TRUE;
    }

    if (error)
    {
        g_warning("Failed to authorize web extension connection: %s", error->message);
        g_error_free(error);
    }
    return FALSE;
}
Пример #3
0
/* TODO move this to a lib or somthing that can be used from ui and web
 * process together */
static gboolean on_authorize_authenticated_peer(GDBusAuthObserver *observer,
        GIOStream *stream, GCredentials *credentials, gpointer data)
{
    static GCredentials *own_credentials = NULL;
    GError *error = NULL;

    if (!own_credentials) {
        own_credentials = g_credentials_new();
    }

    if (credentials && g_credentials_is_same_user(credentials, own_credentials, &error)) {
        return TRUE;
    }

    if (error) {
        g_warning("Failed to authorize web extension connection: %s", error->message);
        g_error_free(error);
    }

    return FALSE;
}