{
variant = egg_dbus_hash_map_lookup (details, "pid");
variant2 = egg_dbus_hash_map_lookup (details, "start-time");
- s = polkit_unix_process_new_full (egg_dbus_variant_get_uint (variant),
- egg_dbus_variant_get_uint64 (variant2));
+ if (variant != NULL && variant2 != NULL)
+ s = polkit_unix_process_new_full (egg_dbus_variant_get_uint (variant),
+ egg_dbus_variant_get_uint64 (variant2));
}
else if (strcmp (kind, "unix-session") == 0)
{
variant = egg_dbus_hash_map_lookup (details, "session-id");
- s = polkit_unix_session_new (egg_dbus_variant_get_string (variant));
+ if (variant != NULL)
+ s = polkit_unix_session_new (egg_dbus_variant_get_string (variant));
}
else if (strcmp (kind, "system-bus-name") == 0)
{
variant = egg_dbus_hash_map_lookup (details, "name");
- s = polkit_system_bus_name_new (egg_dbus_variant_get_string (variant));
+ if (variant != NULL)
+ s = polkit_system_bus_name_new (egg_dbus_variant_get_string (variant));
}
else
{
GCancellable *cancellable;
PolkitDetails *details;
- caller_name = egg_dbus_method_invocation_get_caller (method_invocation);
- caller = polkit_system_bus_name_new (caller_name);
+ details = NULL;
subject = polkit_subject_new_for_real (real_subject);
+ if (subject == NULL)
+ {
+ egg_dbus_method_invocation_return_error_literal (method_invocation,
+ _POLKIT_ERROR,
+ _POLKIT_ERROR_FAILED,
+ "Error parsing subject struct");
+ goto out;
+ }
+
+ caller_name = egg_dbus_method_invocation_get_caller (method_invocation);
+ caller = polkit_system_bus_name_new (caller_name);
details = polkit_details_new_for_hash (real_details->data);
check_auth_cb,
method_invocation);
out:
- g_object_unref (details);
+ if (details != NULL)
+ g_object_unref (details);
}
static void
PolkitSubject *subject;
GError *error;
- caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+ caller = NULL;
+
subject = polkit_subject_new_for_real (real_subject);
+ if (subject == NULL)
+ {
+ egg_dbus_method_invocation_return_error_literal (method_invocation,
+ _POLKIT_ERROR,
+ _POLKIT_ERROR_FAILED,
+ "Error parsing subject struct");
+ goto out;
+ }
g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
+ caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+
error = NULL;
if (!polkit_backend_authority_register_authentication_agent (server->authority,
caller,
_polkit_authority_handle_register_authentication_agent_finish (method_invocation);
out:
- g_object_unref (caller);
+ if (caller != NULL)
+ g_object_unref (caller);
}
/* ---------------------------------------------------------------------------------------------------- */
PolkitSubject *subject;
GError *error;
- caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+ caller = NULL;
+
subject = polkit_subject_new_for_real (real_subject);
+ if (subject == NULL)
+ {
+ egg_dbus_method_invocation_return_error_literal (method_invocation,
+ _POLKIT_ERROR,
+ _POLKIT_ERROR_FAILED,
+ "Error parsing subject struct");
+ goto out;
+ }
g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
+ caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+
error = NULL;
if (!polkit_backend_authority_unregister_authentication_agent (server->authority,
caller,
_polkit_authority_handle_unregister_authentication_agent_finish (method_invocation);
out:
- g_object_unref (caller);
+ if (caller != NULL)
+ g_object_unref (caller);
}
/* ---------------------------------------------------------------------------------------------------- */
PolkitIdentity *identity;
GError *error;
+ caller = NULL;
+ identity = NULL;
+
identity = polkit_identity_new_for_real (real_identity);
+ if (identity == NULL)
+ {
+ egg_dbus_method_invocation_return_error_literal (method_invocation,
+ _POLKIT_ERROR,
+ _POLKIT_ERROR_FAILED,
+ "Error parsing identity struct");
+ goto out;
+ }
caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
_polkit_authority_handle_authentication_agent_response_finish (method_invocation);
out:
- g_object_unref (caller);
+ if (caller != NULL)
+ g_object_unref (caller);
- g_object_unref (identity);
+ if (identity != NULL)
+ g_object_unref (identity);
}
/* ---------------------------------------------------------------------------------------------------- */
caller = NULL;
temporary_authorizations = NULL;
- caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
-
subject = polkit_subject_new_for_real (real_subject);
+ if (subject == NULL)
+ {
+ egg_dbus_method_invocation_return_error_literal (method_invocation,
+ _POLKIT_ERROR,
+ _POLKIT_ERROR_FAILED,
+ "Error parsing subject struct");
+ goto out;
+ }
g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
+ caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+
temporary_authorizations = polkit_backend_authority_enumerate_temporary_authorizations (server->authority,
caller,
subject,
out:
g_list_foreach (temporary_authorizations, (GFunc) g_object_unref, NULL);
g_list_free (temporary_authorizations);
- g_object_unref (caller);
+ if (caller != NULL)
+ g_object_unref (caller);
}
/* ---------------------------------------------------------------------------------------------------- */
error = NULL;
caller = NULL;
- caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
-
subject = polkit_subject_new_for_real (real_subject);
+ if (subject == NULL)
+ {
+ egg_dbus_method_invocation_return_error_literal (method_invocation,
+ _POLKIT_ERROR,
+ _POLKIT_ERROR_FAILED,
+ "Error parsing subject struct");
+ goto out;
+ }
g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
+ caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+
polkit_backend_authority_revoke_temporary_authorizations (server->authority,
caller,
subject,
_polkit_authority_handle_revoke_temporary_authorizations_finish (method_invocation);
out:
- g_object_unref (caller);
+ if (caller != NULL)
+ g_object_unref (caller);
}
/* ---------------------------------------------------------------------------------------------------- */