Merge lp:~robert-ancell/lightdm/session-lock-regression into lp:lightdm
- session-lock-regression
- Merge into trunk
Proposed by
Robert Ancell
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Robert Ancell | ||||
Approved revision: | 1752 | ||||
Merged at revision: | 1750 | ||||
Proposed branch: | lp:~robert-ancell/lightdm/session-lock-regression | ||||
Merge into: | lp:lightdm | ||||
Diff against target: |
710 lines (+303/-20) 25 files modified
src/seat.c (+28/-0) src/session.c (+4/-4) tests/Makefile.am (+4/-0) tests/scripts/lock-seat-console-kit.conf (+59/-0) tests/scripts/lock-seat-return-session-console-kit.conf (+74/-0) tests/scripts/lock-seat-return-session.conf (+6/-0) tests/scripts/lock-seat.conf (+3/-0) tests/scripts/lock-session-no-password.conf (+3/-0) tests/scripts/lock-session-return-session.conf (+6/-0) tests/scripts/lock-session.conf (+3/-0) tests/scripts/switch-to-greeter-new-session-logout-new.conf (+3/-0) tests/scripts/switch-to-greeter-new-session-logout-old.conf (+12/-3) tests/scripts/switch-to-greeter-new-session.conf (+3/-0) tests/scripts/switch-to-greeter-return-session-logout.conf (+6/-0) tests/scripts/switch-to-greeter-return-session.conf (+6/-0) tests/scripts/switch-to-greeter.conf (+3/-0) tests/scripts/switch-to-guest.conf (+3/-0) tests/scripts/switch-to-user-logout.conf (+3/-0) tests/scripts/switch-to-user-no-password.conf (+3/-0) tests/scripts/switch-to-user.conf (+3/-0) tests/scripts/switch-to-users.conf (+6/-0) tests/scripts/unity-switch.conf (+3/-0) tests/src/test-runner.c (+55/-13) tests/test-lock-seat-console-kit (+2/-0) tests/test-lock-seat-return-session-console-kit (+2/-0) |
||||
To merge this branch: | bzr merge lp:~robert-ancell/lightdm/session-lock-regression | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Ancell | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+179145@code.launchpad.net |
Commit message
Fix session locking broken in 1.7.5
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/seat.c' |
2 | --- src/seat.c 2013-07-30 14:04:44 +0000 |
3 | +++ src/seat.c 2013-08-08 10:11:25 +0000 |
4 | @@ -45,6 +45,9 @@ |
5 | /* The sessions on this seat */ |
6 | GList *sessions; |
7 | |
8 | + /* The last session set to active */ |
9 | + Session *active_session; |
10 | + |
11 | /* The session to set active when it starts */ |
12 | Session *session_to_activate; |
13 | |
14 | @@ -179,6 +182,10 @@ |
15 | |
16 | g_return_if_fail (seat != NULL); |
17 | |
18 | + /* Unlock this session */ |
19 | + if (session != seat->priv->active_session && !IS_GREETER (session)) |
20 | + session_unlock (session); |
21 | + |
22 | SEAT_GET_CLASS (seat)->set_active_session (seat, session); |
23 | |
24 | /* Stop any greeters */ |
25 | @@ -195,6 +202,15 @@ |
26 | session_stop (s); |
27 | } |
28 | } |
29 | + |
30 | + /* Lock previous sessions */ |
31 | + if (seat->priv->active_session) |
32 | + { |
33 | + if (session != seat->priv->active_session && !IS_GREETER (seat->priv->active_session)) |
34 | + session_lock (seat->priv->active_session); |
35 | + g_object_unref (seat->priv->active_session); |
36 | + } |
37 | + seat->priv->active_session = g_object_ref (session); |
38 | } |
39 | |
40 | Session * |
41 | @@ -503,6 +519,16 @@ |
42 | |
43 | g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat); |
44 | seat->priv->sessions = g_list_remove (seat->priv->sessions, session); |
45 | + if (session == seat->priv->active_session) |
46 | + { |
47 | + g_object_unref (seat->priv->active_session); |
48 | + seat->priv->active_session = NULL; |
49 | + } |
50 | + if (session == seat->priv->session_to_activate) |
51 | + { |
52 | + g_object_unref (seat->priv->session_to_activate); |
53 | + seat->priv->session_to_activate = NULL; |
54 | + } |
55 | |
56 | display_server = session_get_display_server (session); |
57 | if (!display_server) |
58 | @@ -1535,6 +1561,8 @@ |
59 | g_signal_handlers_disconnect_matched (session, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self); |
60 | } |
61 | g_list_free_full (self->priv->sessions, g_object_unref); |
62 | + if (self->priv->active_session) |
63 | + g_object_unref (self->priv->active_session); |
64 | if (self->priv->session_to_activate) |
65 | g_object_unref (self->priv->session_to_activate); |
66 | |
67 | |
68 | === modified file 'src/session.c' |
69 | --- src/session.c 2013-07-26 02:27:41 +0000 |
70 | +++ src/session.c 2013-08-08 10:11:25 +0000 |
71 | @@ -780,9 +780,9 @@ |
72 | g_return_if_fail (session != NULL); |
73 | if (getuid () == 0) |
74 | { |
75 | - if (login1_is_running ()) |
76 | + if (session->priv->login1_session) |
77 | login1_lock_session (session->priv->login1_session); |
78 | - if (!session->priv->login1_session) |
79 | + else if (session->priv->console_kit_cookie) |
80 | ck_lock_session (session->priv->console_kit_cookie); |
81 | } |
82 | } |
83 | @@ -793,9 +793,9 @@ |
84 | g_return_if_fail (session != NULL); |
85 | if (getuid () == 0) |
86 | { |
87 | - if (login1_is_running ()) |
88 | + if (session->priv->login1_session) |
89 | login1_unlock_session (session->priv->login1_session); |
90 | - if (!session->priv->login1_session) |
91 | + else if (session->priv->console_kit_cookie) |
92 | ck_unlock_session (session->priv->console_kit_cookie); |
93 | } |
94 | } |
95 | |
96 | === modified file 'tests/Makefile.am' |
97 | --- tests/Makefile.am 2013-07-30 16:11:22 +0000 |
98 | +++ tests/Makefile.am 2013-08-08 10:11:25 +0000 |
99 | @@ -106,6 +106,8 @@ |
100 | test-lock-session \ |
101 | test-lock-session-no-password \ |
102 | test-lock-session-return-session \ |
103 | + test-lock-seat-console-kit \ |
104 | + test-lock-seat-return-session-console-kit \ |
105 | test-switch-to-greeter \ |
106 | test-switch-to-greeter-new-session \ |
107 | test-switch-to-greeter-new-session-logout-new \ |
108 | @@ -321,7 +323,9 @@ |
109 | scripts/language-env.conf \ |
110 | scripts/language-no-accounts-service.conf \ |
111 | scripts/lock-seat.conf \ |
112 | + scripts/lock-seat-console-kit.conf \ |
113 | scripts/lock-seat-return-session.conf \ |
114 | + scripts/lock-seat-return-session-console-kit.conf \ |
115 | scripts/lock-session.conf \ |
116 | scripts/lock-session-no-password.conf \ |
117 | scripts/lock-session-return-session.conf \ |
118 | |
119 | === added file 'tests/scripts/lock-seat-console-kit.conf' |
120 | --- tests/scripts/lock-seat-console-kit.conf 1970-01-01 00:00:00 +0000 |
121 | +++ tests/scripts/lock-seat-console-kit.conf 2013-08-08 10:11:25 +0000 |
122 | @@ -0,0 +1,59 @@ |
123 | +# |
124 | +# Check can lock a seat from D-Bus using ConsoleKit |
125 | +# |
126 | + |
127 | +[test-runner-config] |
128 | +disable-login1=true |
129 | + |
130 | +[SeatDefaults] |
131 | +autologin-user=have-password1 |
132 | +user-session=default |
133 | + |
134 | +#?RUNNER DAEMON-START |
135 | + |
136 | +# X server starts |
137 | +#?XSERVER-0 START VT=7 |
138 | + |
139 | +# Daemon connects when X server is ready |
140 | +#?*XSERVER-0 INDICATE-READY |
141 | +#?XSERVER-0 INDICATE-READY |
142 | +#?XSERVER-0 ACCEPT-CONNECT |
143 | + |
144 | +# Session starts |
145 | +#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_COOKIE=ck-cookie-x:0 USER=have-password1 |
146 | +#?XSERVER-0 ACCEPT-CONNECT |
147 | +#?SESSION-X-0 CONNECT-XSERVER |
148 | + |
149 | +# Lock the seat |
150 | +#?*SESSION-X-0 LOCK-SEAT |
151 | +#?SESSION-X-0 LOCK-SEAT |
152 | + |
153 | +# New X server starts |
154 | +#?XSERVER-1 START VT=8 |
155 | + |
156 | +# Daemon connects when X server is ready |
157 | +#?*XSERVER-1 INDICATE-READY |
158 | +#?XSERVER-1 INDICATE-READY |
159 | +#?XSERVER-1 ACCEPT-CONNECT |
160 | + |
161 | +# Session is locked |
162 | +#?CONSOLE-KIT LOCK-SESSION |
163 | + |
164 | +# Greeter starts |
165 | +#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_COOKIE=ck-cookie-x:1 |
166 | +#?XSERVER-1 ACCEPT-CONNECT |
167 | +#?GREETER-X-1 CONNECT-XSERVER |
168 | +#?GREETER-X-1 CONNECT-TO-DAEMON |
169 | +#?GREETER-X-1 CONNECTED-TO-DAEMON |
170 | +#?GREETER-X-1 LOCK-HINT |
171 | + |
172 | +# Switch to greeter |
173 | +#?VT ACTIVATE VT=8 |
174 | + |
175 | +# Cleanup |
176 | +#?*STOP-DAEMON |
177 | +#?SESSION-X-0 TERMINATE SIGNAL=15 |
178 | +#?XSERVER-0 TERMINATE SIGNAL=15 |
179 | +#?GREETER-X-1 TERMINATE SIGNAL=15 |
180 | +#?XSERVER-1 TERMINATE SIGNAL=15 |
181 | +#?RUNNER DAEMON-EXIT STATUS=0 |
182 | |
183 | === added file 'tests/scripts/lock-seat-return-session-console-kit.conf' |
184 | --- tests/scripts/lock-seat-return-session-console-kit.conf 1970-01-01 00:00:00 +0000 |
185 | +++ tests/scripts/lock-seat-return-session-console-kit.conf 2013-08-08 10:11:25 +0000 |
186 | @@ -0,0 +1,74 @@ |
187 | +# |
188 | +# Check can lock a seat from D-Bus and can return to it when using ConsoleKit |
189 | +# |
190 | + |
191 | +[test-runner-config] |
192 | +disable-login1=true |
193 | + |
194 | +[SeatDefaults] |
195 | +autologin-user=have-password1 |
196 | +user-session=default |
197 | + |
198 | +#?RUNNER DAEMON-START |
199 | + |
200 | +# X server starts |
201 | +#?XSERVER-0 START VT=7 |
202 | + |
203 | +# Daemon connects when X server is ready |
204 | +#?*XSERVER-0 INDICATE-READY |
205 | +#?XSERVER-0 INDICATE-READY |
206 | +#?XSERVER-0 ACCEPT-CONNECT |
207 | + |
208 | +# Session starts |
209 | +#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_COOKIE=ck-cookie-x:0 USER=have-password1 |
210 | +#?XSERVER-0 ACCEPT-CONNECT |
211 | +#?SESSION-X-0 CONNECT-XSERVER |
212 | + |
213 | +# Lock the seat |
214 | +#?*SESSION-X-0 LOCK-SEAT |
215 | +#?SESSION-X-0 LOCK-SEAT |
216 | + |
217 | +# New X server starts |
218 | +#?XSERVER-1 START VT=8 |
219 | + |
220 | +# Daemon connects when X server is ready |
221 | +#?*XSERVER-1 INDICATE-READY |
222 | +#?XSERVER-1 INDICATE-READY |
223 | +#?XSERVER-1 ACCEPT-CONNECT |
224 | + |
225 | +# Session is locked |
226 | +#?CONSOLE-KIT LOCK-SESSION |
227 | + |
228 | +# Greeter starts |
229 | +#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_COOKIE=ck-cookie-x:1 |
230 | +#?XSERVER-1 ACCEPT-CONNECT |
231 | +#?GREETER-X-1 CONNECT-XSERVER |
232 | +#?GREETER-X-1 CONNECT-TO-DAEMON |
233 | +#?GREETER-X-1 CONNECTED-TO-DAEMON |
234 | +#?GREETER-X-1 LOCK-HINT |
235 | + |
236 | +# Switch to greeter |
237 | +#?VT ACTIVATE VT=8 |
238 | + |
239 | +# Login as existing user |
240 | +#?*GREETER-X-1 AUTHENTICATE USERNAME=have-password1 |
241 | +#?GREETER-X-1 SHOW-PROMPT TEXT="Password:" |
242 | +#?*GREETER-X-1 RESPOND TEXT="password" |
243 | +#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE |
244 | +#?*GREETER-X-1 START-SESSION |
245 | + |
246 | +# Old session is unlocked |
247 | +#?CONSOLE-KIT UNLOCK-SESSION |
248 | + |
249 | +# Return to session |
250 | +#?VT ACTIVATE VT=7 |
251 | + |
252 | +# Greeter and X server stop |
253 | +#?GREETER-X-1 TERMINATE SIGNAL=15 |
254 | +#?XSERVER-1 TERMINATE SIGNAL=15 |
255 | + |
256 | +# Cleanup |
257 | +#?*STOP-DAEMON |
258 | +#?SESSION-X-0 TERMINATE SIGNAL=15 |
259 | +#?XSERVER-0 TERMINATE SIGNAL=15 |
260 | +#?RUNNER DAEMON-EXIT STATUS=0 |
261 | |
262 | === modified file 'tests/scripts/lock-seat-return-session.conf' |
263 | --- tests/scripts/lock-seat-return-session.conf 2013-07-30 16:11:22 +0000 |
264 | +++ tests/scripts/lock-seat-return-session.conf 2013-08-08 10:11:25 +0000 |
265 | @@ -33,6 +33,9 @@ |
266 | #?XSERVER-1 INDICATE-READY |
267 | #?XSERVER-1 ACCEPT-CONNECT |
268 | |
269 | +# Session is locked |
270 | +#?LOGIN1 LOCK-SESSION |
271 | + |
272 | # Greeter starts |
273 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
274 | #?XSERVER-1 ACCEPT-CONNECT |
275 | @@ -51,6 +54,9 @@ |
276 | #?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE |
277 | #?*GREETER-X-1 START-SESSION |
278 | |
279 | +# Old session is unlocked |
280 | +#?LOGIN1 UNLOCK-SESSION |
281 | + |
282 | # Return to session |
283 | #?VT ACTIVATE VT=7 |
284 | |
285 | |
286 | === modified file 'tests/scripts/lock-seat.conf' |
287 | --- tests/scripts/lock-seat.conf 2013-07-30 16:11:22 +0000 |
288 | +++ tests/scripts/lock-seat.conf 2013-08-08 10:11:25 +0000 |
289 | @@ -33,6 +33,9 @@ |
290 | #?XSERVER-1 INDICATE-READY |
291 | #?XSERVER-1 ACCEPT-CONNECT |
292 | |
293 | +# Session is locked |
294 | +#?LOGIN1 LOCK-SESSION |
295 | + |
296 | # Greeter starts |
297 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
298 | #?XSERVER-1 ACCEPT-CONNECT |
299 | |
300 | === modified file 'tests/scripts/lock-session-no-password.conf' |
301 | --- tests/scripts/lock-session-no-password.conf 2013-07-30 16:11:22 +0000 |
302 | +++ tests/scripts/lock-session-no-password.conf 2013-08-08 10:11:25 +0000 |
303 | @@ -33,6 +33,9 @@ |
304 | #?XSERVER-1 INDICATE-READY |
305 | #?XSERVER-1 ACCEPT-CONNECT |
306 | |
307 | +# Session is locked |
308 | +#?LOGIN1 LOCK-SESSION |
309 | + |
310 | # Greeter starts with session user selected |
311 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
312 | #?XSERVER-1 ACCEPT-CONNECT |
313 | |
314 | === modified file 'tests/scripts/lock-session-return-session.conf' |
315 | --- tests/scripts/lock-session-return-session.conf 2013-07-30 16:11:22 +0000 |
316 | +++ tests/scripts/lock-session-return-session.conf 2013-08-08 10:11:25 +0000 |
317 | @@ -45,6 +45,9 @@ |
318 | # Switch to greeter |
319 | #?VT ACTIVATE VT=8 |
320 | |
321 | +# Session is locked |
322 | +#?LOGIN1 LOCK-SESSION |
323 | + |
324 | # Login as existing user |
325 | #?*GREETER-X-1 AUTHENTICATE USERNAME=have-password1 |
326 | #?GREETER-X-1 SHOW-PROMPT TEXT="Password:" |
327 | @@ -52,6 +55,9 @@ |
328 | #?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE |
329 | #?*GREETER-X-1 START-SESSION |
330 | |
331 | +# Existing session is unlocked |
332 | +#?LOGIN1 UNLOCK-SESSION |
333 | + |
334 | # Return to session |
335 | #?VT ACTIVATE VT=7 |
336 | |
337 | |
338 | === modified file 'tests/scripts/lock-session.conf' |
339 | --- tests/scripts/lock-session.conf 2013-07-30 16:11:22 +0000 |
340 | +++ tests/scripts/lock-session.conf 2013-08-08 10:11:25 +0000 |
341 | @@ -33,6 +33,9 @@ |
342 | #?XSERVER-1 INDICATE-READY |
343 | #?XSERVER-1 ACCEPT-CONNECT |
344 | |
345 | +# Session is locked |
346 | +#?LOGIN1 LOCK-SESSION |
347 | + |
348 | # Greeter starts with session user selected |
349 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
350 | #?XSERVER-1 ACCEPT-CONNECT |
351 | |
352 | === modified file 'tests/scripts/switch-to-greeter-new-session-logout-new.conf' |
353 | --- tests/scripts/switch-to-greeter-new-session-logout-new.conf 2013-07-30 16:11:22 +0000 |
354 | +++ tests/scripts/switch-to-greeter-new-session-logout-new.conf 2013-08-08 10:11:25 +0000 |
355 | @@ -33,6 +33,9 @@ |
356 | #?XSERVER-1 INDICATE-READY |
357 | #?XSERVER-1 ACCEPT-CONNECT |
358 | |
359 | +# Session is locked |
360 | +#?LOGIN1 LOCK-SESSION |
361 | + |
362 | # Greeter starts |
363 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
364 | #?XSERVER-1 ACCEPT-CONNECT |
365 | |
366 | === modified file 'tests/scripts/switch-to-greeter-new-session-logout-old.conf' |
367 | --- tests/scripts/switch-to-greeter-new-session-logout-old.conf 2013-07-30 16:11:22 +0000 |
368 | +++ tests/scripts/switch-to-greeter-new-session-logout-old.conf 2013-08-08 10:11:25 +0000 |
369 | @@ -33,6 +33,9 @@ |
370 | #?XSERVER-1 INDICATE-READY |
371 | #?XSERVER-1 ACCEPT-CONNECT |
372 | |
373 | +# Session is locked |
374 | +#?LOGIN1 LOCK-SESSION |
375 | + |
376 | # Greeter starts |
377 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
378 | #?XSERVER-1 ACCEPT-CONNECT |
379 | @@ -60,6 +63,15 @@ |
380 | #?*SWITCH-TO-USER USERNAME=have-password1 |
381 | #?RUNNER SWITCH-TO-USER USERNAME=have-password1 |
382 | |
383 | +# Existing session is unlocked |
384 | +#?LOGIN1 UNLOCK-SESSION |
385 | + |
386 | +# Switch to greeter |
387 | +#?VT ACTIVATE VT=7 |
388 | + |
389 | +# Session is locked |
390 | +#?LOGIN1 LOCK-SESSION |
391 | + |
392 | # Logout of old session |
393 | #?*SESSION-X-0 LOGOUT |
394 | #?XSERVER-0 TERMINATE SIGNAL=15 |
395 | @@ -77,9 +89,6 @@ |
396 | #?GREETER-X-0 CONNECT-TO-DAEMON |
397 | #?GREETER-X-0 CONNECTED-TO-DAEMON |
398 | |
399 | -# Switch to greeter |
400 | -#?VT ACTIVATE VT=7 |
401 | - |
402 | # Cleanup |
403 | #?*STOP-DAEMON |
404 | #?GREETER-X-0 TERMINATE SIGNAL=15 |
405 | |
406 | === modified file 'tests/scripts/switch-to-greeter-new-session.conf' |
407 | --- tests/scripts/switch-to-greeter-new-session.conf 2013-07-30 16:11:22 +0000 |
408 | +++ tests/scripts/switch-to-greeter-new-session.conf 2013-08-08 10:11:25 +0000 |
409 | @@ -33,6 +33,9 @@ |
410 | #?XSERVER-1 INDICATE-READY |
411 | #?XSERVER-1 ACCEPT-CONNECT |
412 | |
413 | +# Session is locked |
414 | +#?LOGIN1 LOCK-SESSION |
415 | + |
416 | # Greeter starts |
417 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
418 | #?XSERVER-1 ACCEPT-CONNECT |
419 | |
420 | === modified file 'tests/scripts/switch-to-greeter-return-session-logout.conf' |
421 | --- tests/scripts/switch-to-greeter-return-session-logout.conf 2013-07-30 16:11:22 +0000 |
422 | +++ tests/scripts/switch-to-greeter-return-session-logout.conf 2013-08-08 10:11:25 +0000 |
423 | @@ -33,6 +33,9 @@ |
424 | #?XSERVER-1 INDICATE-READY |
425 | #?XSERVER-1 ACCEPT-CONNECT |
426 | |
427 | +# Session is locked |
428 | +#?LOGIN1 LOCK-SESSION |
429 | + |
430 | # Greeter starts |
431 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
432 | #?XSERVER-1 ACCEPT-CONNECT |
433 | @@ -50,6 +53,9 @@ |
434 | #?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE |
435 | #?*GREETER-X-1 START-SESSION |
436 | |
437 | +# Session is unlocked |
438 | +#?LOGIN1 UNLOCK-SESSION |
439 | + |
440 | # Switch to session |
441 | #?VT ACTIVATE VT=7 |
442 | |
443 | |
444 | === modified file 'tests/scripts/switch-to-greeter-return-session.conf' |
445 | --- tests/scripts/switch-to-greeter-return-session.conf 2013-07-30 16:11:22 +0000 |
446 | +++ tests/scripts/switch-to-greeter-return-session.conf 2013-08-08 10:11:25 +0000 |
447 | @@ -33,6 +33,9 @@ |
448 | #?XSERVER-1 INDICATE-READY |
449 | #?XSERVER-1 ACCEPT-CONNECT |
450 | |
451 | +# Session is locked |
452 | +#?LOGIN1 LOCK-SESSION |
453 | + |
454 | # Greeter starts |
455 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
456 | #?XSERVER-1 ACCEPT-CONNECT |
457 | @@ -50,6 +53,9 @@ |
458 | #?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE |
459 | #?*GREETER-X-1 START-SESSION |
460 | |
461 | +# Session is unlocked |
462 | +#?LOGIN1 UNLOCK-SESSION |
463 | + |
464 | # Switch to session |
465 | #?VT ACTIVATE VT=7 |
466 | |
467 | |
468 | === modified file 'tests/scripts/switch-to-greeter.conf' |
469 | --- tests/scripts/switch-to-greeter.conf 2013-07-30 16:11:22 +0000 |
470 | +++ tests/scripts/switch-to-greeter.conf 2013-08-08 10:11:25 +0000 |
471 | @@ -33,6 +33,9 @@ |
472 | #?XSERVER-1 INDICATE-READY |
473 | #?XSERVER-1 ACCEPT-CONNECT |
474 | |
475 | +# Session is locked |
476 | +#?LOGIN1 LOCK-SESSION |
477 | + |
478 | # Greeter starts |
479 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
480 | #?XSERVER-1 ACCEPT-CONNECT |
481 | |
482 | === modified file 'tests/scripts/switch-to-guest.conf' |
483 | --- tests/scripts/switch-to-guest.conf 2013-07-30 15:56:44 +0000 |
484 | +++ tests/scripts/switch-to-guest.conf 2013-08-08 10:11:25 +0000 |
485 | @@ -37,6 +37,9 @@ |
486 | #?XSERVER-1 INDICATE-READY |
487 | #?XSERVER-1 ACCEPT-CONNECT |
488 | |
489 | +# Session is locked |
490 | +#?LOGIN1 LOCK-SESSION |
491 | + |
492 | # Switch to session |
493 | #?VT ACTIVATE VT=8 |
494 | |
495 | |
496 | === modified file 'tests/scripts/switch-to-user-logout.conf' |
497 | --- tests/scripts/switch-to-user-logout.conf 2013-07-30 16:11:22 +0000 |
498 | +++ tests/scripts/switch-to-user-logout.conf 2013-08-08 10:11:25 +0000 |
499 | @@ -34,6 +34,9 @@ |
500 | #?XSERVER-1 INDICATE-READY |
501 | #?XSERVER-1 ACCEPT-CONNECT |
502 | |
503 | +# Session is locked |
504 | +#?LOGIN1 LOCK-SESSION |
505 | + |
506 | # Switch to session |
507 | #?VT ACTIVATE VT=8 |
508 | |
509 | |
510 | === modified file 'tests/scripts/switch-to-user-no-password.conf' |
511 | --- tests/scripts/switch-to-user-no-password.conf 2013-07-30 15:56:44 +0000 |
512 | +++ tests/scripts/switch-to-user-no-password.conf 2013-08-08 10:11:25 +0000 |
513 | @@ -34,6 +34,9 @@ |
514 | #?XSERVER-1 INDICATE-READY |
515 | #?XSERVER-1 ACCEPT-CONNECT |
516 | |
517 | +# Session is locked |
518 | +#?LOGIN1 LOCK-SESSION |
519 | + |
520 | # Switch to session |
521 | #?VT ACTIVATE VT=8 |
522 | |
523 | |
524 | === modified file 'tests/scripts/switch-to-user.conf' |
525 | --- tests/scripts/switch-to-user.conf 2013-07-30 16:11:22 +0000 |
526 | +++ tests/scripts/switch-to-user.conf 2013-08-08 10:11:25 +0000 |
527 | @@ -34,6 +34,9 @@ |
528 | #?XSERVER-1 INDICATE-READY |
529 | #?XSERVER-1 ACCEPT-CONNECT |
530 | |
531 | +# Session is locked |
532 | +#?LOGIN1 LOCK-SESSION |
533 | + |
534 | # Greeter starts |
535 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 |
536 | #?XSERVER-1 ACCEPT-CONNECT |
537 | |
538 | === modified file 'tests/scripts/switch-to-users.conf' |
539 | --- tests/scripts/switch-to-users.conf 2013-07-30 15:56:44 +0000 |
540 | +++ tests/scripts/switch-to-users.conf 2013-08-08 10:11:25 +0000 |
541 | @@ -34,6 +34,9 @@ |
542 | #?XSERVER-1 INDICATE-READY |
543 | #?XSERVER-1 ACCEPT-CONNECT |
544 | |
545 | +# Session is locked |
546 | +#?LOGIN1 LOCK-SESSION |
547 | + |
548 | # Switch to session |
549 | #?VT ACTIVATE VT=8 |
550 | |
551 | @@ -57,6 +60,9 @@ |
552 | # Switch to session |
553 | #?VT ACTIVATE VT=9 |
554 | |
555 | +# Session is locked |
556 | +#?LOGIN1 LOCK-SESSION |
557 | + |
558 | # New session starts |
559 | #?SESSION-X-2 START XDG_SEAT=seat0 XDG_VTNR=9 USER=no-password2 |
560 | #?XSERVER-2 ACCEPT-CONNECT |
561 | |
562 | === modified file 'tests/scripts/unity-switch.conf' |
563 | --- tests/scripts/unity-switch.conf 2013-07-30 16:11:22 +0000 |
564 | +++ tests/scripts/unity-switch.conf 2013-08-08 10:11:25 +0000 |
565 | @@ -41,6 +41,9 @@ |
566 | #?XSERVER-1 INDICATE-READY |
567 | #?XSERVER-1 ACCEPT-CONNECT |
568 | |
569 | +# Lock session |
570 | +#?LOGIN1 LOCK-SESSION |
571 | + |
572 | # Greeter starts |
573 | #?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=7 |
574 | #?XSERVER-1 ACCEPT-CONNECT |
575 | |
576 | === modified file 'tests/src/test-runner.c' |
577 | --- tests/src/test-runner.c 2013-07-22 22:21:02 +0000 |
578 | +++ tests/src/test-runner.c 2013-08-08 10:11:25 +0000 |
579 | @@ -85,10 +85,11 @@ |
580 | gchar *cookie; |
581 | gchar *path; |
582 | guint id; |
583 | + gboolean locked; |
584 | } CKSession; |
585 | static GList *ck_sessions = NULL; |
586 | static gint ck_session_index = 0; |
587 | -static void handle_session_call (GDBusConnection *connection, |
588 | +static void handle_ck_session_call (GDBusConnection *connection, |
589 | const gchar *sender, |
590 | const gchar *object_path, |
591 | const gchar *interface_name, |
592 | @@ -98,13 +99,14 @@ |
593 | gpointer user_data); |
594 | static const GDBusInterfaceVTable ck_session_vtable = |
595 | { |
596 | - handle_session_call, |
597 | + handle_ck_session_call, |
598 | }; |
599 | |
600 | typedef struct |
601 | { |
602 | gchar *path; |
603 | guint pid; |
604 | + gboolean locked; |
605 | } Login1Session; |
606 | |
607 | static GList *login1_sessions = NULL; |
608 | @@ -1001,22 +1003,32 @@ |
609 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name); |
610 | } |
611 | |
612 | - |
613 | -/* Shared between CK and Login1 - identical signatures */ |
614 | static void |
615 | -handle_session_call (GDBusConnection *connection, |
616 | - const gchar *sender, |
617 | - const gchar *object_path, |
618 | - const gchar *interface_name, |
619 | - const gchar *method_name, |
620 | - GVariant *parameters, |
621 | - GDBusMethodInvocation *invocation, |
622 | - gpointer user_data) |
623 | +handle_ck_session_call (GDBusConnection *connection, |
624 | + const gchar *sender, |
625 | + const gchar *object_path, |
626 | + const gchar *interface_name, |
627 | + const gchar *method_name, |
628 | + GVariant *parameters, |
629 | + GDBusMethodInvocation *invocation, |
630 | + gpointer user_data) |
631 | { |
632 | + CKSession *session = user_data; |
633 | + |
634 | if (strcmp (method_name, "Lock") == 0) |
635 | + { |
636 | + if (!session->locked) |
637 | + check_status ("CONSOLE-KIT LOCK-SESSION"); |
638 | + session->locked = TRUE; |
639 | g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); |
640 | + } |
641 | else if (strcmp (method_name, "Unlock") == 0) |
642 | + { |
643 | + if (session->locked) |
644 | + check_status ("CONSOLE-KIT UNLOCK-SESSION"); |
645 | + session->locked = FALSE; |
646 | g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); |
647 | + } |
648 | else |
649 | g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name); |
650 | } |
651 | @@ -1118,6 +1130,36 @@ |
652 | NULL); |
653 | } |
654 | |
655 | +static void |
656 | +handle_login1_session_call (GDBusConnection *connection, |
657 | + const gchar *sender, |
658 | + const gchar *object_path, |
659 | + const gchar *interface_name, |
660 | + const gchar *method_name, |
661 | + GVariant *parameters, |
662 | + GDBusMethodInvocation *invocation, |
663 | + gpointer user_data) |
664 | +{ |
665 | + Login1Session *session = user_data; |
666 | + |
667 | + if (strcmp (method_name, "Lock") == 0) |
668 | + { |
669 | + if (!session->locked) |
670 | + check_status ("LOGIN1 LOCK-SESSION"); |
671 | + session->locked = TRUE; |
672 | + g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); |
673 | + } |
674 | + else if (strcmp (method_name, "Unlock") == 0) |
675 | + { |
676 | + if (session->locked) |
677 | + check_status ("LOGIN1 UNLOCK-SESSION"); |
678 | + session->locked = FALSE; |
679 | + g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); |
680 | + } |
681 | + else |
682 | + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name); |
683 | +} |
684 | + |
685 | static Login1Session * |
686 | open_login1_session (GDBusConnection *connection, |
687 | GVariant *params) |
688 | @@ -1135,7 +1177,7 @@ |
689 | "</node>"; |
690 | static const GDBusInterfaceVTable login1_session_vtable = |
691 | { |
692 | - handle_session_call, |
693 | + handle_login1_session_call, |
694 | }; |
695 | |
696 | session = g_malloc0 (sizeof (Login1Session)); |
697 | |
698 | === added file 'tests/test-lock-seat-console-kit' |
699 | --- tests/test-lock-seat-console-kit 1970-01-01 00:00:00 +0000 |
700 | +++ tests/test-lock-seat-console-kit 2013-08-08 10:11:25 +0000 |
701 | @@ -0,0 +1,2 @@ |
702 | +#!/bin/sh |
703 | +./src/dbus-env ./src/test-runner lock-seat-console-kit test-gobject-greeter |
704 | |
705 | === added file 'tests/test-lock-seat-return-session-console-kit' |
706 | --- tests/test-lock-seat-return-session-console-kit 1970-01-01 00:00:00 +0000 |
707 | +++ tests/test-lock-seat-return-session-console-kit 2013-08-08 10:11:25 +0000 |
708 | @@ -0,0 +1,2 @@ |
709 | +#!/bin/sh |
710 | +./src/dbus-env ./src/test-runner lock-seat-return-session-console-kit test-gobject-greeter |
PASSED: Continuous integration, rev:1752 jenkins. qa.ubuntu. com/job/ lightdm- ci/153/ jenkins. qa.ubuntu. com/job/ lightdm- saucy-amd64- ci/69
http://
Executed test runs:
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ lightdm- ci/153/ rebuild
http://