summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hochstein <tom.hochstein@nxp.com>2016-05-18 13:40:41 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-21 22:24:55 +0100
commit959237ef882d0abc03a8ad4449c4ce8efe4b18e5 (patch)
treef274babe2615e89bf8084f2b1127178f09e9e5cd
parent9a9f04ff9b5d8ed63fe424c3dff9854fee78b14d (diff)
downloadpoky-959237ef882d0abc03a8ad4449c4ce8efe4b18e5.tar.gz
weston: Provide a default version of weston-launch that doesn't require PAM
weston-launch requires PAM for starting weston as a non-root user. Since starting weston as root is a valid use case by itself, we check the distro for 'pam' and build weston-launch with or without non-root-user support. (From OE-Core rev: 6295197adc022445fff01ca5ee75780a4c007d99) Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch171
-rw-r--r--meta/recipes-graphics/wayland/weston_1.10.0.bb9
2 files changed, 177 insertions, 3 deletions
diff --git a/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch b/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch
new file mode 100644
index 0000000000..9a401ee4b6
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch
@@ -0,0 +1,171 @@
1From 228349e796e9baa86f2ba8232c730c18ac41283d Mon Sep 17 00:00:00 2001
2From: Tom Hochstein <tom.hochstein@nxp.com>
3Date: Fri, 13 May 2016 09:31:55 -0500
4Subject: [PATCH weston] weston-launch: Provide a default version that doesn't
5 require PAM
6
7weston-launch requires PAM for starting weston as a non-root user.
8
9Since starting weston as root is a valid use case by itself, if
10PAM is not available, provide a default version of weston-launch
11without non-root-user support.
12
13Upstream-Status: Pending
14
15Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
16---
17 Makefile.am | 3 ---
18 configure.ac | 12 +++++++-----
19 src/weston-launch.c | 20 ++++++++++++++++++++
20 3 files changed, 27 insertions(+), 8 deletions(-)
21
22Index: weston-1.10.0/configure.ac
23===================================================================
24--- weston-1.10.0.orig/configure.ac 2016-05-13 11:02:05.711817559 -0500
25+++ weston-1.10.0/configure.ac 2016-05-13 13:30:28.000000000 -0500
26@@ -445,13 +445,17 @@
27 AS_IF([test "x$have_systemd_login_209" = "xyes"],
28 [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 209])])
29
30+AC_ARG_WITH(pam,
31+ AS_HELP_STRING([--with-pam], [Use PAM]),
32+ [use_pam=$withval], [use_pam=yes])
33 AC_ARG_ENABLE(weston-launch, [ --enable-weston-launch],, enable_weston_launch=yes)
34 AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
35-if test x$enable_weston_launch == xyes; then
36+if test x$enable_weston_launch = xyes -a x$use_pam = xyes; then
37 AC_CHECK_LIB([pam], [pam_open_session], [have_pam=yes], [have_pam=no])
38 if test x$have_pam == xno; then
39- AC_ERROR([weston-launch requires pam])
40+ AC_ERROR([PAM support is explicitly requested, but libpam couldn't be found])
41 fi
42+ AC_DEFINE([HAVE_PAM], [1], [Define if PAM is available])
43 PAM_LIBS=-lpam
44 AC_SUBST(PAM_LIBS)
45 fi
46@@ -667,6 +671,7 @@
47 Enable developer documentation ${enable_devdocs}
48
49 weston-launch utility ${enable_weston_launch}
50+ PAM support ${use_pam}
51 systemd-login support ${have_systemd_login}
52 systemd notify support ${enable_systemd_notify}
53
54Index: weston-1.10.0/src/weston-launch.c
55===================================================================
56--- weston-1.10.0.orig/src/weston-launch.c 2016-05-13 11:02:05.779817896 -0500
57+++ weston-1.10.0/src/weston-launch.c 2016-05-13 11:02:05.851818253 -0500
58@@ -51,7 +51,9 @@
59
60 #include <pwd.h>
61 #include <grp.h>
62+#ifdef HAVE_PAM
63 #include <security/pam_appl.h>
64+#endif
65
66 #ifdef HAVE_SYSTEMD_LOGIN
67 #include <systemd/sd-login.h>
68@@ -93,8 +95,10 @@
69 #endif
70
71 struct weston_launch {
72+#ifdef HAVE_PAM
73 struct pam_conv pc;
74 pam_handle_t *ph;
75+#endif
76 int tty;
77 int ttynr;
78 int sock[2];
79@@ -181,6 +185,7 @@
80 return false;
81 }
82
83+#ifdef HAVE_PAM
84 static int
85 pam_conversation_fn(int msg_count,
86 const struct pam_message **messages,
87@@ -221,6 +226,7 @@
88
89 return 0;
90 }
91+#endif
92
93 static int
94 setup_launcher_socket(struct weston_launch *wl)
95@@ -414,6 +420,7 @@
96 close(wl->signalfd);
97 close(wl->sock[0]);
98
99+#ifdef HAVE_PAM
100 if (wl->new_user) {
101 err = pam_close_session(wl->ph, 0);
102 if (err)
103@@ -421,6 +428,7 @@
104 err, pam_strerror(wl->ph, err));
105 pam_end(wl->ph, err);
106 }
107+#endif
108
109 if (ioctl(wl->tty, KDSKBMUTE, 0) &&
110 ioctl(wl->tty, KDSKBMODE, wl->kb_mode))
111@@ -600,6 +608,7 @@
112 setenv("HOME", wl->pw->pw_dir, 1);
113 setenv("SHELL", wl->pw->pw_shell, 1);
114
115+#ifdef HAVE_PAM
116 env = pam_getenvlist(wl->ph);
117 if (env) {
118 for (i = 0; env[i]; ++i) {
119@@ -608,6 +617,7 @@
120 }
121 free(env);
122 }
123+#endif
124 }
125
126 static void
127@@ -665,7 +675,9 @@
128 help(const char *name)
129 {
130 fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name);
131+#ifdef HAVE_PAM
132 fprintf(stderr, " -u, --user Start session as specified username\n");
133+#endif
134 fprintf(stderr, " -t, --tty Start session on alternative tty\n");
135 fprintf(stderr, " -v, --verbose Be verbose\n");
136 fprintf(stderr, " -h, --help Display this help message\n");
137@@ -678,7 +690,9 @@
138 int i, c;
139 char *tty = NULL;
140 struct option opts[] = {
141+#ifdef HAVE_PAM
142 { "user", required_argument, NULL, 'u' },
143+#endif
144 { "tty", required_argument, NULL, 't' },
145 { "verbose", no_argument, NULL, 'v' },
146 { "help", no_argument, NULL, 'h' },
147@@ -690,9 +704,13 @@
148 while ((c = getopt_long(argc, argv, "u:t::vh", opts, &i)) != -1) {
149 switch (c) {
150 case 'u':
151+#ifdef HAVE_PAM
152 wl.new_user = optarg;
153 if (getuid() != 0)
154 error(1, 0, "Permission denied. -u allowed for root only");
155+#else
156+ error(1, 0, "-u is unsupported in this weston-launch build");
157+#endif
158 break;
159 case 't':
160 tty = optarg;
161@@ -730,8 +748,10 @@
162 if (setup_tty(&wl, tty) < 0)
163 exit(EXIT_FAILURE);
164
165+#ifdef HAVE_PAM
166 if (wl.new_user && setup_pam(&wl) < 0)
167 exit(EXIT_FAILURE);
168+#endif
169
170 if (setup_launcher_socket(&wl) < 0)
171 exit(EXIT_FAILURE);
diff --git a/meta/recipes-graphics/wayland/weston_1.10.0.bb b/meta/recipes-graphics/wayland/weston_1.10.0.bb
index 29da5541b4..c9168d7ab8 100644
--- a/meta/recipes-graphics/wayland/weston_1.10.0.bb
+++ b/meta/recipes-graphics/wayland/weston_1.10.0.bb
@@ -12,6 +12,7 @@ SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
12 file://0001-make-error-portable.patch \ 12 file://0001-make-error-portable.patch \
13 file://0001-configure.ac-Fix-wayland-protocols-path.patch \ 13 file://0001-configure.ac-Fix-wayland-protocols-path.patch \
14 file://make-weston-launch-exit-for-unrecognized-option.patch \ 14 file://make-weston-launch-exit-for-unrecognized-option.patch \
15 file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \
15" 16"
16SRC_URI[md5sum] = "1cd17c54ecac6d9a3cd90bf12eaa3e20" 17SRC_URI[md5sum] = "1cd17c54ecac6d9a3cd90bf12eaa3e20"
17SRC_URI[sha256sum] = "e0b2004d00d8293ddf7903ca283c1746afa9ccb5919ab50fd04397ff472aa5c1" 18SRC_URI[sha256sum] = "e0b2004d00d8293ddf7903ca283c1746afa9ccb5919ab50fd04397ff472aa5c1"
@@ -39,9 +40,9 @@ EXTRA_OECONF_append_qemux86-64 = "\
39PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms fbdev wayland egl', '', d)} \ 40PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms fbdev wayland egl', '', d)} \
40 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \ 41 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
41 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \ 42 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \
42 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'launch', '', d)} \ 43 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
43 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \ 44 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
44 clients" 45 clients launch"
45# 46#
46# Compositor choices 47# Compositor choices
47# 48#
@@ -56,7 +57,7 @@ PACKAGECONFIG[headless] = "--enable-headless-compositor,--disable-headless-compo
56# Weston on framebuffer 57# Weston on framebuffer
57PACKAGECONFIG[fbdev] = "--enable-fbdev-compositor,--disable-fbdev-compositor,udev mtdev" 58PACKAGECONFIG[fbdev] = "--enable-fbdev-compositor,--disable-fbdev-compositor,udev mtdev"
58# weston-launch 59# weston-launch
59PACKAGECONFIG[launch] = "--enable-weston-launch,--disable-weston-launch,libpam drm" 60PACKAGECONFIG[launch] = "--enable-weston-launch,--disable-weston-launch,drm"
60# VA-API desktop recorder 61# VA-API desktop recorder
61PACKAGECONFIG[vaapi] = "--enable-vaapi-recorder,--disable-vaapi-recorder,libva" 62PACKAGECONFIG[vaapi] = "--enable-vaapi-recorder,--disable-vaapi-recorder,libva"
62# Weston with EGL support 63# Weston with EGL support
@@ -77,6 +78,8 @@ PACKAGECONFIG[xwayland] = "--enable-xwayland,--disable-xwayland"
77PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord" 78PACKAGECONFIG[colord] = "--enable-colord,--disable-colord,colord"
78# Clients support 79# Clients support
79PACKAGECONFIG[clients] = "--enable-clients --enable-simple-clients --enable-demo-clients-install,--disable-clients --disable-simple-clients" 80PACKAGECONFIG[clients] = "--enable-clients --enable-simple-clients --enable-demo-clients-install,--disable-clients --disable-simple-clients"
81# Weston with PAM support
82PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"
80 83
81do_install_append() { 84do_install_append() {
82 # Weston doesn't need the .la files to load modules, so wipe them 85 # Weston doesn't need the .la files to load modules, so wipe them