Merge lp:~robert-ancell/lightdm/guest-wrapper into lp:lightdm

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 1832
Merged at revision: 1832
Proposed branch: lp:~robert-ancell/lightdm/guest-wrapper
Merge into: lp:lightdm
Diff against target: 503 lines (+173/-85)
18 files modified
data/apparmor/abstractions/lightdm (+6/-0)
data/lightdm.conf (+2/-2)
debian/50-guest-wrapper.conf (+2/-0)
debian/changelog (+7/-0)
debian/lightdm.install (+1/-0)
src/seat.c (+75/-62)
tests/Makefile.am (+2/-0)
tests/scripts/autologin-guest-in-background.conf (+0/-3)
tests/scripts/autologin-guest-logout.conf (+0/-3)
tests/scripts/autologin-guest-timeout.conf (+0/-3)
tests/scripts/autologin-guest.conf (+0/-3)
tests/scripts/guest-wrapper.conf (+37/-0)
tests/scripts/login-guest-logout.conf (+0/-3)
tests/scripts/login-guest.conf (+0/-3)
tests/scripts/switch-to-guest.conf (+0/-3)
tests/src/Makefile.am (+10/-0)
tests/src/test-guest-wrapper.c (+29/-0)
tests/test-guest-wrapper (+2/-0)
To merge this branch: bzr merge lp:~robert-ancell/lightdm/guest-wrapper
Reviewer Review Type Date Requested Status
Robert Ancell Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+193315@code.launchpad.net

Commit message

Implement missing guest-wrapper functionality and enable it for Ubuntu. Update AppArmor scripts to work.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Remote sessions need to be tested with this before it can land. Guest sessions work fine.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
1832. By Robert Ancell

