[Xfce4-commits] <xfce4-session:master> Create polkit subject only when we have valid data to set, consolkit-session or pid/process start time.
Jérôme Guelfucci
noreply at xfce.org
Sat Feb 27 00:38:02 CET 2010
Updating branch refs/heads/master
to 02e6e7c43b3147423981b9b4025173a7d49c243a (commit)
from 5646136fbd66c9f09f9f760bb294e3c73715694b (commit)
commit 02e6e7c43b3147423981b9b4025173a7d49c243a
Author: Ali Abdallah <aliov at xfce.org>
Date: Wed Feb 3 12:19:38 2010 +0100
Create polkit subject only when we have valid data to set, consolkit-session or pid/process start time.
xfce4-session/xfsm-shutdown-helper.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/xfce4-session/xfsm-shutdown-helper.c b/xfce4-session/xfsm-shutdown-helper.c
index 63306e9..79e223d 100644
--- a/xfce4-session/xfsm-shutdown-helper.c
+++ b/xfce4-session/xfsm-shutdown-helper.c
@@ -345,9 +345,6 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
if ( !helper->polkit_proxy )
return FALSE;
- helper->polkit_subject = g_value_array_new (2);
- helper->polkit_subject_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
/**
* This variable should be set by the session manager or by
* the login manager (gdm?). under clean Xfce environment
@@ -379,6 +376,11 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
if ( G_LIKELY (ret) )
{
GValue val = { 0 };
+ helper->polkit_subject = g_value_array_new (2);
+ helper->polkit_subject_hash = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&val, "unix-session");
@@ -418,6 +420,13 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
if ( G_LIKELY (start_time != 0 ) )
{
GValue val = { 0 }, pid_val = { 0 }, start_time_val = { 0 };
+
+ helper->polkit_subject = g_value_array_new (2);
+ helper->polkit_subject_hash = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
+
g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&val, "unix-process");
g_value_array_append (helper->polkit_subject, &val);
@@ -432,6 +441,11 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
g_value_set_uint64 (&start_time_val, start_time);
g_hash_table_insert (helper->polkit_subject_hash, g_strdup ("start-time"), &start_time_val);
}
+ else
+ {
+ g_warning ("Unable to create Polkit subject");
+ return FALSE;
+ }
}
g_value_init (&hash_elem,
More information about the Xfce4-commits
mailing list