summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-11-25 10:51:44 +0100
committerJiří Klimeš <jklimes@redhat.com>2015-11-25 12:08:07 +0100
commit542200f5393ae0923ce4693085cfe77902622778 (patch)
tree24991a8f8595fe1d0fa909da4d85ff703eb75828
parent3d8eb6b1e0016711cf34767a258b299aa84c602a (diff)
downloadNetworkManager-542200f5393ae0923ce4693085cfe77902622778.tar.gz
clients: check errors of polkit_unix_session_new_for_process_sync()
polkit_unix_session_new_for_process_sync() can fail. And calling polkit_agent_listener_register() with NULL PolkitSubject results in errors. https://bugzilla.gnome.org/show_bug.cgi?id=758625
-rw-r--r--clients/common/nm-polkit-listener.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/clients/common/nm-polkit-listener.c b/clients/common/nm-polkit-listener.c
index 3f871b6323..9646374e9d 100644
--- a/clients/common/nm-polkit-listener.c
+++ b/clients/common/nm-polkit-listener.c
@@ -321,9 +321,11 @@ nm_polkit_listener_new (gboolean for_session, GError **error)
listener = g_object_new (NM_TYPE_POLKIT_LISTENER, NULL);
priv = NM_POLKIT_LISTENER_GET_PRIVATE (listener);
- if (for_session)
- session = polkit_unix_session_new_for_process_sync (getpid (), NULL, NULL);
- else
+ if (for_session) {
+ session = polkit_unix_session_new_for_process_sync (getpid (), NULL, error);
+ if (!session)
+ return NULL;
+ } else
session = polkit_unix_process_new_for_owner (getpid (), 0, getuid ());
priv->reg_handle = polkit_agent_listener_register (listener, POLKIT_AGENT_REGISTER_FLAGS_NONE,