From 75736f4853773a391cf18a24e4eebfc41d0053a1 Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Fri, 27 Dec 2024 10:34:16 +0900
Subject: [PATCH 1/4] Allow to change config file (sub)directory
This allows the `xrdp` part of the path `/etc/xrdp` where config files
are placed to be customizable. This change is useful when trying the
stable version and the devel version alternately.
---
common/Makefile.am | 2 +-
configure.ac | 7 +++++++
docs/man/Makefile.am | 1 +
docs/man/sesman.ini.5.in | 2 +-
docs/man/xrdp-chansrv.8.in | 2 +-
docs/man/xrdp-genkeymap.8.in | 2 +-
docs/man/xrdp-keygen.8.in | 6 +++---
docs/man/xrdp-km.toml.5.in | 2 +-
docs/man/xrdp-sesman.8.in | 4 ++--
docs/man/xrdp-sesrun.8.in | 2 +-
docs/man/xrdp.8.in | 2 +-
docs/man/xrdp.ini.5.in | 4 ++--
instfiles/Makefile.am | 3 ++-
instfiles/pulse/Makefile.am | 2 +-
keygen/Makefile.am | 4 ++--
libxrdp/Makefile.am | 2 +-
mc/Makefile.am | 2 +-
neutrinordp/Makefile.am | 2 +-
sesman/Makefile.am | 4 ++--
sesman/chansrv/Makefile.am | 2 +-
sesman/libsesman/Makefile.am | 2 +-
sesman/sesexec/Makefile.am | 2 +-
sesman/tools/Makefile.am | 2 +-
tools/chkpriv/Makefile.am | 3 ++-
tools/chkpriv/xrdp-chkpriv.in | 2 +-
vnc/Makefile.am | 2 +-
xrdp/Makefile.am | 4 ++--
xup/Makefile.am | 2 +-
28 files changed, 43 insertions(+), 33 deletions(-)
diff --git a/common/Makefile.am b/common/Makefile.am
index 3619a55d3d..9e8b6625d6 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -24,7 +24,7 @@ include_HEADERS = \
xrdp_sockets.h
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
diff --git a/configure.ac b/configure.ac
index 694fafce63..11762b5535 100644
--- a/configure.ac
+++ b/configure.ac
@@ -610,6 +610,12 @@ AC_ARG_WITH([pamconfdir],
[], [with_pamconfdir="$sysconfdir/pam.d"])
AC_SUBST([pamconfdir], [$with_pamconfdir])
+AC_ARG_WITH([sysconfsubdir],
+ [AS_HELP_STRING([--with-sysconfsubdir=DIR],
+ [Use subdirectory for config files (default: xrdp)]))],
+ [], [with_sysconfsubdir="xrdp"])
+AC_SUBST([sysconfsubdir], [$with_sysconfsubdir])
+
PKG_INSTALLDIR
AC_CHECK_HEADERS([sys/prctl.h uchar.h])
@@ -704,6 +710,7 @@ echo " exec_prefix $exec_prefix"
echo " libdir $libdir"
echo " bindir $bindir"
echo " sysconfdir $sysconfdir"
+echo " sysconfdir+subdir $sysconfdir/$sysconfsubdir"
echo " pamconfdir $pamconfdir"
echo " localstatedir $localstatedir"
echo " runstatedir $runstatedir"
diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am
index 604704905b..ae1c952160 100644
--- a/docs/man/Makefile.am
+++ b/docs/man/Makefile.am
@@ -24,6 +24,7 @@ SUBST_VARS = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@sysconfsubdir[@]|$(sysconfsubdir)|g' \
-e 's|@socketdir[@]|$(socketdir)|g' \
-e 's|@xrdpconfdir[@]|$(sysconfdir)/xrdp|g' \
-e 's|@xrdpdatadir[@]|$(datadir)/xrdp|g' \
diff --git a/docs/man/sesman.ini.5.in b/docs/man/sesman.ini.5.in
index b73fd880da..31681603f5 100644
--- a/docs/man/sesman.ini.5.in
+++ b/docs/man/sesman.ini.5.in
@@ -440,7 +440,7 @@ All entries in the \fB[SessionVariables]\fR section are set as
environment variables in the user's session.
.SH "FILES"
-@sysconfdir@/xrdp/sesman.ini
+@sysconfdir@/@sysconfsubdir@/sesman.ini
.SH "SEE ALSO"
.BR xrdp-sesman (8),
diff --git a/docs/man/xrdp-chansrv.8.in b/docs/man/xrdp-chansrv.8.in
index 44d5021c8c..2b642bcb86 100644
--- a/docs/man/xrdp-chansrv.8.in
+++ b/docs/man/xrdp-chansrv.8.in
@@ -40,7 +40,7 @@ X11 display number. Must be specified.
.SH FILES
.TP
-.I @sysconfdir@/xrdp/sesman.ini
+.I @sysconfdir@/@sysconfsubdir@/sesman.ini
Contains some settings for this program.
.TP
.I @socketdir@/xrdp_chansrv_socket_*
diff --git a/docs/man/xrdp-genkeymap.8.in b/docs/man/xrdp-genkeymap.8.in
index 5e4ea63c2f..1846de6563 100644
--- a/docs/man/xrdp-genkeymap.8.in
+++ b/docs/man/xrdp-genkeymap.8.in
@@ -41,7 +41,7 @@ The key map information is stored in the file named \fIoutfile\fP.
.SH "FILES"
.TP
-.I @sysconfdir@/xrdp/km-XXXXXXXX.toml
+.I @sysconfdir@/@sysconfsubdir@/km-XXXXXXXX.toml
Files containing the keyboard mapping for country and language \fIXXXXXXXX\fP.
\fIXXXXXXXX\fP is a 8 digit hexadecimal number, representing the \fIinput
locale identifier\fP.
diff --git a/docs/man/xrdp-keygen.8.in b/docs/man/xrdp-keygen.8.in
index 32d324588e..dd89b60f53 100644
--- a/docs/man/xrdp-keygen.8.in
+++ b/docs/man/xrdp-keygen.8.in
@@ -15,7 +15,7 @@ xrdp\-keygen \- xrdp RSA key generation utility
.SH DESCRIPTION
\fBxrdp\-keygen\fP generates the file
-.I @sysconfdir@/xrdp/rsakeys.ini
+.I @sysconfdir@/@sysconfsubdir@/rsakeys.ini
which contains the RSA key pair used to perform authentication to
remote clients. The public key is self-signed.
@@ -26,14 +26,14 @@ This program takes one of the following options:
Generate a new key pair.
The key data is stored in the file named \fIoutfile\fP.
.br
-If \fBauto\fP is used as \fIoutfile\fP, the default file \fI@sysconfdir@/xrdp/rsakeys.ini\fP gets created if it does not yet exists.
+If \fBauto\fP is used as \fIoutfile\fP, the default file \fI@sysconfdir@/@sysconfsubdir@/rsakeys.ini\fP gets created if it does not yet exists.
.TP
.B test
Generate a test key pair and print information to standard output.
.SH FILES
.TP
-.I @sysconfdir@/xrdp/rsakeys.ini
+.I @sysconfdir@/@sysconfsubdir@/rsakeys.ini
RSA public and private key pair used to identify this XRDP server.
.SH SEE ALSO
diff --git a/docs/man/xrdp-km.toml.5.in b/docs/man/xrdp-km.toml.5.in
index a9dbc4322d..d3a05fb078 100644
--- a/docs/man/xrdp-km.toml.5.in
+++ b/docs/man/xrdp-km.toml.5.in
@@ -4,7 +4,7 @@
\fBxrdp-km.toml\fR \- \fBxrdp\fP key mapping file
.SH "DESCRIPTION"
-Key mapping files are located at \fB@sysconfdir@/xrdp/km-XXXXXXXX.toml\fP
+Key mapping files are located at \fB@sysconfdir@/@sysconfsubdir@/km-XXXXXXXX.toml\fP
where \fBXXXXXXXX\fP is the input locale identifier sent by the RDP client.
The key mapping files are used to translate RDP scan codes into one of
diff --git a/docs/man/xrdp-sesman.8.in b/docs/man/xrdp-sesman.8.in
index 379b92b567..c7eb218c3a 100644
--- a/docs/man/xrdp-sesman.8.in
+++ b/docs/man/xrdp-sesman.8.in
@@ -50,7 +50,7 @@ to be used primarily for testing or for unusual configurations.
.P
.RS
If you use this option, be aware that you will have to have a
-\fB@sysconfdir@/xrdp/sesman.ini\fR in place too, as a few elements of
+\fB@sysconfdir@/@sysconfsubdir@/sesman.ini\fR in place too, as a few elements of
the system (notably \fBxrdp(8)\fR and \fBxrdp\-chansrv(8)\fR) will want
to read it.
.RE
@@ -64,7 +64,7 @@ not running \fBxrdp\-sesman\fR as a daemon.
.br
@bindir@/xrdp\-sesrun
.br
-@sysconfdir@/xrdp/sesman.ini
+@sysconfdir@/sysconfsubdir@/sesman.ini
.br
@localstatedir@/log/xrdp\-sesman.log
.br
diff --git a/docs/man/xrdp-sesrun.8.in b/docs/man/xrdp-sesrun.8.in
index 34e3169e45..6f747f2db5 100644
--- a/docs/man/xrdp-sesrun.8.in
+++ b/docs/man/xrdp-sesrun.8.in
@@ -90,7 +90,7 @@ first. The \fBgnome\-terminal\fR utility probably won't work here.
.br
@bindir@/xrdp\-sesrun
.br
-@sysconfdir@/xrdp/sesman.ini
+@sysconfdir@/@sysconfsubdir@/sesman.ini
.SH "AUTHORS"
Jay Sorg
diff --git a/docs/man/xrdp.8.in b/docs/man/xrdp.8.in
index 39e4d88656..80692e8237 100644
--- a/docs/man/xrdp.8.in
+++ b/docs/man/xrdp.8.in
@@ -57,7 +57,7 @@ to be used primarily for testing or for unusual configurations.
.SH "FILES"
@sbindir@/xrdp
.br
-@sysconfdir@/xrdp/xrdp.ini
+@sysconfdir@/@sysconfsubdir@/xrdp.ini
.br
@localstatedir@/log/xrdp.log
.br
diff --git a/docs/man/xrdp.ini.5.in b/docs/man/xrdp.ini.5.in
index 7ce76f7d5b..0b851d2ef5 100644
--- a/docs/man/xrdp.ini.5.in
+++ b/docs/man/xrdp.ini.5.in
@@ -50,7 +50,7 @@ If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables compression of bu
.TP
\fBkey_file\fP=\fI/path/to/private_key\fP
Set location of TLS certificate and private key. They must be written in PEM format.
-If not specified, defaults to \fB@sysconfdir@/xrdp/cert.pem\fP, \fB@sysconfdir@/xrdp/key.pem\fP.
+If not specified, defaults to \fB@sysconfdir@/@sysconfsubdir@/cert.pem\fP, \fB@sysconfdir@/@sysconfsubdir@/key.pem\fP.
This parameter is effective only if \fBsecurity_layer\fP is set to \fBtls\fP or \fBnegotiate\fP.
@@ -425,7 +425,7 @@ password={base64}cGFzc3dvcmQhCg==
.fi
.SH "FILES"
-@sysconfdir@/xrdp/xrdp.ini
+@sysconfdir@/@sysconfsubdir@/xrdp.ini
.SH "SEE ALSO"
.BR xrdp (8),
diff --git a/instfiles/Makefile.am b/instfiles/Makefile.am
index 5c7f4279b3..c999b499ea 100644
--- a/instfiles/Makefile.am
+++ b/instfiles/Makefile.am
@@ -13,6 +13,7 @@ CLEANFILES= \
SUBST_VARS = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@sysconfsubdir[@]|$(sysconfsubdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g'
subst_verbose = $(subst_verbose_@AM_V@)
@@ -26,7 +27,7 @@ SUFFIXES = .in
#
# files for all platforms
#
-startscriptdir=$(sysconfdir)/xrdp
+startscriptdir=$(sysconfdir)/$(sysconfsubdir)
dist_startscript_DATA = \
km-00000406.toml \
diff --git a/instfiles/pulse/Makefile.am b/instfiles/pulse/Makefile.am
index 72b80d10af..00c7a000aa 100644
--- a/instfiles/pulse/Makefile.am
+++ b/instfiles/pulse/Makefile.am
@@ -1,2 +1,2 @@
-pulsedir = $(sysconfdir)/xrdp/pulse
+pulsedir = $(sysconfdir)/$(sysconfsubdir)/pulse
dist_pulse_DATA = default.pa
diff --git a/keygen/Makefile.am b/keygen/Makefile.am
index 2422196a58..9ee5a1b1f5 100644
--- a/keygen/Makefile.am
+++ b/keygen/Makefile.am
@@ -1,7 +1,7 @@
EXTRA_DIST = openssl.conf
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
@@ -15,7 +15,7 @@ xrdp_keygen_SOURCES = keygen.c
xrdp_keygen_LDADD = \
$(top_builddir)/common/libcommon.la
-xrdpsysconfdir = $(sysconfdir)/xrdp
+xrdpsysconfdir = $(sysconfdir)/$(sysconfsubdir)
install-data-hook:
umask 077 && \
diff --git a/libxrdp/Makefile.am b/libxrdp/Makefile.am
index 49df6c658f..8a2c1b76ef 100644
--- a/libxrdp/Makefile.am
+++ b/libxrdp/Makefile.am
@@ -2,7 +2,7 @@ EXTRA_DIST = \
xrdp_surface.c
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
diff --git a/mc/Makefile.am b/mc/Makefile.am
index 9ed72135ac..b36c40e9e2 100644
--- a/mc/Makefile.am
+++ b/mc/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
diff --git a/neutrinordp/Makefile.am b/neutrinordp/Makefile.am
index d9c31bc325..75cd0adf38 100644
--- a/neutrinordp/Makefile.am
+++ b/neutrinordp/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
diff --git a/sesman/Makefile.am b/sesman/Makefile.am
index 8d9d31022c..9ddef8e84e 100644
--- a/sesman/Makefile.am
+++ b/sesman/Makefile.am
@@ -2,7 +2,7 @@ EXTRA_DIST = \
Doxyfile
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_LIBEXEC_PATH=\"${libexecdir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
@@ -40,7 +40,7 @@ xrdp_sesman_LDADD = \
$(top_builddir)/libipm/libipm.la \
$(top_builddir)/common/libcommon.la
-sesmansysconfdir=$(sysconfdir)/xrdp
+sesmansysconfdir=$(sysconfdir)/$(sysconfsubdir)
SUBST_VARS = sed \
-e 's|@sesmansysconfdir[@]|$(sesmansysconfdir)|g'
diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am
index 0c2e4b1131..e53961b440 100644
--- a/sesman/chansrv/Makefile.am
+++ b/sesman/chansrv/Makefile.am
@@ -4,7 +4,7 @@ EXTRA_DIST = \
wave-format-server.txt
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
diff --git a/sesman/libsesman/Makefile.am b/sesman/libsesman/Makefile.am
index 7ef44455b0..2beebd1e11 100644
--- a/sesman/libsesman/Makefile.am
+++ b/sesman/libsesman/Makefile.am
@@ -3,7 +3,7 @@
AM_CPPFLAGS = \
-DXRDP_PAMCONF_PATH=\"${pamconfdir}\" \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SOCKET_ROOT_PATH=\"${socketdir}\" \
-I$(top_srcdir)/libipm \
-I$(top_srcdir)/common
diff --git a/sesman/sesexec/Makefile.am b/sesman/sesexec/Makefile.am
index 7adb959150..1eae19cb04 100644
--- a/sesman/sesexec/Makefile.am
+++ b/sesman/sesexec/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_LIBEXEC_PATH=\"${libexecdir}/xrdp\" \
-DXRDP_SOCKET_ROOT_PATH=\"${socketdir}\" \
diff --git a/sesman/tools/Makefile.am b/sesman/tools/Makefile.am
index ce5171b1e9..611b86eee0 100644
--- a/sesman/tools/Makefile.am
+++ b/sesman/tools/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SOCKET_ROOT_PATH=\"${socketdir}\" \
-I$(top_srcdir)/sesman/libsesman \
-I$(top_srcdir)/common \
diff --git a/tools/chkpriv/Makefile.am b/tools/chkpriv/Makefile.am
index adecdb73a7..db1050fde1 100644
--- a/tools/chkpriv/Makefile.am
+++ b/tools/chkpriv/Makefile.am
@@ -21,7 +21,8 @@ xrdp_droppriv_LDADD = \
SUBST_VARS = sed \
-e 's|@pkglibexecdir[@]|$(pkglibexecdir)|g' \
- -e 's|@sysconfdir[@]|$(sysconfdir)|g'
+ -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+ -e 's|@sysconfsubdir[@]|$(sysconfsubdir)|g'
subst_verbose = $(subst_verbose_@AM_V@)
subst_verbose_ = $(subst_verbose_@AM_DEFAULT_V@)
diff --git a/tools/chkpriv/xrdp-chkpriv.in b/tools/chkpriv/xrdp-chkpriv.in
index 512e90efe2..32580ce444 100644
--- a/tools/chkpriv/xrdp-chkpriv.in
+++ b/tools/chkpriv/xrdp-chkpriv.in
@@ -20,7 +20,7 @@
# mode
# Change these if they do not match your installation
-CONF_DIR=@sysconfdir@/xrdp
+CONF_DIR=@sysconfdir@/@sysconfsubdir@
XRDP_INI="$CONF_DIR"/xrdp.ini
SESMAN_INI="$CONF_DIR"/sesman.ini
RSAKEYS_INI="$CONF_DIR"/rsakeys.ini
diff --git a/vnc/Makefile.am b/vnc/Makefile.am
index ee5ab23a81..8a4339c93e 100644
--- a/vnc/Makefile.am
+++ b/vnc/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am
index 6b9359b9e5..4d4e53f670 100644
--- a/xrdp/Makefile.am
+++ b/xrdp/Makefile.am
@@ -4,7 +4,7 @@ EXTRA_DIST = \
xrdpwin.c
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
@@ -92,7 +92,7 @@ xrdp_LDADD = \
$(IMLIB2_LIBS) \
$(XRDP_EXTRA_LIBS)
-xrdpsysconfdir=$(sysconfdir)/xrdp
+xrdpsysconfdir=$(sysconfdir)/$(sysconfsubdir)
if MACOS
lib_extension = dylib
diff --git a/xup/Makefile.am b/xup/Makefile.am
index b51a7fb3ba..d073c0d0b1 100644
--- a/xup/Makefile.am
+++ b/xup/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = \
- -DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
From 981ceadd1f51dfa43bb9f4744ba678bbf3bfc7df Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Sat, 28 Dec 2024 22:21:14 +0900
Subject: [PATCH 2/4] keygen: replace hardcoded path with sysconf(sub)dir
---
keygen/keygen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/keygen/keygen.c b/keygen/keygen.c
index 9b477530b1..2d06aef760 100644
--- a/keygen/keygen.c
+++ b/keygen/keygen.c
@@ -463,7 +463,7 @@ key_gen(const char *path_and_file_name)
static int
key_gen_auto(void)
{
- return key_gen("/etc/xrdp/rsakeys.ini");
+ return key_gen(XRDP_CFG_PATH "/rsakeys.ini");
}
/*****************************************************************************/
From 81f367134f8b379396864f3beb9b56c7105f59fb Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Sat, 28 Dec 2024 22:21:40 +0900
Subject: [PATCH 3/4] genkeymap: replace hardcoded path with sysconf(sub)dir
---
genkeymap/Makefile.am | 1 +
genkeymap/genkeymap.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/genkeymap/Makefile.am b/genkeymap/Makefile.am
index abf30972d0..85fb6e73ef 100644
--- a/genkeymap/Makefile.am
+++ b/genkeymap/Makefile.am
@@ -3,6 +3,7 @@ EXTRA_DIST = \
readme.txt
AM_CPPFLAGS = \
+ -DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-I$(top_srcdir)/common
AM_CFLAGS = $(X_CFLAGS)
diff --git a/genkeymap/genkeymap.c b/genkeymap/genkeymap.c
index 9f0095dd8a..3ef71faa80 100644
--- a/genkeymap/genkeymap.c
+++ b/genkeymap/genkeymap.c
@@ -92,8 +92,8 @@ usage(const char *programname, int status)
{
fprintf(stderr, "Usage: %s [ -k keycode_set] [-c comment] [-c comment...]"
" out_filename\n", programname);
- fprintf(stderr, "Example: %s -r evdev -c \"en-US pc104 keyboard\""
- " /etc/xrdp/km-00000409.toml\n", programname);
+ fprintf(stderr, "Example: %s -r evdev -c \"en-US pc104 keyboard\" "
+ XRDP_CFG_PATH "/km-00000409.toml\n", programname);
exit(status);
}
From 7db81f8471268827f0fbdeecaf3bc4f9f82c8676 Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Sat, 28 Dec 2024 23:29:14 +0900
Subject: [PATCH 4/4] genkeymap: pet cppcheck
---
genkeymap/genkeymap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/genkeymap/genkeymap.c b/genkeymap/genkeymap.c
index 3ef71faa80..bf752c9839 100644
--- a/genkeymap/genkeymap.c
+++ b/genkeymap/genkeymap.c
@@ -92,8 +92,8 @@ usage(const char *programname, int status)
{
fprintf(stderr, "Usage: %s [ -k keycode_set] [-c comment] [-c comment...]"
" out_filename\n", programname);
- fprintf(stderr, "Example: %s -r evdev -c \"en-US pc104 keyboard\" "
- XRDP_CFG_PATH "/km-00000409.toml\n", programname);
+ fprintf(stderr, "Example: %s -r evdev -c \"en-US pc104 keyboard\" ", programname);
+ fprintf(stderr, XRDP_CFG_PATH "/km-00000409.toml\n");
exit(status);
}