summaryrefslogtreecommitdiff
path: root/source/l/ConsoleKit/consolekit-0.4.2-revert.patch
blob: cb1f461de94c6864dbb4ac72582c7f2180cd1196 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
Revert upstream http://cgit.freedesktop.org/ConsoleKit/commit/?id=4f88228f31a63c026c424a92827f26ad7535275c
which renders ConsoleKit unusable.

diff -ur ConsoleKit-0.4.2.orig/src/ck-manager.c ConsoleKit-0.4.2/src/ck-manager.c
--- ConsoleKit-0.4.2.orig/src/ck-manager.c	2010-09-03 16:54:31.000000000 +0300
+++ ConsoleKit-0.4.2/src/ck-manager.c	2010-09-10 00:02:32.000000000 +0300
@@ -1660,175 +1660,12 @@
         dbus_g_method_return (context, cookie);
 }
 
-enum {
-        PROP_STRING,
-        PROP_BOOLEAN,
-};
-
-#define CK_TYPE_PARAMETER_STRUCT (dbus_g_type_get_struct ("GValueArray", \
-                                                          G_TYPE_STRING,  \
-                                                          G_TYPE_VALUE, \
-                                                          G_TYPE_INVALID))
-
-static gboolean
-_get_parameter (GPtrArray  *parameters,
-                const char *name,
-                int         prop_type,
-                gpointer   *value)
-{
-        gboolean ret;
-        int      i;
-
-        if (parameters == NULL) {
-                return FALSE;
-        }
-
-        ret = FALSE;
-
-        for (i = 0; i < parameters->len && ret == FALSE; i++) {
-                gboolean    res;
-                GValue      val_struct = { 0, };
-                char       *prop_name;
-                GValue     *prop_val;
-
-                g_value_init (&val_struct, CK_TYPE_PARAMETER_STRUCT);
-                g_value_set_static_boxed (&val_struct, g_ptr_array_index (parameters, i));
-
-                res = dbus_g_type_struct_get (&val_struct,
-                                              0, &prop_name,
-                                              1, &prop_val,
-                                              G_MAXUINT);
-                if (! res) {
-                        g_debug ("Unable to extract parameter input");
-                        goto cont;
-                }
-
-                if (prop_name == NULL) {
-                        g_debug ("Skipping NULL parameter");
-                        goto cont;
-                }
-
-                if (strcmp (prop_name, name) != 0) {
-                        goto cont;
-                }
-
-                switch (prop_type) {
-                case PROP_STRING:
-                        if (value != NULL) {
-                                *value = g_value_dup_string (prop_val);
-                        }
-                        break;
-                case PROP_BOOLEAN:
-                        if (value != NULL) {
-                                *(gboolean *)value = g_value_get_boolean (prop_val);
-                        }
-                        break;
-                default:
-                        g_assert_not_reached ();
-                        break;
-                }
-
-                ret = TRUE;
-
-        cont:
-                g_free (prop_name);
-                if (prop_val != NULL) {
-                        g_value_unset (prop_val);
-                        g_free (prop_val);
-                }
-        }
-
-        return ret;
-}
-
-static gboolean
-_verify_login_session_id_is_local (CkManager  *manager,
-                                   const char *login_session_id)
-{
-        GHashTableIter iter;
-        const char    *id;
-        CkSession     *session;
-
-        g_return_val_if_fail (CK_IS_MANAGER (manager), FALSE);
-
-        /* If any local session exists for the given login session id
-           then that means a trusted party has vouched for the
-           original login */
-
-        g_debug ("Looking for local sessions for login-session-id=%s", login_session_id);
-
-        session = NULL;
-        g_hash_table_iter_init (&iter, manager->priv->sessions);
-        while (g_hash_table_iter_next (&iter, (gpointer *)&id, (gpointer *)&session)) {
-                if (session != NULL) {
-                        gboolean is_local;
-                        char    *sessid;
-
-                        sessid = NULL;
-                        g_object_get (session,
-                                      "login-session-id", &sessid,
-                                      "is-local", &is_local,
-                                      NULL);
-                        if (g_strcmp0 (sessid, login_session_id) == 0 && is_local) {
-                                g_debug ("CkManager: found is-local=true on %s", id);
-                                return TRUE;
-                        }
-                }
-        }
-
-        return FALSE;
-}
-
-static void
-add_param_boolean (GPtrArray  *parameters,
-                   const char *key,
-                   gboolean    value)
-{
-        GValue   val = { 0, };
-        GValue   param_val = { 0, };
-
-        g_value_init (&val, G_TYPE_BOOLEAN);
-        g_value_set_boolean (&val, value);
-        g_value_init (&param_val, CK_TYPE_PARAMETER_STRUCT);
-        g_value_take_boxed (&param_val,
-                            dbus_g_type_specialized_construct (CK_TYPE_PARAMETER_STRUCT));
-        dbus_g_type_struct_set (&param_val,
-                                0, key,
-                                1, &val,
-                                G_MAXUINT);
-        g_value_unset (&val);
-
-        g_ptr_array_add (parameters, g_value_get_boxed (&param_val));
-}
-
 static void
 verify_and_open_session_for_leader (CkManager             *manager,
                                     CkSessionLeader       *leader,
-                                    GPtrArray             *parameters,
+                                    const GPtrArray       *parameters,
                                     DBusGMethodInvocation *context)
 {
-        /* Only allow a local session if originating from an existing
-           local session.  Effectively this means that only trusted
-           parties can create local sessions. */
-
-        g_debug ("CkManager: verifying session for leader");
-
-        if (parameters != NULL && ! _get_parameter (parameters, "is-local", PROP_BOOLEAN, NULL)) {
-                gboolean is_local;
-                char    *login_session_id;
-
-                g_debug ("CkManager: is-local has not been set, will inherit from existing login-session-id if available");
-
-                is_local = FALSE;
-
-                if (_get_parameter (parameters, "login-session-id", PROP_STRING, (gpointer *) &login_session_id)) {
-                        is_local = _verify_login_session_id_is_local (manager, login_session_id);
-                        g_debug ("CkManager: found is-local=%s", is_local ? "true" : "false");
-                }
-
-                add_param_boolean (parameters, "is-local", is_local);
-        }
-
         open_session_for_leader (manager,
                                  leader,
                                  parameters,
diff -ur ConsoleKit-0.4.2.orig/tools/ck-collect-session-info.c ConsoleKit-0.4.2/tools/ck-collect-session-info.c
--- ConsoleKit-0.4.2.orig/tools/ck-collect-session-info.c	2010-09-03 16:54:31.000000000 +0300
+++ ConsoleKit-0.4.2/tools/ck-collect-session-info.c	2010-09-10 00:06:30.000000000 +0300
@@ -274,7 +274,8 @@
         si->x11_display_device = ck_process_stat_get_tty (xorg_stat);
         ck_process_stat_free (xorg_stat);
 
-        /* don't set is-local here - let the daemon do that */
+        si->is_local = TRUE;
+        si->is_local_is_set = TRUE;
 
         g_free (si->remote_host_name);
         si->remote_host_name = NULL;
@@ -303,6 +304,13 @@
 
         fill_x11_info (si);
 
+        if (! si->is_local_is_set) {
+                /* FIXME: how should we set this? */
+                /* non x11 sessions must be local I guess */
+                si->is_local = TRUE;
+                si->is_local_is_set = TRUE;
+        }
+
         res = ck_unix_pid_get_login_session_id (si->pid, &si->login_session_id);
         if (! res) {
                 si->login_session_id = NULL;