diff options
author | Jiří Klimeš <jklimes@redhat.com> | 2015-11-25 10:51:44 +0100 |
---|---|---|
committer | Jiří Klimeš <jklimes@redhat.com> | 2015-11-25 12:14:02 +0100 |
commit | c7cb2e8c1cb934e6f2360615c4b86da5e9bad688 (patch) | |
tree | 78bf62c12fe3e3cc86a702bb7686a86be6c0b4b4 | |
parent | be8619261d90026a4ee6840c9ee05666c6eb8557 (diff) | |
download | NetworkManager-c7cb2e8c1cb934e6f2360615c4b86da5e9bad688.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
(cherry picked from commit 542200f5393ae0923ce4693085cfe77902622778)
-rw-r--r-- | clients/common/nm-polkit-listener.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clients/common/nm-polkit-listener.c b/clients/common/nm-polkit-listener.c index 82df1b2de2..c1c7c90804 100644 --- a/clients/common/nm-polkit-listener.c +++ b/clients/common/nm-polkit-listener.c @@ -323,9 +323,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, |