Пример #1
0
static DBusMessage*
service_method_lock_service (GkdSecretService *self, DBusMessage *message)
{
	DBusError derr = DBUS_ERROR_INIT;
	GckSession *session;
	const char *caller;

	if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INVALID))
		return NULL;

	caller = dbus_message_get_sender (message);
	session = gkd_secret_service_get_pkcs11_session (self, caller);
	g_return_val_if_fail (session != NULL, NULL);

	if (!gkd_secret_lock_all (session, &derr))
		return gkd_secret_error_to_reply (message, &derr);

	return dbus_message_new_method_return (message);
}
Пример #2
0
static gboolean
service_method_lock_service (GkdExportedService *skeleton,
			     GDBusMethodInvocation *invocation,
			     GkdSecretService *self)
{
	GError *error = NULL;
	GckSession *session;
	const char *caller;

	caller = g_dbus_method_invocation_get_sender (invocation);
	session = gkd_secret_service_get_pkcs11_session (self, caller);
	g_return_val_if_fail (session != NULL, FALSE);

	if (!gkd_secret_lock_all (session, &error))
		g_dbus_method_invocation_take_error (invocation, error);
	else
		gkd_exported_service_complete_lock_service (skeleton, invocation);

	return TRUE;
}