/[gentoo-x86]/sys-auth/consolekit/files/consolekit-0.4.2-revert.patch
Gentoo

Contents of /sys-auth/consolekit/files/consolekit-0.4.2-revert.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Thu Sep 9 21:18:11 2010 UTC (9 years, 1 month ago) by ssuominen
Branch: MAIN
Changes since 1.1: +2 -0 lines
File MIME type: text/x-diff
add bug # to patch

(Portage version: 2.2_rc78/cvs/Linux x86_64)

1 http://bugs.gentoo.org/336634
2
3 Revert upstream http://cgit.freedesktop.org/ConsoleKit/commit/?id=4f88228f31a63c026c424a92827f26ad7535275c
4 which renders ConsoleKit unusable.
5
6 diff -ur ConsoleKit-0.4.2.orig/src/ck-manager.c ConsoleKit-0.4.2/src/ck-manager.c
7 --- ConsoleKit-0.4.2.orig/src/ck-manager.c 2010-09-03 16:54:31.000000000 +0300
8 +++ ConsoleKit-0.4.2/src/ck-manager.c 2010-09-10 00:02:32.000000000 +0300
9 @@ -1660,175 +1660,12 @@
10 dbus_g_method_return (context, cookie);
11 }
12
13 -enum {
14 - PROP_STRING,
15 - PROP_BOOLEAN,
16 -};
17 -
18 -#define CK_TYPE_PARAMETER_STRUCT (dbus_g_type_get_struct ("GValueArray", \
19 - G_TYPE_STRING, \
20 - G_TYPE_VALUE, \
21 - G_TYPE_INVALID))
22 -
23 -static gboolean
24 -_get_parameter (GPtrArray *parameters,
25 - const char *name,
26 - int prop_type,
27 - gpointer *value)
28 -{
29 - gboolean ret;
30 - int i;
31 -
32 - if (parameters == NULL) {
33 - return FALSE;
34 - }
35 -
36 - ret = FALSE;
37 -
38 - for (i = 0; i < parameters->len && ret == FALSE; i++) {
39 - gboolean res;
40 - GValue val_struct = { 0, };
41 - char *prop_name;
42 - GValue *prop_val;
43 -
44 - g_value_init (&val_struct, CK_TYPE_PARAMETER_STRUCT);
45 - g_value_set_static_boxed (&val_struct, g_ptr_array_index (parameters, i));
46 -
47 - res = dbus_g_type_struct_get (&val_struct,
48 - 0, &prop_name,
49 - 1, &prop_val,
50 - G_MAXUINT);
51 - if (! res) {
52 - g_debug ("Unable to extract parameter input");
53 - goto cont;
54 - }
55 -
56 - if (prop_name == NULL) {
57 - g_debug ("Skipping NULL parameter");
58 - goto cont;
59 - }
60 -
61 - if (strcmp (prop_name, name) != 0) {
62 - goto cont;
63 - }
64 -
65 - switch (prop_type) {
66 - case PROP_STRING:
67 - if (value != NULL) {
68 - *value = g_value_dup_string (prop_val);
69 - }
70 - break;
71 - case PROP_BOOLEAN:
72 - if (value != NULL) {
73 - *(gboolean *)value = g_value_get_boolean (prop_val);
74 - }
75 - break;
76 - default:
77 - g_assert_not_reached ();
78 - break;
79 - }
80 -
81 - ret = TRUE;
82 -
83 - cont:
84 - g_free (prop_name);
85 - if (prop_val != NULL) {
86 - g_value_unset (prop_val);
87 - g_free (prop_val);
88 - }
89 - }
90 -
91 - return ret;
92 -}
93 -
94 -static gboolean
95 -_verify_login_session_id_is_local (CkManager *manager,
96 - const char *login_session_id)
97 -{
98 - GHashTableIter iter;
99 - const char *id;
100 - CkSession *session;
101 -
102 - g_return_val_if_fail (CK_IS_MANAGER (manager), FALSE);
103 -
104 - /* If any local session exists for the given login session id
105 - then that means a trusted party has vouched for the
106 - original login */
107 -
108 - g_debug ("Looking for local sessions for login-session-id=%s", login_session_id);
109 -
110 - session = NULL;
111 - g_hash_table_iter_init (&iter, manager->priv->sessions);
112 - while (g_hash_table_iter_next (&iter, (gpointer *)&id, (gpointer *)&session)) {
113 - if (session != NULL) {
114 - gboolean is_local;
115 - char *sessid;
116 -
117 - sessid = NULL;
118 - g_object_get (session,
119 - "login-session-id", &sessid,
120 - "is-local", &is_local,
121 - NULL);
122 - if (g_strcmp0 (sessid, login_session_id) == 0 && is_local) {
123 - g_debug ("CkManager: found is-local=true on %s", id);
124 - return TRUE;
125 - }
126 - }
127 - }
128 -
129 - return FALSE;
130 -}
131 -
132 -static void
133 -add_param_boolean (GPtrArray *parameters,
134 - const char *key,
135 - gboolean value)
136 -{
137 - GValue val = { 0, };
138 - GValue param_val = { 0, };
139 -
140 - g_value_init (&val, G_TYPE_BOOLEAN);
141 - g_value_set_boolean (&val, value);
142 - g_value_init (&param_val, CK_TYPE_PARAMETER_STRUCT);
143 - g_value_take_boxed (&param_val,
144 - dbus_g_type_specialized_construct (CK_TYPE_PARAMETER_STRUCT));
145 - dbus_g_type_struct_set (&param_val,
146 - 0, key,
147 - 1, &val,
148 - G_MAXUINT);
149 - g_value_unset (&val);
150 -
151 - g_ptr_array_add (parameters, g_value_get_boxed (&param_val));
152 -}
153 -
154 static void
155 verify_and_open_session_for_leader (CkManager *manager,
156 CkSessionLeader *leader,
157 - GPtrArray *parameters,
158 + const GPtrArray *parameters,
159 DBusGMethodInvocation *context)
160 {
161 - /* Only allow a local session if originating from an existing
162 - local session. Effectively this means that only trusted
163 - parties can create local sessions. */
164 -
165 - g_debug ("CkManager: verifying session for leader");
166 -
167 - if (parameters != NULL && ! _get_parameter (parameters, "is-local", PROP_BOOLEAN, NULL)) {
168 - gboolean is_local;
169 - char *login_session_id;
170 -
171 - g_debug ("CkManager: is-local has not been set, will inherit from existing login-session-id if available");
172 -
173 - is_local = FALSE;
174 -
175 - if (_get_parameter (parameters, "login-session-id", PROP_STRING, (gpointer *) &login_session_id)) {
176 - is_local = _verify_login_session_id_is_local (manager, login_session_id);
177 - g_debug ("CkManager: found is-local=%s", is_local ? "true" : "false");
178 - }
179 -
180 - add_param_boolean (parameters, "is-local", is_local);
181 - }
182 -
183 open_session_for_leader (manager,
184 leader,
185 parameters,
186 diff -ur ConsoleKit-0.4.2.orig/tools/ck-collect-session-info.c ConsoleKit-0.4.2/tools/ck-collect-session-info.c
187 --- ConsoleKit-0.4.2.orig/tools/ck-collect-session-info.c 2010-09-03 16:54:31.000000000 +0300
188 +++ ConsoleKit-0.4.2/tools/ck-collect-session-info.c 2010-09-10 00:06:30.000000000 +0300
189 @@ -274,7 +274,8 @@
190 si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
191 ck_process_stat_free (xorg_stat);
192
193 - /* don't set is-local here - let the daemon do that */
194 + si->is_local = TRUE;
195 + si->is_local_is_set = TRUE;
196
197 g_free (si->remote_host_name);
198 si->remote_host_name = NULL;
199 @@ -303,6 +304,13 @@
200
201 fill_x11_info (si);
202
203 + if (! si->is_local_is_set) {
204 + /* FIXME: how should we set this? */
205 + /* non x11 sessions must be local I guess */
206 + si->is_local = TRUE;
207 + si->is_local_is_set = TRUE;
208 + }
209 +
210 res = ck_unix_pid_get_login_session_id (si->pid, &si->login_session_id);
211 if (! res) {
212 si->login_session_id = NULL;

  ViewVC Help
Powered by ViewVC 1.1.20