From 99f0cc9344467a3f6ac7d9c5215b7a1f9f2c4939 Mon Sep 17 00:00:00 2001 From: "Boroczki, Lajos" Date: Sat, 28 Sep 2024 17:19:40 +0200 Subject: [PATCH 1/4] xrdp: 0.9.25.1 -> 0.10.1, xorgxrdp: 0.9.20 -> 0.10.2 --- .../networking/remote/xrdp/default.nix | 8 +- .../remote/xrdp/dynamic_config.patch | 80 +++++++++---------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/pkgs/applications/networking/remote/xrdp/default.nix b/pkgs/applications/networking/remote/xrdp/default.nix index ff301d690941..f8b1ac4ee083 100644 --- a/pkgs/applications/networking/remote/xrdp/default.nix +++ b/pkgs/applications/networking/remote/xrdp/default.nix @@ -27,13 +27,13 @@ let xorgxrdp = stdenv.mkDerivation rec { pname = "xorgxrdp"; - version = "0.9.20"; + version = "0.10.2"; src = fetchFromGitHub { owner = "neutrinolabs"; repo = "xorgxrdp"; rev = "v${version}"; - hash = "sha256-cAAWk/GqR5zJmh7EAzX3qJiYNl/RrDWdncdFeqsFIaU="; + hash = "sha256-xwkGY9dD747kyTvoXrYAIoiFBzQe5ngskUYQhDawnbU="; }; nativeBuildInputs = [ pkg-config autoconf automake which libtool nasm ]; @@ -61,7 +61,7 @@ let xrdp = stdenv.mkDerivation rec { pname = "xrdp"; - version = "0.9.25.1"; + version = "0.10.1"; src = applyPatches { inherit version; @@ -72,7 +72,7 @@ let repo = "xrdp"; rev = "v${version}"; fetchSubmodules = true; - hash = "sha256-oAs0oWkCyj3ObdJuHLfT25ZzkTrxNAXDiFU64OOP4Ow="; + hash = "sha256-lqifQJ/JX+0304arVctsEBEDFPhEPn2OWLyjAQW1who="; }; }; diff --git a/pkgs/applications/networking/remote/xrdp/dynamic_config.patch b/pkgs/applications/networking/remote/xrdp/dynamic_config.patch index 5c97beeb6701..2cb50b19fc7f 100644 --- a/pkgs/applications/networking/remote/xrdp/dynamic_config.patch +++ b/pkgs/applications/networking/remote/xrdp/dynamic_config.patch @@ -135,8 +135,8 @@ index 8fa34aea..da94cf95 100644 - LOG(LOG_LEVEL_DEBUG, "keyboard_cfg_file %s", keyboard_cfg_file); + LOG(LOG_LEVEL_DEBUG, "keyboard_cfg_file %s", client_info->xrdp_keyboard_ini_file); -- fd = g_file_open(keyboard_cfg_file); -+ fd = g_file_open(client_info->xrdp_keyboard_ini_file); +- fd = g_file_open_ro(keyboard_cfg_file); ++ fd = g_file_open_ro(client_info->xrdp_keyboard_ini_file); if (fd >= 0) { @@ -179,19 +179,19 @@ index 8fa34aea..da94cf95 100644 list_delete(items); list_delete(values); return 1; -diff --git a/sesman/config.c b/sesman/config.c +diff --git a/sesman/libsesman/sesman_config.c b/sesman/libsesman/sesman_config.c index 61e9e403..0466f61a 100644 ---- a/sesman/config.c -+++ b/sesman/config.c -@@ -34,6 +34,7 @@ - #include "sesman.h" +--- a/sesman/libsesman/sesman_config.c ++++ b/sesman/libsesman/sesman_config.c +@@ -37,6 +37,7 @@ #include "log.h" + #include "os_calls.h" #include "string_calls.h" +#include - #include "chansrv/chansrv_common.h" - - /***************************************************************************//** -@@ -47,11 +48,10 @@ + //#include "chansrv/chansrv_common.h" + #include "scp.h" + +@@ -171,7 +172,7 @@ config_output_policy_string(unsigned int value, * */ static int @@ -200,61 +200,57 @@ index 61e9e403..0466f61a 100644 struct list *param_v) { int i; -- int length; - char *buf; - - list_clear(param_v); -@@ -127,13 +127,12 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, - g_free(cf->default_wm); +@@ -249,14 +250,12 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, cf->default_wm = g_strdup("startwm.sh"); } -- /* if default_wm doesn't begin with '/', it's a relative path to XRDP_CFG_PATH */ -+ /* if default_wm doesn't begin with '/', it's a relative path to base_dir */ + /* if default_wm doesn't begin with '/', it's a relative path to +- * XRDP_CFG_PATH */ ++ * base_dir */ if (cf->default_wm[0] != '/') { /* sizeof operator returns string length including null terminator */ -- length = sizeof(XRDP_CFG_PATH) + g_strlen(cf->default_wm) + 1; /* '/' */ -- buf = (char *)g_malloc(length, 0); +- int length = (sizeof(XRDP_CFG_PATH) + +- g_strlen(cf->default_wm) + 1); /* '/' */ +- char *buf = (char *)g_malloc(length, 0); - g_sprintf(buf, "%s/%s", XRDP_CFG_PATH, cf->default_wm); -+ buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->default_wm) + 1, 0); ++ char *buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->default_wm) + 1, 0); + g_sprintf(buf, "%s/%s", base_dir, cf->default_wm); g_free(cf->default_wm); - cf->default_wm = g_strdup(buf); - g_free(buf); -@@ -151,10 +150,8 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, - /* if reconnect_sh doesn't begin with '/', it's a relative path to XRDP_CFG_PATH */ + cf->default_wm = buf; + } +@@ -271,10 +270,8 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n, if (cf->reconnect_sh[0] != '/') { -- /* sizeof operator returns string length including null terminator */ -- length = sizeof(XRDP_CFG_PATH) + g_strlen(cf->reconnect_sh) + 1; /* '/' */ -- buf = (char *)g_malloc(length, 0); + /* sizeof operator returns string length including null terminator */ +- int length = (sizeof(XRDP_CFG_PATH) + +- g_strlen(cf->reconnect_sh) + 1); /* '/' */ +- char *buf = (char *)g_malloc(length, 0); - g_sprintf(buf, "%s/%s", XRDP_CFG_PATH, cf->reconnect_sh); -+ buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->reconnect_sh) + 1, 0); -+ g_sprintf(buf, "%s/%s", base_dir, cf->reconnect_sh); ++ char *buf = (char *)g_malloc(g_strlen(base_dir) + 1 + g_strlen(cf->reconnect_sh) + 1, 0); ++ g_sprintf(buf, "%s/%s", base_dir, cf->reconnect_sh); g_free(cf->reconnect_sh); - cf->reconnect_sh = g_strdup(buf); - g_free(buf); -@@ -511,6 +508,7 @@ struct config_sesman * + cf->reconnect_sh = buf; + } +@@ -580,6 +577,7 @@ struct config_sesman * config_read(const char *sesman_ini) { struct config_sesman *cfg; + char cfg_dir[256]; int all_ok = 0; - + if ((cfg = g_new0(struct config_sesman, 1)) != NULL) -@@ -532,8 +530,10 @@ config_read(const char *sesman_ini) - param_v->auto_free = 1; - +@@ -602,7 +600,10 @@ config_read(const char *sesman_ini) + all_ok = 1; + /* read global config */ - config_read_globals(fd, cfg, param_n, param_v); -- + g_strcpy(cfg_dir, sesman_ini); + *(strrchr(cfg_dir, '/')) = 0; // cfg_file validated to contain '/' -+ ++ + config_read_globals(cfg_dir, fd, cfg, param_n, param_v); - /* read Xvnc/X11rdp/Xorg parameter list */ + + /* read Xvnc/Xorg parameter list */ config_read_vnc_params(fd, cfg, param_n, param_v); - config_read_rdp_params(fd, cfg, param_n, param_v); diff --git a/xrdp/lang.c b/xrdp/lang.c index e4c18077..06f92997 100644 --- a/xrdp/lang.c From 06390e19bba888e85d44f50bf9faa0ef420c99b8 Mon Sep 17 00:00:00 2001 From: "Boroczki, Lajos" Date: Sun, 29 Sep 2024 20:36:43 +0200 Subject: [PATCH 2/4] Add libdrm dependency --- pkgs/applications/networking/remote/xrdp/default.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/remote/xrdp/default.nix b/pkgs/applications/networking/remote/xrdp/default.nix index f8b1ac4ee083..74ba7ef7707d 100644 --- a/pkgs/applications/networking/remote/xrdp/default.nix +++ b/pkgs/applications/networking/remote/xrdp/default.nix @@ -12,6 +12,7 @@ , systemd , pam , fuse +, libdrm , libjpeg , libopus , nasm @@ -38,7 +39,7 @@ let nativeBuildInputs = [ pkg-config autoconf automake which libtool nasm ]; - buildInputs = [ xorg.xorgserver ]; + buildInputs = [ xorg.xorgserver libdrm ]; postPatch = '' # patch from Debian, allows to run xrdp daemon under unprivileged user @@ -50,9 +51,10 @@ let --replace 'sysconfdir="/etc"' "sysconfdir=$out/etc" ''; - preConfigure = "./bootstrap"; - - configureFlags = [ "XRDP_CFLAGS=-I${xrdp.src}/common" ]; + preConfigure = '' + ./bootstrap + export XRDP_CFLAGS="-I${xrdp.src}/common -I${libdrm.dev}/include -I${libdrm.dev}/include/libdrm" + ''; enableParallelBuilding = true; From 4c786688739c7122cb7d957c91455e25006a782a Mon Sep 17 00:00:00 2001 From: "Boroczki, Lajos" Date: Sun, 29 Sep 2024 20:40:41 +0200 Subject: [PATCH 3/4] xauth path changed --- pkgs/applications/networking/remote/xrdp/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/remote/xrdp/default.nix b/pkgs/applications/networking/remote/xrdp/default.nix index 74ba7ef7707d..d1882e3ddd13 100644 --- a/pkgs/applications/networking/remote/xrdp/default.nix +++ b/pkgs/applications/networking/remote/xrdp/default.nix @@ -96,7 +96,7 @@ let ]; postPatch = '' - substituteInPlace sesman/xauth.c --replace "xauth -q" "${xorg.xauth}/bin/xauth -q" + substituteInPlace sesman/sesexec/xauth.c --replace "xauth -q" "${xorg.xauth}/bin/xauth -q" substituteInPlace configure.ac --replace /usr/include/ "" ''; From 2f5a9ad9b43021d1baf31d3f9d0a38d7297ffcbb Mon Sep 17 00:00:00 2001 From: "Boroczki, Lajos" Date: Mon, 30 Sep 2024 08:17:21 +0200 Subject: [PATCH 4/4] Add SessionSockdirGroup=xrdp to sesman config --- pkgs/applications/networking/remote/xrdp/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/applications/networking/remote/xrdp/default.nix b/pkgs/applications/networking/remote/xrdp/default.nix index d1882e3ddd13..191a09c422cf 100644 --- a/pkgs/applications/networking/remote/xrdp/default.nix +++ b/pkgs/applications/networking/remote/xrdp/default.nix @@ -130,6 +130,7 @@ let cp $src/keygen/openssl.conf $out/share/xrdp/openssl.conf substituteInPlace $out/etc/xrdp/sesman.ini --replace /etc/xrdp/pulse $out/etc/xrdp/pulse + substituteInPlace $out/etc/xrdp/sesman.ini --replace '#SessionSockdirGroup=root' 'SessionSockdirGroup=xrdp' # remove all session types except Xorg (they are not supported by this setup) perl -i -ne 'print unless /\[(X11rdp|Xvnc|console|vnc-any|sesman-any|rdp-any|neutrinordp-any)\]/ .. /^$/' $out/etc/xrdp/xrdp.ini