Update xrdp patch

This commit is contained in:
Charlotte Van Petegem 2023-01-17 15:10:40 +01:00
parent a004536d50
commit 2ddfe6739f
No known key found for this signature in database
GPG key ID: 019E764B7184435A

View file

@ -1,12 +1,12 @@
From 397d1759f2139a7f4e01b4a2242e1bbf83d0dd9e Mon Sep 17 00:00:00 2001
From ee0f985a2f13c6fbdd2cd250ded529e0b6eb30a3 Mon Sep 17 00:00:00 2001
From: Charlotte Van Petegem <charlotte@vanpetegem.me>
Date: Sat, 7 Jan 2023 15:32:35 +0100
Subject: [PATCH] xrdp: 0.9.9 -> 0.9.21, xorgxrdp: 0.2.9 -> 0.9.19
---
.../networking/remote/xrdp/default.nix | 42 +--
.../remote/xrdp/dynamic_config.patch | 300 ++++++++++++++++++
2 files changed, 315 insertions(+), 27 deletions(-)
.../networking/remote/xrdp/default.nix | 42 +-
.../remote/xrdp/dynamic_config.patch | 376 ++++++++++++++++++
2 files changed, 391 insertions(+), 27 deletions(-)
create mode 100644 pkgs/applications/networking/remote/xrdp/dynamic_config.patch
diff --git a/pkgs/applications/networking/remote/xrdp/default.nix b/pkgs/applications/networking/remote/xrdp/default.nix
@ -113,10 +113,10 @@ index 3744451f3e282..b7c51d70dfecb 100644
in xrdp
diff --git a/pkgs/applications/networking/remote/xrdp/dynamic_config.patch b/pkgs/applications/networking/remote/xrdp/dynamic_config.patch
new file mode 100644
index 0000000000000..8f86cea1b4ec9
index 0000000000000..5c97beeb67018
--- /dev/null
+++ b/pkgs/applications/networking/remote/xrdp/dynamic_config.patch
@@ -0,0 +1,300 @@
@@ -0,0 +1,376 @@
+diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h
+index f45195e8..b87ae64e 100644
+--- a/common/xrdp_client_info.h
@ -235,7 +235,7 @@ index 0000000000000..8f86cea1b4ec9
+ && g_strlen(value) > 0)
+ {
+diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
+index 084fca6b..a3abe49b 100644
+index 8fa34aea..da94cf95 100644
+--- a/libxrdp/xrdp_sec.c
++++ b/libxrdp/xrdp_sec.c
+@@ -371,7 +371,6 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
@ -268,7 +268,7 @@ index 0000000000000..8f86cea1b4ec9
+ }
+ }
+
+@@ -2799,7 +2797,6 @@ xrdp_sec_incoming(struct xrdp_sec *self)
+@@ -2759,7 +2757,6 @@ xrdp_sec_incoming(struct xrdp_sec *self)
+ int index = 0;
+ char *item = NULL;
+ char *value = NULL;
@ -276,7 +276,7 @@ index 0000000000000..8f86cea1b4ec9
+
+ iso = self->mcs_layer->iso_layer;
+
+@@ -2845,19 +2842,17 @@ xrdp_sec_incoming(struct xrdp_sec *self)
+@@ -2805,19 +2802,17 @@ xrdp_sec_incoming(struct xrdp_sec *self)
+ LOG(LOG_LEVEL_DEBUG, "Using RDP security, and "
+ "reading the server configuration");
+
@ -298,6 +298,82 @@ index 0000000000000..8f86cea1b4ec9
+ list_delete(items);
+ list_delete(values);
+ return 1;
+diff --git a/sesman/config.c b/sesman/config.c
+index 61e9e403..0466f61a 100644
+--- a/sesman/config.c
++++ b/sesman/config.c
+@@ -34,6 +34,7 @@
+ #include "sesman.h"
+ #include "log.h"
+ #include "string_calls.h"
++#include <string.h>
+ #include "chansrv/chansrv_common.h"
+
+ /***************************************************************************//**
+@@ -47,11 +48,10 @@
+ *
+ */
+ static int
+-config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
++config_read_globals(const char *base_dir, int file, struct config_sesman *cf, struct list *param_n,
+ 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);
+ 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 (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);
+- 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);
++ 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 */
+ 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);
+- 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);
+ g_free(cf->reconnect_sh);
+ cf->reconnect_sh = g_strdup(buf);
+ g_free(buf);
+@@ -511,6 +508,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;
+
+ /* 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 */
+ 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
@ -337,7 +413,7 @@ index 0000000000000..8f86cea1b4ec9
+
+ if (g_file_exist(filename))
+diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c
+index 60d805d2..ecebad6c 100644
+index e91672fb..37cef0c0 100644
+--- a/xrdp/xrdp.c
++++ b/xrdp/xrdp.c
+@@ -384,7 +384,6 @@ xrdp_sanity_check(void)