1From b0d75fcb9d543f06bbbf67530f5e631459bf9c98 Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Thu, 8 Dec 2022 10:26:26 +0800 4Subject: [PATCH 92/93] HACK: vnc: Make pam optional 5 6Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 7--- 8 libweston/backend-vnc/vnc.c | 10 ++++++++++ 9 libweston/meson.build | 9 +++++---- 10 2 files changed, 15 insertions(+), 4 deletions(-) 11 12diff --git a/libweston/backend-vnc/vnc.c b/libweston/backend-vnc/vnc.c 13index 4861521..ed68f45 100644 14--- a/libweston/backend-vnc/vnc.c 15+++ b/libweston/backend-vnc/vnc.c 16@@ -423,7 +423,10 @@ vnc_handle_auth(const char *username, const char *password, void *userdata) 17 return false; 18 } 19 20+#ifdef HAVE_PAM 21 return weston_authenticate_user(username, password); 22+#endif 23+ return true; 24 } 25 26 static void 27@@ -1008,14 +1011,20 @@ vnc_backend_create(struct weston_compositor *compositor, 28 nvnc_set_userdata(backend->server, backend, NULL); 29 nvnc_set_name(backend->server, "Weston VNC backend"); 30 31+#ifdef HAVE_PAM 32 if (!nvnc_has_auth()) { 33 weston_log("Neat VNC built without TLS support\n"); 34 goto err_output; 35 } 36+#endif 37+ 38 if (!config->server_cert && !config->server_key) { 39 weston_log("The VNC backend requires a key and a certificate for TLS security" 40 " (--vnc-tls-cert/--vnc-tls-key)\n"); 41+#ifdef HAVE_PAM 42 goto err_output; 43+#endif 44+ goto no_tls; 45 } 46 if (!config->server_cert) { 47 weston_log("Missing TLS certificate (--vnc-tls-cert)\n"); 48@@ -1036,6 +1045,7 @@ vnc_backend_create(struct weston_compositor *compositor, 49 50 weston_log("TLS support activated\n"); 51 52+no_tls: 53 ret = weston_plugin_api_register(compositor, WESTON_VNC_OUTPUT_API_NAME, 54 &api, sizeof(api)); 55 if (ret < 0) { 56diff --git a/libweston/meson.build b/libweston/meson.build 57index 6f0b624..037a240 100644 58--- a/libweston/meson.build 59+++ b/libweston/meson.build 60@@ -83,13 +83,14 @@ endif 61 if get_option('backend-vnc') 62 dep_pam = dependency('pam', required: false) 63 if not dep_pam.found() 64- dep_pam = cc.find_library('pam') 65+ dep_pam = cc.find_library('pam', required: false) 66 endif 67 if not dep_pam.found() 68- error('VNC backend requires libpam which was not found. Or, you can use \'-Dbackend-vnc=false\'.') 69+ warning('VNC backend suggests libpam which was not found. Or, you can use \'-Dbackend-vnc=false\'.') 70+ else 71+ config_h.set('HAVE_PAM', '1') 72+ deps_libweston += dep_pam 73 endif 74- config_h.set('HAVE_PAM', '1') 75- deps_libweston += dep_pam 76 endif 77 78 lib_weston = shared_library( 79-- 802.20.1 81 82