diff --git a/src/polkit/polkitactiondescription.c b/src/polkit/polkitactiondescription.c index cc1a8b5..9c8d530 100644 --- a/src/polkit/polkitactiondescription.c +++ b/src/polkit/polkitactiondescription.c @@ -101,6 +101,7 @@ polkit_action_description_new_for_real (_PolkitActionDescription *real) _PolkitActionDescription * polkit_action_description_get_real (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return g_object_ref (action_description->real); } @@ -115,6 +116,7 @@ polkit_action_description_get_real (PolkitActionDescription *action_description) const gchar * polkit_action_description_get_action_id (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_action_id (action_description->real); } @@ -129,6 +131,7 @@ polkit_action_description_get_action_id (PolkitActionDescription *action_descrip const gchar * polkit_action_description_get_description (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_description (action_description->real); } @@ -143,6 +146,7 @@ polkit_action_description_get_description (PolkitActionDescription *action_descr const gchar * polkit_action_description_get_message (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_message (action_description->real); } @@ -158,6 +162,7 @@ polkit_action_description_get_message (PolkitActionDescription *action_descripti const gchar * polkit_action_description_get_vendor_name (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_vendor_name (action_description->real); } @@ -173,6 +178,7 @@ polkit_action_description_get_vendor_name (PolkitActionDescription *action_descr const gchar * polkit_action_description_get_vendor_url (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_vendor_url (action_description->real); } @@ -188,6 +194,7 @@ polkit_action_description_get_vendor_url (PolkitActionDescription *action_descri PolkitImplicitAuthorization polkit_action_description_get_implicit_any (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_implicit_any (action_description->real); } @@ -203,6 +210,7 @@ polkit_action_description_get_implicit_any (PolkitActionDescription *action_desc PolkitImplicitAuthorization polkit_action_description_get_implicit_inactive (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_implicit_inactive (action_description->real); } @@ -218,6 +226,7 @@ polkit_action_description_get_implicit_inactive (PolkitActionDescription *action PolkitImplicitAuthorization polkit_action_description_get_implicit_active (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_implicit_active (action_description->real); } @@ -234,6 +243,7 @@ polkit_action_description_get_implicit_active (PolkitActionDescription *action_d const gchar * polkit_action_description_get_icon_name (PolkitActionDescription *action_description) { + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); return _polkit_action_description_get_icon_name (action_description->real); } @@ -253,6 +263,8 @@ polkit_action_description_get_annotation (PolkitActionDescription *action_descri { EggDBusHashMap *annotations; + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); + annotations = _polkit_action_description_get_annotations (action_description->real); return egg_dbus_hash_map_lookup (annotations, key); @@ -286,6 +298,8 @@ polkit_action_description_get_annotation_keys (PolkitActionDescription *action_d EggDBusHashMap *annotations; GPtrArray *p; + g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL); + if (action_description->annotation_keys != NULL) goto out; diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c index 7d2c235..1fbe124 100644 --- a/src/polkit/polkitauthority.c +++ b/src/polkit/polkitauthority.c @@ -237,6 +237,7 @@ polkit_authority_enumerate_actions (PolkitAuthority *authority, GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_enumerate_actions_async (authority, cancellable, callback, user_data); } @@ -262,6 +263,8 @@ polkit_authority_enumerate_actions_finish (PolkitAuthority *authority, GSimpleAsyncResult *simple; GAsyncResult *real_res; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -314,6 +317,8 @@ polkit_authority_enumerate_actions_sync (PolkitAuthority *authority, GAsyncResult *res; GList *result; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); + call_id = polkit_authority_enumerate_actions_async (authority, cancellable, generic_cb, &res); egg_dbus_connection_pending_call_block (authority->system_bus, call_id); @@ -420,6 +425,7 @@ polkit_authority_check_authorization (PolkitAuthority *authority, GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_check_authorization_async (authority, subject, action_id, @@ -468,6 +474,8 @@ polkit_authority_check_authorization_finish (PolkitAuthority *authority GAsyncResult *real_res; GError *local_error; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -552,6 +560,8 @@ polkit_authority_check_authorization_sync (PolkitAuthority *author GAsyncResult *res; PolkitAuthorizationResult *result; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); + call_id = polkit_authority_check_authorization_async (authority, subject, action_id, @@ -630,6 +640,7 @@ polkit_authority_register_authentication_agent (PolkitAuthority *authority, GAsyncReadyCallback callback, gpointer user_data) { + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); polkit_authority_register_authentication_agent_async (authority, subject, locale, @@ -658,6 +669,8 @@ polkit_authority_register_authentication_agent_finish (PolkitAuthority *authorit GAsyncResult *real_res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -701,6 +714,8 @@ polkit_authority_register_authentication_agent_sync (PolkitAuthority *author GAsyncResult *res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + call_id = polkit_authority_register_authentication_agent_async (authority, subject, locale, @@ -775,6 +790,7 @@ polkit_authority_unregister_authentication_agent (PolkitAuthority *authorit GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_unregister_authentication_agent_async (authority, subject, object_path, @@ -802,6 +818,8 @@ polkit_authority_unregister_authentication_agent_finish (PolkitAuthority *author GAsyncResult *real_res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -842,6 +860,8 @@ polkit_authority_unregister_authentication_agent_sync (PolkitAuthority *auth GAsyncResult *res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + call_id = polkit_authority_unregister_authentication_agent_async (authority, subject, object_path, @@ -919,6 +939,7 @@ polkit_authority_authentication_agent_response (PolkitAuthority *authority, GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_authentication_agent_response_async (authority, cookie, identity, @@ -946,6 +967,8 @@ polkit_authority_authentication_agent_response_finish (PolkitAuthority *authorit GAsyncResult *real_res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -989,6 +1012,8 @@ polkit_authority_authentication_agent_response_sync (PolkitAuthority *author GAsyncResult *res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + call_id = polkit_authority_authentication_agent_response_async (authority, cookie, identity, @@ -1058,6 +1083,7 @@ polkit_authority_enumerate_temporary_authorizations (PolkitAuthority *author GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_enumerate_temporary_authorizations_async (authority, subject, cancellable, callback, user_data); } @@ -1083,6 +1109,8 @@ polkit_authority_enumerate_temporary_authorizations_finish (PolkitAuthority *aut GSimpleAsyncResult *simple; GAsyncResult *real_res; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -1136,6 +1164,8 @@ polkit_authority_enumerate_temporary_authorizations_sync (PolkitAuthority *a GAsyncResult *res; GList *result; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), NULL); + call_id = polkit_authority_enumerate_temporary_authorizations_async (authority, subject, cancellable, generic_cb, &res); egg_dbus_connection_pending_call_block (authority->system_bus, call_id); @@ -1200,6 +1230,7 @@ polkit_authority_revoke_temporary_authorizations (PolkitAuthority *authority GAsyncReadyCallback callback, gpointer user_data) { + g_return_val_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_revoke_temporary_authorizations_async (authority, subject, cancellable, callback, user_data); } @@ -1222,6 +1253,8 @@ polkit_authority_revoke_temporary_authorizations_finish (PolkitAuthority *author GAsyncResult *real_res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -1260,6 +1293,8 @@ polkit_authority_revoke_temporary_authorizations_sync (PolkitAuthority *auth GAsyncResult *res; gboolean result; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + call_id = polkit_authority_revoke_temporary_authorizations_async (authority, subject, cancellable, generic_cb, &res); egg_dbus_connection_pending_call_block (authority->system_bus, call_id); @@ -1319,6 +1354,7 @@ polkit_authority_revoke_temporary_authorization_by_id (PolkitAuthority *auth GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); polkit_authority_revoke_temporary_authorization_by_id_async (authority, id, cancellable, callback, user_data); } @@ -1341,6 +1377,8 @@ polkit_authority_revoke_temporary_authorization_by_id_finish (PolkitAuthority *a GAsyncResult *real_res; gboolean ret; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + simple = G_SIMPLE_ASYNC_RESULT (res); real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); @@ -1379,6 +1417,8 @@ polkit_authority_revoke_temporary_authorization_by_id_sync (PolkitAuthority GAsyncResult *res; gboolean result; + g_return_val_if_fail (POLKIT_IS_AUTHORITY (authority), FALSE); + call_id = polkit_authority_revoke_temporary_authorization_by_id_async (authority, id, cancellable, generic_cb, &res); egg_dbus_connection_pending_call_block (authority->system_bus, call_id); diff --git a/src/polkit/polkitauthorizationresult.c b/src/polkit/polkitauthorizationresult.c index 40abed1..a4be617 100644 --- a/src/polkit/polkitauthorizationresult.c +++ b/src/polkit/polkitauthorizationresult.c @@ -100,6 +100,7 @@ polkit_authorization_result_new_for_real (_PolkitAuthorizationResult *real) _PolkitAuthorizationResult * polkit_authorization_result_get_real (PolkitAuthorizationResult *authorization_result) { + g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (authorization_result), NULL); return g_object_ref (authorization_result->real); } @@ -168,6 +169,7 @@ polkit_authorization_result_new (gboolean is_authorized, gboolean polkit_authorization_result_get_is_authorized (PolkitAuthorizationResult *result) { + g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (result), FALSE); return _polkit_authorization_result_get_is_authorized (result->real); } @@ -182,6 +184,7 @@ polkit_authorization_result_get_is_authorized (PolkitAuthorizationResult *result gboolean polkit_authorization_result_get_is_challenge (PolkitAuthorizationResult *result) { + g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (result), FALSE); return _polkit_authorization_result_get_is_challenge (result->real); } @@ -199,6 +202,8 @@ polkit_authorization_result_get_details (PolkitAuthorizationResult *result) { EggDBusHashMap *real_details; + g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (result), NULL); + if (result->details != NULL) goto out; @@ -233,6 +238,8 @@ polkit_authorization_result_get_retains_authorization (PolkitAuthorizationResult gboolean ret; PolkitDetails *details; + g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (result), FALSE); + ret = FALSE; details = polkit_authorization_result_get_details (result); if (details != NULL && polkit_details_lookup (details, "polkit.retains_authorization_after_challenge") != NULL) @@ -269,6 +276,8 @@ polkit_authorization_result_get_temporary_authorization_id (PolkitAuthorizationR const gchar *ret; PolkitDetails *details; + g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (result), NULL); + ret = NULL; details = polkit_authorization_result_get_details (result); if (details != NULL) diff --git a/src/polkit/polkitdetails.c b/src/polkit/polkitdetails.c index 2ef9e78..4996861 100644 --- a/src/polkit/polkitdetails.c +++ b/src/polkit/polkitdetails.c @@ -134,6 +134,7 @@ const gchar * polkit_details_lookup (PolkitDetails *details, const gchar *key) { + g_return_val_if_fail (POLKIT_IS_DETAILS (details), NULL); if (details->hash == NULL) return NULL; else @@ -153,6 +154,7 @@ polkit_details_insert (PolkitDetails *details, const gchar *key, const gchar *value) { + g_return_val_if_fail (POLKIT_IS_DETAILS (details), NULL); if (details->hash == NULL) details->hash = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -176,6 +178,8 @@ polkit_details_get_keys (PolkitDetails *details) gchar **ret; guint n; + g_return_val_if_fail (POLKIT_IS_DETAILS (details), NULL); + if (details->hash == NULL) return NULL; diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c index 08fd6ac..ecfe088 100644 --- a/src/polkit/polkitidentity.c +++ b/src/polkit/polkitidentity.c @@ -85,6 +85,7 @@ polkit_identity_get_type (void) guint polkit_identity_hash (PolkitIdentity *identity) { + g_return_val_if_fail (POLKIT_IS_IDENTITY (identity), -1); return POLKIT_IDENTITY_GET_IFACE (identity)->hash (identity); } @@ -103,6 +104,7 @@ gboolean polkit_identity_equal (PolkitIdentity *a, PolkitIdentity *b) { + g_return_val_if_fail (POLKIT_IS_IDENTITY (identity), FALSE); if (!g_type_is_a (G_TYPE_FROM_INSTANCE (a), G_TYPE_FROM_INSTANCE (b))) return FALSE; @@ -121,6 +123,7 @@ polkit_identity_equal (PolkitIdentity *a, gchar * polkit_identity_to_string (PolkitIdentity *identity) { + g_return_val_if_fail (POLKIT_IS_IDENTITY (identity), NULL); return POLKIT_IDENTITY_GET_IFACE (identity)->to_string (identity); } @@ -193,6 +196,8 @@ polkit_identity_new_for_real (_PolkitIdentity *real) EggDBusHashMap *details; EggDBusVariant *variant; + g_return_val_if_fail (POLKIT_IS_IDENTITY (identity), NULL); + s = NULL; kind = _polkit_identity_get_identity_kind (real); @@ -223,6 +228,8 @@ polkit_identity_get_real (PolkitIdentity *identity) const gchar *kind; EggDBusHashMap *details; + g_return_val_if_fail (POLKIT_IS_IDENTITY (identity), NULL); + real = NULL; kind = NULL; details = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, EGG_DBUS_TYPE_VARIANT, (GDestroyNotify) g_object_unref); diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c index b2f9290..1d84321 100644 --- a/src/polkit/polkitsubject.c +++ b/src/polkit/polkitsubject.c @@ -86,6 +86,7 @@ polkit_subject_get_type (void) guint polkit_subject_hash (PolkitSubject *subject) { + g_return_val_if_fail (POLKIT_IS_SUBJECT(subject), -1); return POLKIT_SUBJECT_GET_IFACE (subject)->hash (subject); } @@ -104,6 +105,8 @@ gboolean polkit_subject_equal (PolkitSubject *a, PolkitSubject *b) { + g_return_val_if_fail (POLKIT_IS_SUBJECT(a), FALSE); + g_return_val_if_fail (POLKIT_IS_SUBJECT(b), FALSE); if (!g_type_is_a (G_TYPE_FROM_INSTANCE (a), G_TYPE_FROM_INSTANCE (b))) return FALSE; @@ -122,6 +125,7 @@ polkit_subject_equal (PolkitSubject *a, gchar * polkit_subject_to_string (PolkitSubject *subject) { + g_return_val_if_fail (POLKIT_IS_SUBJECT(subject), NULL); return POLKIT_SUBJECT_GET_IFACE (subject)->to_string (subject); } @@ -144,6 +148,7 @@ polkit_subject_exists (PolkitSubject *subject, GAsyncReadyCallback callback, gpointer user_data) { + g_return_if_fail (POLKIT_IS_SUBJECT(subject)); POLKIT_SUBJECT_GET_IFACE (subject)->exists (subject, cancellable, callback, @@ -165,6 +170,7 @@ polkit_subject_exists_finish (PolkitSubject *subject, GAsyncResult *res, GError **error) { + g_return_val_if_fail (POLKIT_IS_SUBJECT(subject), FALSE); return POLKIT_SUBJECT_GET_IFACE (subject)->exists_finish (subject, res, error); @@ -188,6 +194,7 @@ polkit_subject_exists_sync (PolkitSubject *subject, GCancellable *cancellable, GError **error) { + g_return_val_if_fail (POLKIT_IS_SUBJECT(subject), FALSE); return POLKIT_SUBJECT_GET_IFACE (subject)->exists_sync (subject, cancellable, error); @@ -269,6 +276,8 @@ polkit_subject_new_for_real (_PolkitSubject *real) EggDBusVariant *variant; EggDBusVariant *variant2; + g_return_val_if_fail (POLKIT_IS_SUBJECT(real), NULL); + s = NULL; kind = _polkit_subject_get_subject_kind (real); @@ -310,6 +319,8 @@ polkit_subject_get_real (PolkitSubject *subject) const gchar *kind; EggDBusHashMap *details; + g_return_val_if_fail (POLKIT_IS_SUBJECT(subject), NULL); + real = NULL; kind = NULL; details = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, EGG_DBUS_TYPE_VARIANT, (GDestroyNotify) g_object_unref); diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c index 180b6b6..5be4f60 100644 --- a/src/polkit/polkitsystembusname.c +++ b/src/polkit/polkitsystembusname.c @@ -161,6 +161,7 @@ polkit_system_bus_name_class_init (PolkitSystemBusNameClass *klass) const gchar * polkit_system_bus_name_get_name (PolkitSystemBusName *system_bus_name) { + g_return_val_if_fail (POLKIT_IS_SYSTEM_BUS_NAME(system_bus_name), NULL); return system_bus_name->name; } @@ -175,6 +176,7 @@ void polkit_system_bus_name_set_name (PolkitSystemBusName *system_bus_name, const gchar *name) { + g_return_if_fail (POLKIT_IS_SYSTEM_BUS_NAME(system_bus_name)); g_free (system_bus_name->name); system_bus_name->name = g_strdup (name); }