Merge with trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Approving for trunk without remote session testing being completed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/apparmor/abstractions/lightdm'
2--- data/apparmor/abstractions/lightdm 2013-06-13 00:14:02 +0000
3+++ data/apparmor/abstractions/lightdm 2013-10-30 20:19:38 +0000
4@@ -8,6 +8,10 @@
5 # etc). Note that this profile intentionally omits chromium-browser.
6
7 #include <abstractions/authentication>
8+ #include <abstractions/cups-client>
9+ #include <abstractions/dbus>
10+ #include <abstractions/dbus-session>
11+ #include <abstractions/dbus-accessibility>
12 #include <abstractions/nameservice>
13 #include <abstractions/wutmp>
14 /etc/compizconfig/config rw, # bug in compiz https://launchpad.net/bugs/697678
15@@ -47,6 +51,8 @@
16 /sbin/** rmixk,
17 /sys/ r,
18 /sys/** rm,
19+ # needed for confined trusted helpers, such as dbus-daemon
20+ /sys/kernel/security/apparmor/.access rw,
21 /tmp/ rw,
22 owner /tmp/** rwlkmix,
23 /usr/ r,
24
25=== modified file 'data/lightdm.conf'
26--- data/lightdm.conf 2013-10-29 08:26:48 +0000
27+++ data/lightdm.conf 2013-10-30 20:19:38 +0000
28@@ -14,7 +14,6 @@
29 # sessions-directory = Directory to find sessions
30 # remote-sessions-directory = Directory to find remote sessions
31 # greeters-directory = Directory to find greeters
32-# disable-guest-wrapper = Disable using guest session wrapper (temporary? required to make tests work without installing)
33 #
34 [LightDM]
35 #start-default-seat=true
36@@ -30,7 +29,6 @@
37 #sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions
38 #remote-sessions-directory=/usr/share/lightdm/remote-sessions
39 #greeters-directory=/usr/share/lightdm/greeters:/usr/share/xgreeters
40-#disable-guest-wrapper=false
41
42 #
43 # Seat defaults
44@@ -59,6 +57,7 @@
45 # guest-session = Session to load for guests (overrides user-session)
46 # session-wrapper = Wrapper script to run session with
47 # greeter-wrapper = Wrapper script to run greeter with
48+# guest-wrapper = Wrapper script to run guest sessions with
49 # display-setup-script = Script to run when starting a greeter session (runs as root)
50 # display-stopped-script = Script to run after stopping the display server (runs as root)
51 # greeter-setup-script = Script to run when starting a greeter (runs as root)
52@@ -96,6 +95,7 @@
53 #guest-session=UNIMPLEMENTED
54 #session-wrapper=lightdm-session
55 #greeter-wrapper=
56+#guest-wrapper=
57 #display-setup-script=
58 #display-stopped-script=
59 #greeter-setup-script=
60
61=== added file 'debian/50-guest-wrapper.conf'
62--- debian/50-guest-wrapper.conf 1970-01-01 00:00:00 +0000
63+++ debian/50-guest-wrapper.conf 2013-10-30 20:19:38 +0000
64@@ -0,0 +1,2 @@
65+[SeatDefaults]
66+guest-wrapper=/usr/lib/lightdm/lightdm/lightdm-guest-session-wrapper
67
68=== modified file 'debian/changelog'
69--- debian/changelog 2013-10-21 23:20:25 +0000
70+++ debian/changelog 2013-10-30 20:19:38 +0000
71@@ -1,3 +1,10 @@
72+lightdm (1.9.0-0ubuntu2) UNRELEASED; urgency=low
73+
74+ * debian/50-guest-wrapper.conf:
75+ - Configure guest session wrapper to use
76+
77+ -- Robert Ancell <robert.ancell@canonical.com> Sun, 27 Oct 2013 17:34:20 +1300
78+
79 lightdm (1.9.0-0ubuntu1) trusty; urgency=low
80
81 * New upstream release:
82
83=== modified file 'debian/lightdm.install'
84--- debian/lightdm.install 2013-07-16 23:36:16 +0000
85+++ debian/lightdm.install 2013-10-30 20:19:38 +0000
86@@ -14,3 +14,4 @@
87 debian/source_lightdm.py usr/share/apport/package-hooks
88 debian/50-xserver-command.conf etc/lightdm/lightdm.conf.d
89 debian/50-greeter-wrapper.conf etc/lightdm/lightdm.conf.d
90+debian/50-guest-wrapper.conf etc/lightdm/lightdm.conf.d
91
92=== modified file 'src/seat.c'
93--- src/seat.c 2013-10-30 18:56:48 +0000
94+++ src/seat.c 2013-10-30 20:19:38 +0000
95@@ -880,10 +880,27 @@
96 return session;
97 }
98
99+static void
100+prepend_argv (gchar ***argv, const gchar *value)
101+{
102+ gchar **old_argv, **new_argv;
103+ gint i;
104+
105+ old_argv = *argv;
106+ new_argv = g_malloc (sizeof (gchar *) * (g_strv_length (*argv) + 2));
107+ new_argv[0] = g_strdup (value);
108+ for (i = 0; old_argv[i]; i++)
109+ new_argv[i + 1] = old_argv[i];
110+ new_argv[i + 1] = NULL;
111+
112+ g_free (*argv);
113+ *argv = new_argv;
114+}
115+
116 static Session *
117 create_guest_session (Seat *seat)
118 {
119- const gchar *session_name;
120+ const gchar *session_name, *guest_wrapper;
121 gchar *sessions_dir, **argv;
122 SessionConfig *session_config;
123 Session *session;
124@@ -903,6 +920,15 @@
125 session_set_do_authenticate (session, TRUE);
126 session_set_is_guest (session, TRUE);
127 argv = get_session_argv (seat, session_config, seat_get_string_property (seat, "session-wrapper"));
128+ guest_wrapper = seat_get_string_property (seat, "guest-wrapper");
129+ if (guest_wrapper)
130+ {
131+ gchar *path;
132+ path = g_find_program_in_path (guest_wrapper);
133+ prepend_argv (&argv, path ? path : guest_wrapper);
134+ g_free (path);
135+ }
136+
137 session_set_argv (session, argv);
138 g_strfreev (argv);
139 g_object_unref (session_config);
140@@ -922,32 +948,11 @@
141 return g_object_ref (session);
142 }
143
144-static void
145-prepend_argv (gchar ***argv, const gchar *value)
146-{
147- gchar **old_argv, **new_argv;
148- gint i;
149-
150- old_argv = *argv;
151- new_argv = g_malloc (sizeof (gchar *) * (g_strv_length (*argv) + 2));
152- new_argv[0] = g_strdup (value);
153- for (i = 0; old_argv[i]; i++)
154- new_argv[i + 1] = old_argv[i];
155- new_argv[i + 1] = NULL;
156-
157- g_free (*argv);
158- *argv = new_argv;
159-}
160-
161 static gboolean
162 greeter_start_session_cb (Greeter *greeter, SessionType type, const gchar *session_name, Seat *seat)
163 {
164 Session *session, *existing_session;
165- const gchar *username, *language = NULL;
166- SessionConfig *session_config;
167- User *user;
168- gchar *sessions_dir = NULL;
169- gchar **argv;
170+ const gchar *username;
171 DisplayServer *display_server;
172
173 /* Get the session to use */
174@@ -959,7 +964,54 @@
175 session_set_pam_service (session, AUTOLOGIN_SERVICE);
176 }
177 else
178+ {
179+ const gchar *language = NULL;
180+ SessionConfig *session_config;
181+ User *user;
182+ gchar *sessions_dir = NULL;
183+ gchar **argv;
184+
185 session = greeter_get_authentication_session (greeter);
186+
187+ /* Get session command to run */
188+ switch (type)
189+ {
190+ case SESSION_TYPE_LOCAL:
191+ sessions_dir = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
192+ break;
193+ case SESSION_TYPE_REMOTE:
194+ sessions_dir = config_get_string (config_get_instance (), "LightDM", "remote-sessions-directory");
195+ break;
196+ }
197+
198+ /* Load user preferences */
199+ user = session_get_user (session);
200+ if (user)
201+ {
202+ if (!session_name)
203+ session_name = user_get_xsession (user);
204+ language = user_get_language (user);
205+ }
206+
207+ if (!session_name)
208+ session_name = seat_get_string_property (seat, "user-session");
209+ if (user)
210+ user_set_xsession (session_get_user (session), session_name);
211+
212+ session_config = find_session_config (seat, sessions_dir, session_name);
213+ g_free (sessions_dir);
214+ if (!session_config)
215+ {
216+ l_debug (seat, "Can't find session '%s'", seat_get_string_property (seat, "user-session"));
217+ return FALSE;
218+ }
219+
220+ configure_session (session, session_config, session_name, language);
221+ argv = get_session_argv (seat, session_config, seat_get_string_property (seat, "session-wrapper"));
222+ session_set_argv (session, argv);
223+ g_strfreev (argv);
224+ g_object_unref (session_config);
225+ }
226
227 /* Switch to this session when it is ready */
228 if (seat->priv->session_to_activate)
229@@ -978,45 +1030,6 @@
230 return TRUE;
231 }
232
233- /* Get session command to run */
234- switch (type)
235- {
236- case SESSION_TYPE_LOCAL:
237- sessions_dir = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
238- break;
239- case SESSION_TYPE_REMOTE:
240- sessions_dir = config_get_string (config_get_instance (), "LightDM", "remote-sessions-directory");
241- break;
242- }
243-
244- /* Load user preferences */
245- user = session_get_user (session);
246- if (user)
247- {
248- if (!session_name)
249- session_name = user_get_xsession (user);
250- language = user_get_language (user);
251- }
252-
253- if (!session_name)
254- session_name = seat_get_string_property (seat, "user-session");
255- if (user)
256- user_set_xsession (session_get_user (session), session_name);
257-
258- session_config = find_session_config (seat, sessions_dir, session_name);
259- g_free (sessions_dir);
260- if (!session_config)
261- {
262- l_debug (seat, "Can't find session '%s'", seat_get_string_property (seat, "user-session"));
263- return FALSE;
264- }
265-
266- configure_session (session, session_config, session_name, language);
267- argv = get_session_argv (seat, session_config, seat_get_string_property (seat, "session-wrapper"));
268- session_set_argv (session, argv);
269- g_strfreev (argv);
270- g_object_unref (session_config);
271-
272 /* If can re-use the display server, stop the greeter first */
273 display_server = session_get_display_server (SESSION (greeter));
274 if (can_share_display_server (seat, display_server) &&
275
276=== modified file 'tests/Makefile.am'
277--- tests/Makefile.am 2013-10-30 18:37:21 +0000
278+++ tests/Makefile.am 2013-10-30 20:19:38 +0000
279@@ -46,6 +46,7 @@
280 test-autologin-guest \
281 test-autologin-guest-fail-setup-script \
282 test-autologin-guest-logout \
283+ test-guest-wrapper \
284 test-group-membership \
285 test-xdg-current-desktop \
286 test-xdg-seat \
287@@ -339,6 +340,7 @@
288 scripts/greeter-wrapper.conf \
289 scripts/greeter-xserver-crash.conf \
290 scripts/group-membership.conf \
291+ scripts/guest-wrapper.conf \
292 scripts/headless.conf \
293 scripts/home-dir-on-authenticate.conf \
294 scripts/home-dir-on-session.conf \
295
296=== modified file 'tests/scripts/autologin-guest-in-background.conf'
297--- tests/scripts/autologin-guest-in-background.conf 2013-10-21 22:43:11 +0000
298+++ tests/scripts/autologin-guest-in-background.conf 2013-10-30 20:19:38 +0000
299@@ -2,9 +2,6 @@
300 # Check automatically logs in guest while keeping a greeter up
301 #
302
303-[LightDM]
304-disable-guest-wrapper=true
305-
306 [SeatDefaults]
307 autologin-guest=true
308 autologin-in-background=true
309
310=== modified file 'tests/scripts/autologin-guest-logout.conf'
311--- tests/scripts/autologin-guest-logout.conf 2013-10-21 22:43:11 +0000
312+++ tests/scripts/autologin-guest-logout.conf 2013-10-30 20:19:38 +0000
313@@ -2,9 +2,6 @@
314 # Check automatically logs in default user
315 #
316
317-[LightDM]
318-disable-guest-wrapper=true
319-
320 [SeatDefaults]
321 autologin-guest=true
322 user-session=default
323
324=== modified file 'tests/scripts/autologin-guest-timeout.conf'
325--- tests/scripts/autologin-guest-timeout.conf 2013-10-21 22:43:11 +0000
326+++ tests/scripts/autologin-guest-timeout.conf 2013-10-30 20:19:38 +0000
327@@ -2,9 +2,6 @@
328 # Check automatically logs in default user
329 #
330
331-[LightDM]
332-disable-guest-wrapper=true
333-
334 [SeatDefaults]
335 autologin-guest=true
336 autologin-user-timeout=1
337
338=== modified file 'tests/scripts/autologin-guest.conf'
339--- tests/scripts/autologin-guest.conf 2013-10-03 21:28:05 +0000
340+++ tests/scripts/autologin-guest.conf 2013-10-30 20:19:38 +0000
341@@ -2,9 +2,6 @@
342 # Check automatically logs in default user
343 #
344
345-[LightDM]
346-disable-guest-wrapper=true
347-
348 [SeatDefaults]
349 autologin-guest=true
350 user-session=default
351
352=== added file 'tests/scripts/guest-wrapper.conf'
353--- tests/scripts/guest-wrapper.conf 1970-01-01 00:00:00 +0000
354+++ tests/scripts/guest-wrapper.conf 2013-10-30 20:19:38 +0000
355@@ -0,0 +1,37 @@
356+#
357+# Check guest wrapper works
358+#
359+
360+[SeatDefaults]
361+autologin-guest=true
362+user-session=default
363+guest-wrapper=test-guest-wrapper
364+
365+#?RUNNER DAEMON-START
366+
367+# X server starts
368+#?XSERVER-0 START VT=7
369+
370+# Daemon connects when X server is ready
371+#?*XSERVER-0 INDICATE-READY
372+#?XSERVER-0 INDICATE-READY
373+#?XSERVER-0 ACCEPT-CONNECT
374+
375+# Guest account created
376+#?GUEST-ACCOUNT ADD USERNAME=guest-.*
377+
378+# Greeter wrapper starts
379+#?GUEST-WRAPPER-X-0 START
380+
381+# Guest session starts
382+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 DESKTOP_SESSION=default USER=guest-.*
383+#?XSERVER-0 ACCEPT-CONNECT
384+#?SESSION-X-0 CONNECT-XSERVER
385+
386+# Cleanup
387+#?*STOP-DAEMON
388+#?SESSION-X-0 TERMINATE SIGNAL=15
389+#?XSERVER-0 TERMINATE SIGNAL=15
390+#?GUEST-ACCOUNT REMOVE USERNAME=guest.*
391+#?RUNNER DAEMON-EXIT STATUS=0
392+
393
394=== modified file 'tests/scripts/login-guest-logout.conf'
395--- tests/scripts/login-guest-logout.conf 2013-10-21 22:43:11 +0000
396+++ tests/scripts/login-guest-logout.conf 2013-10-30 20:19:38 +0000
397@@ -2,9 +2,6 @@
398 # Check automatically logs in default user
399 #
400
401-[LightDM]
402-disable-guest-wrapper=true
403-
404 [SeatDefaults]
405 user-session=default
406
407
408=== modified file 'tests/scripts/login-guest.conf'
409--- tests/scripts/login-guest.conf 2013-10-21 22:43:11 +0000
410+++ tests/scripts/login-guest.conf 2013-10-30 20:19:38 +0000
411@@ -2,9 +2,6 @@
412 # Check can login as guest (not prompted for password)
413 #
414
415-[LightDM]
416-disable-guest-wrapper=true
417-
418 [SeatDefaults]
419 user-session=default
420
421
422=== modified file 'tests/scripts/switch-to-guest.conf'
423--- tests/scripts/switch-to-guest.conf 2013-10-03 21:28:05 +0000
424+++ tests/scripts/switch-to-guest.conf 2013-10-30 20:19:38 +0000
425@@ -2,9 +2,6 @@
426 # Check D-Bus interface can trigger/switch to guest session
427 #
428
429-[LightDM]
430-disable-guest-wrapper=true
431-
432 [SeatDefaults]
433 autologin-user=have-password1
434 user-session=default
435
436=== modified file 'tests/src/Makefile.am'
437--- tests/src/Makefile.am 2013-07-30 14:04:44 +0000
438+++ tests/src/Makefile.am 2013-10-30 20:19:38 +0000
439@@ -3,6 +3,7 @@
440 plymouth \
441 test-gobject-greeter \
442 test-greeter-wrapper \
443+ test-guest-wrapper \
444 test-mir-greeter \
445 test-runner \
446 test-script-hook \
447@@ -96,6 +97,15 @@
448 $(GLIB_LIBS) \
449 $(GIO_UNIX_LIBS)
450
451+test_guest_wrapper_SOURCES = test-guest-wrapper.c status.c status.h
452+test_guest_wrapper_CFLAGS = \
453+ $(WARN_CFLAGS) \
454+ $(GLIB_CFLAGS) \
455+ $(GIO_UNIX_CFLAGS)
456+test_guest_wrapper_LDADD = \
457+ $(GLIB_LIBS) \
458+ $(GIO_UNIX_LIBS)
459+
460 test_gobject_greeter_SOURCES = test-gobject-greeter.c status.c status.h
461 test_gobject_greeter_CFLAGS = \
462 -I$(top_srcdir)/liblightdm-gobject \
463
464=== added file 'tests/src/test-guest-wrapper.c'
465--- tests/src/test-guest-wrapper.c 1970-01-01 00:00:00 +0000
466+++ tests/src/test-guest-wrapper.c 2013-10-30 20:19:38 +0000
467@@ -0,0 +1,29 @@
468+#include <stdlib.h>
469+#include <unistd.h>
470+
471+#include "status.h"
472+
473+static void
474+request_cb (const gchar *request)
475+{
476+}
477+
478+int
479+main (int argc, char **argv)
480+{
481+ gchar *display;
482+
483+ status_connect (request_cb);
484+
485+ display = getenv ("DISPLAY");
486+ if (display == NULL)
487+ status_notify ("GUEST-WRAPPER-? START");
488+ else if (display[0] == ':')
489+ status_notify ("GUEST-WRAPPER-X-%s START", display + 1);
490+ else
491+ status_notify ("GUEST-WRAPPER-X-%s START", display);
492+
493+ execv (argv[1], argv + 1);
494+
495+ return EXIT_FAILURE;
496+}
497
498=== added file 'tests/test-guest-wrapper'
499--- tests/test-guest-wrapper 1970-01-01 00:00:00 +0000
500+++ tests/test-guest-wrapper 2013-10-30 20:19:38 +0000
501@@ -0,0 +1,2 @@
502+#!/bin/sh
503+./src/dbus-env ./src/test-runner guest-wrapper test-gobject-greeter

Subscribers

People subscribed via source and target branches