PolicyKit: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Mon Aug 9 10:16:23 PDT 2010
src/polkit/polkitactiondescription.c | 13 +++++++++++++
src/polkit/polkitauthorizationresult.c | 9 +++++++++
src/polkit/polkitdetails.c | 6 ++++++
src/polkit/polkitidentity.c | 6 ++++++
src/polkit/polkitsubject.c | 14 ++++++++++++++
src/polkit/polkitsystembusname.c | 7 +++++++
src/polkit/polkittemporaryauthorization.c | 5 +++++
src/polkit/polkitunixgroup.c | 5 +++++
src/polkit/polkitunixprocess.c | 6 ++++++
src/polkit/polkitunixsession.c | 3 +++
src/polkit/polkitunixuser.c | 5 +++++
src/polkitagent/polkitagentlistener.c | 15 +++++++++++++++
src/polkitagent/polkitagentsession.c | 7 +++++++
13 files changed, 101 insertions(+)
New commits:
commit 07186ab99e66aba27a10b43f834d04fbdee302ca
Author: David Zeuthen <davidz at redhat.com>
Date: Mon Aug 9 13:15:58 2010 -0400
Add g_return_if_fail() to all public API entry points
Signed-off-by: David Zeuthen <davidz at redhat.com>
diff --git a/src/polkit/polkitactiondescription.c b/src/polkit/polkitactiondescription.c
index 8c6581f..dc99ffc 100644
--- a/src/polkit/polkitactiondescription.c
+++ b/src/polkit/polkitactiondescription.c
@@ -112,6 +112,7 @@ polkit_action_description_class_init (PolkitActionDescriptionClass *klass)
const gchar *
polkit_action_description_get_action_id (PolkitActionDescription *action_description)
{
+ g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL);
return action_description->action_id;
}
@@ -126,6 +127,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 action_description->description;
}
@@ -140,6 +142,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 action_description->message;
}
@@ -155,6 +158,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 action_description->vendor_name;
}
@@ -170,6 +174,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 action_description->vendor_url;
}
@@ -185,6 +190,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), 0);
return action_description->implicit_any;
}
@@ -200,6 +206,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), 0);
return action_description->implicit_inactive;
}
@@ -215,6 +222,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), 0);
return action_description->implicit_active;
}
@@ -231,6 +239,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 action_description->icon_name;
}
@@ -248,6 +257,7 @@ const gchar *
polkit_action_description_get_annotation (PolkitActionDescription *action_description,
const gchar *key)
{
+ g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL);
return g_hash_table_lookup (action_description->annotations, key);
}
@@ -266,6 +276,8 @@ polkit_action_description_get_annotation_keys (PolkitActionDescription *action_d
GHashTableIter iter;
const gchar *key;
+ g_return_val_if_fail (POLKIT_IS_ACTION_DESCRIPTION (action_description), NULL);
+
if (action_description->annotation_keys != NULL)
goto out;
@@ -295,6 +307,7 @@ polkit_action_description_new (const gchar *action_id,
GHashTable *annotations)
{
PolkitActionDescription *ret;
+ g_return_val_if_fail (annotations != NULL, NULL);
ret = POLKIT_ACTION_DESCRIPTION (g_object_new (POLKIT_TYPE_ACTION_DESCRIPTION, NULL));
ret->action_id = g_strdup (action_id);
ret->description = g_strdup (description);
diff --git a/src/polkit/polkitauthorizationresult.c b/src/polkit/polkitauthorizationresult.c
index e027008..00396b2 100644
--- a/src/polkit/polkitauthorizationresult.c
+++ b/src/polkit/polkitauthorizationresult.c
@@ -106,6 +106,8 @@ polkit_authorization_result_new (gboolean is_authorized,
{
PolkitAuthorizationResult *authorization_result;
+ g_return_val_if_fail (details == NULL || POLKIT_IS_DETAILS (details), NULL);
+
authorization_result = POLKIT_AUTHORIZATION_RESULT (g_object_new (POLKIT_TYPE_AUTHORIZATION_RESULT, NULL));
authorization_result->is_authorized = is_authorized;
authorization_result->is_challenge = is_challenge;
@@ -128,6 +130,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 result->is_authorized;
}
@@ -142,6 +145,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 result->is_challenge;
}
@@ -157,6 +161,7 @@ polkit_authorization_result_get_is_challenge (PolkitAuthorizationResult *result)
PolkitDetails *
polkit_authorization_result_get_details (PolkitAuthorizationResult *result)
{
+ g_return_val_if_fail (POLKIT_IS_AUTHORIZATION_RESULT (result), NULL);
return result->details;
}
@@ -183,6 +188,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)
@@ -219,6 +226,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 19bdd36..9770191 100644
--- a/src/polkit/polkitdetails.c
+++ b/src/polkit/polkitdetails.c
@@ -127,6 +127,8 @@ const gchar *
polkit_details_lookup (PolkitDetails *details,
const gchar *key)
{
+ g_return_val_if_fail (POLKIT_IS_DETAILS (details), NULL);
+ g_return_val_if_fail (key != NULL, NULL);
if (details->hash == NULL)
return NULL;
else
@@ -146,6 +148,8 @@ polkit_details_insert (PolkitDetails *details,
const gchar *key,
const gchar *value)
{
+ g_return_if_fail (POLKIT_IS_DETAILS (details));
+ g_return_if_fail (key != NULL);
if (details->hash == NULL)
details->hash = g_hash_table_new_full (g_str_hash,
g_str_equal,
@@ -169,6 +173,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 3fad501..599056c 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), 0);
return POLKIT_IDENTITY_GET_IFACE (identity)->hash (identity);
}
@@ -103,6 +104,9 @@ gboolean
polkit_identity_equal (PolkitIdentity *a,
PolkitIdentity *b)
{
+ g_return_val_if_fail (POLKIT_IS_IDENTITY (a), FALSE);
+ g_return_val_if_fail (POLKIT_IS_IDENTITY (b), FALSE);
+
if (!g_type_is_a (G_TYPE_FROM_INSTANCE (a), G_TYPE_FROM_INSTANCE (b)))
return FALSE;
@@ -121,6 +125,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);
}
@@ -144,6 +149,7 @@ polkit_identity_from_string (const gchar *str,
gchar *endptr;
g_return_val_if_fail (str != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* TODO: we could do something with VFuncs like in g_icon_from_string() */
diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c
index 99d49cd..40ef2e9 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), 0);
return POLKIT_SUBJECT_GET_IFACE (subject)->hash (subject);
}
@@ -104,6 +105,9 @@ 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 +126,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 +149,8 @@ polkit_subject_exists (PolkitSubject *subject,
GAsyncReadyCallback callback,
gpointer user_data)
{
+ g_return_if_fail (POLKIT_IS_SUBJECT (subject));
+ g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
POLKIT_SUBJECT_GET_IFACE (subject)->exists (subject,
cancellable,
callback,
@@ -165,6 +172,9 @@ polkit_subject_exists_finish (PolkitSubject *subject,
GAsyncResult *res,
GError **error)
{
+ g_return_val_if_fail (POLKIT_IS_SUBJECT (subject), FALSE);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return POLKIT_SUBJECT_GET_IFACE (subject)->exists_finish (subject,
res,
error);
@@ -188,6 +198,9 @@ polkit_subject_exists_sync (PolkitSubject *subject,
GCancellable *cancellable,
GError **error)
{
+ g_return_val_if_fail (POLKIT_IS_SUBJECT (subject), FALSE);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return POLKIT_SUBJECT_GET_IFACE (subject)->exists_sync (subject,
cancellable,
error);
@@ -213,6 +226,7 @@ polkit_subject_from_string (const gchar *str,
gchar *endptr;
g_return_val_if_fail (str != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* TODO: we could do something with VFuncs like in g_icon_from_string() */
diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c
index bde6bca..562acf5 100644
--- a/src/polkit/polkitsystembusname.c
+++ b/src/polkit/polkitsystembusname.c
@@ -163,6 +163,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;
}
@@ -177,6 +178,8 @@ 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_return_if_fail (g_dbus_is_unique_name (name));
g_free (system_bus_name->name);
system_bus_name->name = g_strdup (name);
}
@@ -356,6 +359,10 @@ polkit_system_bus_name_get_process_sync (PolkitSystemBusName *system_bus_name,
GVariant *result;
guint32 pid;
+ g_return_val_if_fail (POLKIT_IS_SYSTEM_BUS_NAME (system_bus_name), NULL);
+ g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
ret = NULL;
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
diff --git a/src/polkit/polkittemporaryauthorization.c b/src/polkit/polkittemporaryauthorization.c
index 71092b4..996cbed 100644
--- a/src/polkit/polkittemporaryauthorization.c
+++ b/src/polkit/polkittemporaryauthorization.c
@@ -126,6 +126,7 @@ polkit_temporary_authorization_new (const gchar *id,
const gchar *
polkit_temporary_authorization_get_id (PolkitTemporaryAuthorization *authorization)
{
+ g_return_val_if_fail (POLKIT_IS_TEMPORARY_AUTHORIZATION (authorization), NULL);
return authorization->id;
}
@@ -140,6 +141,7 @@ polkit_temporary_authorization_get_id (PolkitTemporaryAuthorization *authorizati
const gchar *
polkit_temporary_authorization_get_action_id (PolkitTemporaryAuthorization *authorization)
{
+ g_return_val_if_fail (POLKIT_IS_TEMPORARY_AUTHORIZATION (authorization), NULL);
return authorization->action_id;
}
@@ -154,6 +156,7 @@ polkit_temporary_authorization_get_action_id (PolkitTemporaryAuthorization *auth
PolkitSubject *
polkit_temporary_authorization_get_subject (PolkitTemporaryAuthorization *authorization)
{
+ g_return_val_if_fail (POLKIT_IS_TEMPORARY_AUTHORIZATION (authorization), NULL);
return g_object_ref (authorization->subject);
}
@@ -168,6 +171,7 @@ polkit_temporary_authorization_get_subject (PolkitTemporaryAuthorization *author
guint64
polkit_temporary_authorization_get_time_obtained (PolkitTemporaryAuthorization *authorization)
{
+ g_return_val_if_fail (POLKIT_IS_TEMPORARY_AUTHORIZATION (authorization), 0);
return authorization->time_obtained;
}
@@ -182,6 +186,7 @@ polkit_temporary_authorization_get_time_obtained (PolkitTemporaryAuthorization *
guint64
polkit_temporary_authorization_get_time_expires (PolkitTemporaryAuthorization *authorization)
{
+ g_return_val_if_fail (POLKIT_IS_TEMPORARY_AUTHORIZATION (authorization), 0);
return authorization->time_expires;
}
diff --git a/src/polkit/polkitunixgroup.c b/src/polkit/polkitunixgroup.c
index 733a2c5..53cd261 100644
--- a/src/polkit/polkitunixgroup.c
+++ b/src/polkit/polkitunixgroup.c
@@ -153,6 +153,7 @@ polkit_unix_group_class_init (PolkitUnixGroupClass *klass)
gint
polkit_unix_group_get_gid (PolkitUnixGroup *group)
{
+ g_return_val_if_fail (POLKIT_IS_UNIX_GROUP (group), -1);
return group->gid;
}
@@ -167,6 +168,7 @@ void
polkit_unix_group_set_gid (PolkitUnixGroup *group,
gint gid)
{
+ g_return_if_fail (POLKIT_IS_UNIX_GROUP (group));
group->gid = gid;
}
@@ -203,6 +205,9 @@ polkit_unix_group_new_for_name (const gchar *name,
struct group *group;
PolkitIdentity *identity;
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
identity = NULL;
group = getgrnam (name);
diff --git a/src/polkit/polkitunixprocess.c b/src/polkit/polkitunixprocess.c
index e132387..8617c7f 100644
--- a/src/polkit/polkitunixprocess.c
+++ b/src/polkit/polkitunixprocess.c
@@ -197,6 +197,7 @@ polkit_unix_process_class_init (PolkitUnixProcessClass *klass)
gint
polkit_unix_process_get_pid (PolkitUnixProcess *process)
{
+ g_return_val_if_fail (POLKIT_IS_UNIX_PROCESS (process), 0);
return process->pid;
}
@@ -221,6 +222,9 @@ polkit_unix_process_get_owner (PolkitUnixProcess *process,
char procbuf[32];
#endif
+ g_return_val_if_fail (POLKIT_IS_UNIX_PROCESS (process), 0);
+ g_return_val_if_fail (error == NULL || *error == NULL, 0);
+
result = 0;
#ifdef HAVE_FREEBSD
@@ -268,6 +272,7 @@ polkit_unix_process_get_owner (PolkitUnixProcess *process,
guint64
polkit_unix_process_get_start_time (PolkitUnixProcess *process)
{
+ g_return_val_if_fail (POLKIT_IS_UNIX_PROCESS (process), 0);
return process->start_time;
}
@@ -282,6 +287,7 @@ void
polkit_unix_process_set_pid (PolkitUnixProcess *process,
gint pid)
{
+ g_return_if_fail (POLKIT_IS_UNIX_PROCESS (process));
process->pid = pid;
if (pid != (gint) -1)
process->start_time = get_start_time_for_pid (pid, NULL);
diff --git a/src/polkit/polkitunixsession.c b/src/polkit/polkitunixsession.c
index d9a6e8f..8f24e9f 100644
--- a/src/polkit/polkitunixsession.c
+++ b/src/polkit/polkitunixsession.c
@@ -195,6 +195,7 @@ polkit_unix_session_class_init (PolkitUnixSessionClass *klass)
const gchar *
polkit_unix_session_get_session_id (PolkitUnixSession *session)
{
+ g_return_val_if_fail (POLKIT_IS_UNIX_SESSION (session), NULL);
return session->session_id;
}
@@ -209,6 +210,8 @@ void
polkit_unix_session_set_session_id (PolkitUnixSession *session,
const gchar *session_id)
{
+ g_return_if_fail (POLKIT_IS_UNIX_SESSION (session));
+ /*g_return_if_fail (session_id != NULL);*/
g_free (session->session_id);
session->session_id = g_strdup (session_id);
}
diff --git a/src/polkit/polkitunixuser.c b/src/polkit/polkitunixuser.c
index f9915f0..f592151 100644
--- a/src/polkit/polkitunixuser.c
+++ b/src/polkit/polkitunixuser.c
@@ -153,6 +153,7 @@ polkit_unix_user_class_init (PolkitUnixUserClass *klass)
gint
polkit_unix_user_get_uid (PolkitUnixUser *user)
{
+ g_return_val_if_fail (POLKIT_IS_UNIX_USER (user), -1);
return user->uid;
}
@@ -167,6 +168,7 @@ void
polkit_unix_user_set_uid (PolkitUnixUser *user,
gint uid)
{
+ g_return_if_fail (POLKIT_IS_UNIX_USER (user));
user->uid = uid;
}
@@ -203,6 +205,9 @@ polkit_unix_user_new_for_name (const gchar *name,
struct passwd *passwd;
PolkitIdentity *identity;
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
identity = NULL;
passwd = getpwnam (name);
diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c
index d7bd5f0..528aabe 100644
--- a/src/polkitagent/polkitagentlistener.c
+++ b/src/polkitagent/polkitagentlistener.c
@@ -327,6 +327,11 @@ polkit_agent_register_listener (PolkitAgentListener *listener,
gboolean ret;
GDBusNodeInfo *node_info;
+ g_return_val_if_fail (POLKIT_AGENT_IS_LISTENER (listener), FALSE);
+ g_return_val_if_fail (POLKIT_IS_SUBJECT (subject), FALSE);
+ g_return_val_if_fail (g_variant_is_object_path (object_path), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
ret = FALSE;
server = server_new (subject, object_path, NULL, error);
@@ -575,6 +580,13 @@ polkit_agent_listener_initiate_authentication (PolkitAgentListener *listener,
GAsyncReadyCallback callback,
gpointer user_data)
{
+ g_return_if_fail (POLKIT_AGENT_IS_LISTENER (listener));
+ g_return_if_fail (details == NULL || POLKIT_IS_DETAILS (details));
+ g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
+ g_return_if_fail (action_id != NULL);
+ g_return_if_fail (message != NULL);
+ g_return_if_fail (cookie != NULL);
+ g_return_if_fail (identities != NULL);
POLKIT_AGENT_LISTENER_GET_CLASS (listener)->initiate_authentication (listener,
action_id,
message,
@@ -603,6 +615,9 @@ polkit_agent_listener_initiate_authentication_finish (PolkitAgentListener *list
GAsyncResult *res,
GError **error)
{
+ g_return_val_if_fail (POLKIT_AGENT_IS_LISTENER (listener), FALSE);
+ g_return_val_if_fail (G_IS_ASYNC_RESULT (res), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
return POLKIT_AGENT_LISTENER_GET_CLASS (listener)->initiate_authentication_finish (listener,
res,
error);
diff --git a/src/polkitagent/polkitagentsession.c b/src/polkitagent/polkitagentsession.c
index b919e0a..1c17c84 100644
--- a/src/polkitagent/polkitagentsession.c
+++ b/src/polkitagent/polkitagentsession.c
@@ -243,6 +243,9 @@ polkit_agent_session_new (PolkitIdentity *identity,
{
PolkitAgentSession *session;
+ g_return_val_if_fail (POLKIT_IS_IDENTITY (identity), NULL);
+ g_return_val_if_fail (cookie != NULL, NULL);
+
session = POLKIT_AGENT_SESSION (g_object_new (POLKIT_AGENT_TYPE_SESSION, NULL));
session->identity = g_object_ref (identity);
@@ -408,6 +411,7 @@ polkit_agent_session_response (PolkitAgentSession *session,
size_t response_len;
const char newline[] = "\n";
+ g_return_if_fail (POLKIT_AGENT_IS_SESSION (session));
g_return_if_fail (response != NULL);
response_len = strlen (response);
@@ -436,6 +440,8 @@ polkit_agent_session_initiate (PolkitAgentSession *session)
gboolean ret;
struct passwd *passwd;
+ g_return_if_fail (POLKIT_AGENT_IS_SESSION (session));
+
ret = FALSE;
/* TODO: also support authorization for other kinds of identities */
@@ -506,5 +512,6 @@ error:
void
polkit_agent_session_cancel (PolkitAgentSession *session)
{
+ g_return_if_fail (POLKIT_AGENT_IS_SESSION (session));
complete_session (session, FALSE);
}
More information about the hal-commit
mailing list