void
tpaw_keyring_get_room_password_async (TpAccount *account,
    const gchar *id,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  GSimpleAsyncResult *simple;
  const gchar *account_id;

  g_return_if_fail (TP_IS_ACCOUNT (account));
  g_return_if_fail (id != NULL);
  g_return_if_fail (callback != NULL);

  simple = g_simple_async_result_new (G_OBJECT (account), callback,
      user_data, tpaw_keyring_get_room_password_async);

  account_id = tp_proxy_get_object_path (account) +
    strlen (TP_ACCOUNT_OBJECT_PATH_BASE);

  DEBUG ("Trying to get password for room '%s' on account '%s'",
      id, account_id);

  secret_password_lookup (&room_keyring_schema, NULL,
          lookup_item_cb, simple,
          "account-id", account_id,
          "room-id", id,
          NULL);
}
Exemplo n.º 2
0
char *
vino_keyring_get_password (void)
{
  return secret_password_lookup (SECRET_SCHEMA_COMPAT_NETWORK,
                                 NULL, NULL,
                                 "server", "vino.local",
                                 "protocol", "rfb",
                                 "authtype", "vnc-password",
                                 "port", 5900,
                                 NULL);
}
Exemplo n.º 3
0
static void
connect_to_server (WebService *self)
{
	g_return_if_fail (self->priv->account != NULL);
	g_return_if_fail (self->priv->account->id != NULL);

#ifdef HAVE_LIBSECRET
	if (self->priv->account->token_secret == NULL) {
		secret_password_lookup (SECRET_SCHEMA_COMPAT_NETWORK,
					self->priv->cancellable,
					password_lookup_ready_cb,
					self,
					"user", self->priv->account->id,
					"server", self->priv->service_address,
					"protocol", self->priv->service_protocol,
					NULL);
		return;
	}
#endif

	connect_to_server_step2 (self);
}
void
tpaw_keyring_get_account_password_async (TpAccount *account,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  GSimpleAsyncResult *simple;
  const gchar *account_id;

  g_return_if_fail (TP_IS_ACCOUNT (account));
  g_return_if_fail (callback != NULL);

  simple = g_simple_async_result_new (G_OBJECT (account), callback,
      user_data, tpaw_keyring_get_account_password_async);

  account_id = tp_proxy_get_object_path (account) +
    strlen (TP_ACCOUNT_OBJECT_PATH_BASE);

  DEBUG ("Trying to get password for: %s", account_id);

#ifdef HAVE_UOA
    {
      const gchar *provider;

      provider = tp_account_get_storage_provider (account);
      if (!tp_strdiff (provider, TPAW_UOA_PROVIDER))
        {
          uoa_get_account_password (account, simple);
          g_object_unref (simple);
          return;
        }
    }
#endif

  secret_password_lookup (&account_keyring_schema, NULL,
          lookup_item_cb, simple,
          "account-id", account_id,
          "param-name", "password",
          NULL);
}
Exemplo n.º 5
0
Arquivo: secret.c Projeto: vifino/dwb
static void 
on_service_pwd(GObject *source, GAsyncResult *result, dwb_secret_t *secret) {
    SecretService *service = get_service(secret, result);
    const char *path = NULL;
    if (service != NULL) {
        dwb_pwd_t *pwd = secret->data;
        if (pwd->collection != NULL) {
            path = collection_lookup_path(service, pwd->collection);
        }
        if (path != NULL || pwd->collection == NULL) {
            if (secret->action == DWB_SECRET_ACTION_STORE) {
                secret_password_store(&s_schema, path, pwd->label, pwd->pwd, NULL,
                        (GAsyncReadyCallback)on_store_pwd, secret, "id", pwd->id, NULL);
            }
            else {
                secret_password_lookup(&s_schema, NULL, (GAsyncReadyCallback)on_lookup_pwd, secret, "id", pwd->id, NULL);
            }
        }
        else {
            invoke(secret, DWB_SECRET_NO_SUCH_COLLECTION, NULL);
        }
        g_object_unref(service);
    }
}