diff options
Diffstat (limited to 'external/poky/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch')
-rw-r--r-- | external/poky/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch | 129 |
1 files changed, 77 insertions, 52 deletions
diff --git a/external/poky/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch b/external/poky/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch index d648538b..62b864c1 100644 --- a/external/poky/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch +++ b/external/poky/meta/recipes-graphics/wayland/weston/0001-weston-launch-Provide-a-default-version-that-doesn-t.patch @@ -1,7 +1,8 @@ -From b98b9dbda902225cdd972b5bff6a641c36cc7e90 Mon Sep 17 00:00:00 2001 +From 5f2d71998eb77068cbaee2d468cbb296a42d5739 Mon Sep 17 00:00:00 2001 From: Tom Hochstein <tom.hochstein@nxp.com> Date: Wed, 22 Feb 2017 15:53:30 +0200 -Subject: [PATCH] weston-launch: Provide a default version that doesn't require PAM +Subject: [PATCH] weston-launch: Provide a default version that doesn't require + PAM weston-launch requires PAM for starting weston as a non-root user. @@ -14,46 +15,49 @@ Upstream-Status: Pending Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> Signed-off-by: Denys Dmytriyenko <denys@ti.com> +Signed-off-by: Ming Liu <ming.liu@toradex.com> --- - configure.ac | 9 +++++++-- - libweston/weston-launch.c | 20 ++++++++++++++++++++ - 2 files changed, 27 insertions(+), 2 deletions(-) + libweston/meson.build | 16 ++++++++++++---- + libweston/weston-launch.c | 21 +++++++++++++++++++++ + meson_options.txt | 7 +++++++ + 3 files changed, 40 insertions(+), 4 deletions(-) -diff --git a/configure.ac b/configure.ac -index dc9c802..48cf5cb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -451,13 +451,17 @@ AC_ARG_ENABLE(resize-optimization, - AS_IF([test "x$enable_resize_optimization" = "xyes"], - [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])]) - -+AC_ARG_WITH(pam, -+ AS_HELP_STRING([--with-pam], [Use PAM]), -+ [use_pam=$withval], [use_pam=yes]) - AC_ARG_ENABLE(weston-launch, [ --enable-weston-launch],, enable_weston_launch=yes) - AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes) --if test x$enable_weston_launch = xyes; then -+if test x$enable_weston_launch = xyes -a x$use_pam = xyes; then - WESTON_SEARCH_LIBS([PAM], [pam], [pam_open_session], [have_pam=yes], [have_pam=no]) - if test x$have_pam = xno; then -- AC_ERROR([weston-launch requires pam]) -+ AC_ERROR([PAM support is explicitly requested, but libpam couldn't be found]) - fi -+ AC_DEFINE([HAVE_PAM], [1], [Define if PAM is available]) - fi - - AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes") -@@ -702,6 +706,7 @@ AC_MSG_RESULT([ - Enable developer documentation ${enable_devdocs} - - weston-launch utility ${enable_weston_launch} -+ PAM support ${use_pam} - systemd-login support ${have_systemd_login} - systemd notify support ${enable_systemd_notify} - +diff --git a/libweston/meson.build b/libweston/meson.build +index 08d23ec..cb9fd3f 100644 +--- a/libweston/meson.build ++++ b/libweston/meson.build +@@ -216,16 +216,24 @@ dep_vertex_clipping = declare_dependency( + ) + + if get_option('weston-launch') +- dep_pam = cc.find_library('pam') ++ deps_weston_launch = [systemd_dep, dep_libdrm] + +- if not cc.has_function('pam_open_session', dependencies: dep_pam) +- error('pam_open_session not found for weston-launch') ++ if get_option('pam') ++ dep_pam = cc.find_library('pam') ++ if not cc.has_function('pam_open_session', dependencies: dep_pam) ++ error('pam_open_session not found for weston-launch') ++ endif ++ ++ if dep_pam.found() ++ deps_weston_launch += dep_pam ++ config_h.set('HAVE_PAM', '1') ++ endif + endif + + executable( + 'weston-launch', + 'weston-launch.c', +- dependencies: [dep_pam, systemd_dep, dep_libdrm], ++ dependencies: deps_weston_launch, + include_directories: common_inc, + install: true + ) diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c -index 166bf3b..6fb9232 100644 +index 8a711b4..54c567a 100644 --- a/libweston/weston-launch.c +++ b/libweston/weston-launch.c @@ -51,7 +51,9 @@ @@ -66,7 +70,7 @@ index 166bf3b..6fb9232 100644 #ifdef HAVE_SYSTEMD_LOGIN #include <systemd/sd-login.h> -@@ -101,8 +103,10 @@ drmSetMaster(int drm_fd) +@@ -100,8 +102,10 @@ drmSetMaster(int drm_fd) #endif struct weston_launch { @@ -77,7 +81,7 @@ index 166bf3b..6fb9232 100644 int tty; int ttynr; int sock[2]; -@@ -189,6 +193,7 @@ weston_launch_allowed(struct weston_launch *wl) +@@ -192,6 +196,7 @@ weston_launch_allowed(struct weston_launch *wl) return false; } @@ -85,7 +89,7 @@ index 166bf3b..6fb9232 100644 static int pam_conversation_fn(int msg_count, const struct pam_message **messages, -@@ -229,6 +234,7 @@ setup_pam(struct weston_launch *wl) +@@ -232,6 +237,7 @@ setup_pam(struct weston_launch *wl) return 0; } @@ -93,7 +97,7 @@ index 166bf3b..6fb9232 100644 static int setup_launcher_socket(struct weston_launch *wl) -@@ -422,6 +428,7 @@ quit(struct weston_launch *wl, int status) +@@ -431,6 +437,7 @@ quit(struct weston_launch *wl, int status) close(wl->signalfd); close(wl->sock[0]); @@ -101,7 +105,7 @@ index 166bf3b..6fb9232 100644 if (wl->new_user) { err = pam_close_session(wl->ph, 0); if (err) -@@ -429,6 +436,7 @@ quit(struct weston_launch *wl, int status) +@@ -438,6 +445,7 @@ quit(struct weston_launch *wl, int status) err, pam_strerror(wl->ph, err)); pam_end(wl->ph, err); } @@ -109,7 +113,7 @@ index 166bf3b..6fb9232 100644 if (ioctl(wl->tty, KDSKBMUTE, 0) && ioctl(wl->tty, KDSKBMODE, wl->kb_mode)) -@@ -608,6 +616,7 @@ setup_session(struct weston_launch *wl, char **child_argv) +@@ -666,6 +674,7 @@ setup_session(struct weston_launch *wl, char **child_argv) setenv("HOME", wl->pw->pw_dir, 1); setenv("SHELL", wl->pw->pw_shell, 1); @@ -117,7 +121,7 @@ index 166bf3b..6fb9232 100644 env = pam_getenvlist(wl->ph); if (env) { for (i = 0; env[i]; ++i) { -@@ -616,6 +625,7 @@ setup_session(struct weston_launch *wl, char **child_argv) +@@ -674,6 +683,7 @@ setup_session(struct weston_launch *wl, char **child_argv) } free(env); } @@ -125,7 +129,7 @@ index 166bf3b..6fb9232 100644 /* * We open a new session, so it makes sense -@@ -683,8 +693,10 @@ static void +@@ -745,8 +755,10 @@ static void help(const char *name) { fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name); @@ -136,7 +140,7 @@ index 166bf3b..6fb9232 100644 fprintf(stderr, " -t, --tty Start session on alternative tty,\n" " e.g. -t /dev/tty4, requires -u option.\n"); fprintf(stderr, " -v, --verbose Be verbose\n"); -@@ -698,7 +710,9 @@ main(int argc, char *argv[]) +@@ -760,7 +772,9 @@ main(int argc, char *argv[]) int i, c; char *tty = NULL; struct option opts[] = { @@ -146,21 +150,24 @@ index 166bf3b..6fb9232 100644 { "tty", required_argument, NULL, 't' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, -@@ -710,9 +724,13 @@ main(int argc, char *argv[]) +@@ -772,11 +786,16 @@ main(int argc, char *argv[]) while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) { switch (c) { case 'u': +#ifdef HAVE_PAM wl.new_user = optarg; - if (getuid() != 0) - error(1, 0, "Permission denied. -u allowed for root only"); + if (getuid() != 0) { + fprintf(stderr, "weston: Permission denied. -u allowed for root only\n"); + exit(EXIT_FAILURE); + } +#else -+ error(1, 0, "-u is unsupported in this weston-launch build"); ++ fprintf(stderr, "weston: -u is unsupported in this weston-launch build\n"); ++ exit(EXIT_FAILURE); +#endif break; case 't': tty = optarg; -@@ -753,8 +771,10 @@ main(int argc, char *argv[]) +@@ -828,8 +847,10 @@ main(int argc, char *argv[]) if (setup_tty(&wl, tty) < 0) exit(EXIT_FAILURE); @@ -171,3 +178,21 @@ index 166bf3b..6fb9232 100644 if (setup_launcher_socket(&wl) < 0) exit(EXIT_FAILURE); +diff --git a/meson_options.txt b/meson_options.txt +index c862ecc..73ef2c3 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -73,6 +73,13 @@ option( + ) + + option( ++ 'pam', ++ type: 'boolean', ++ value: true, ++ description: 'Define if PAM is available' ++) ++ ++option( + 'xwayland', + type: 'boolean', + value: true, |