From 85840863da78476f1d269c2b2b8f54d5e6471da0 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 4 Feb 2016 17:22:52 -0800 Subject: [PATCH 1/8] startwm.sh: make sure sourced scripts are readable Strictly speaking, both existence and readability should be checked. However, chances of ~/.profile being a directory or a FIFO are very small compared to its chances of being non-readable due to some misconfiguration. Put "if" and "then" on the same line for consistency with other checks. Improve comment and pseudocode formatting. --- sesman/startwm.sh | 55 ++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/sesman/startwm.sh b/sesman/startwm.sh index ee48263f..b81d3646 100755 --- a/sesman/startwm.sh +++ b/sesman/startwm.sh @@ -29,36 +29,34 @@ wm_start() xterm } -#Execution sequence for interactive login shell -#Following pseudo code explains the sequence of execution of these files. -#execute /etc/profile -#IF ~/.bash_profile exists THEN -# execute ~/.bash_profile -#ELSE -# IF ~/.bash_login exist THEN -# execute ~/.bash_login -# ELSE -# IF ~/.profile exist THEN -# execute ~/.profile -# END IF -# END IF -#END IF +# Execution sequence for interactive login shell - pseudocode +# +# IF /etc/profile is readable THEN +# execute ~/.bash_profile +# END IF +# IF ~/.bash_profile is readable THEN +# execute ~/.bash_profile +# ELSE +# IF ~/.bash_login is readable THEN +# execute ~/.bash_login +# ELSE +# IF ~/.profile is readable THEN +# execute ~/.profile +# END IF +# END IF +# END IF pre_start() { - if [ -f /etc/profile ] - then + if [ -r /etc/profile ]; then . /etc/profile fi - if [ -f ~/.bash_profile ] - then + if [ -r ~/.bash_profile ]; then . ~/.bash_profile else - if [ -f ~/.bash_login ] - then + if [ -r ~/.bash_login ]; then . ~/.bash_login else - if [ -f ~/.profile ] - then + if [ -r ~/.profile ]; then . ~/.profile fi fi @@ -66,15 +64,14 @@ pre_start() return 0 } -#When you logout of the interactive shell, following is the -#sequence of execution: -#IF ~/.bash_logout exists THEN -# execute ~/.bash_logout -#END IF +# When loging out from the interactive shell, the execution sequence is: +# +# IF ~/.bash_logout exists THEN +# execute ~/.bash_logout +# END IF post_start() { - if [ -f ~/.bash_logout ] - then + if [ -r ~/.bash_logout ]; then . ~/.bash_logout fi return 0 From 09709d3ced4e95014ba72f7279611af2b64a2678 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 11 Feb 2016 09:31:38 -0800 Subject: [PATCH 2/8] xcon: include unistd.h, it's needed for select() on MacOS --- sesman/tools/xcon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sesman/tools/xcon.c b/sesman/tools/xcon.c index 4150d6af..4b3248b6 100644 --- a/sesman/tools/xcon.c +++ b/sesman/tools/xcon.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include From 22e808a18673f8ea82250a27310873d13cf9a680 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 11 Feb 2016 19:44:22 -0800 Subject: [PATCH 3/8] Add missing spaces in the strings that are split for line wrapping --- libxrdp/xrdp_rdp.c | 4 ++-- sesman/access.c | 2 +- sesman/chansrv/pulse/module-xrdp-sink.c | 2 +- sesman/scp_v1.c | 2 +- xrdp/xrdp_mm.c | 4 ++-- xup/xup.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 1718afd1..1e58a1f4 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -98,8 +98,8 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info) } else { - log_message(LOG_LEVEL_ALWAYS,"Warning: Your configured crypt level is" - "undefined 'high' will be used"); + log_message(LOG_LEVEL_ALWAYS,"Warning: Your configured crypt level is " + "undefined, 'high' will be used"); client_info->crypt_level = 3; } } diff --git a/sesman/access.c b/sesman/access.c index 269b9e77..b50f2caa 100644 --- a/sesman/access.c +++ b/sesman/access.c @@ -93,7 +93,7 @@ access_login_mng_allowed(char *user) if (0 == g_cfg->sec.ts_admins_enable) { - LOG_DBG("[MNG] Terminal Server Admin group is disabled," + LOG_DBG("[MNG] Terminal Server Admin group is disabled, " "allowing authentication", 1); return 1; } diff --git a/sesman/chansrv/pulse/module-xrdp-sink.c b/sesman/chansrv/pulse/module-xrdp-sink.c index 5d6256d4..f56644b9 100644 --- a/sesman/chansrv/pulse/module-xrdp-sink.c +++ b/sesman/chansrv/pulse/module-xrdp-sink.c @@ -77,7 +77,7 @@ PA_MODULE_USAGE( "sink_name= " "sink_properties= " "format= " - "rate=" + "rate= " "channels= " "channel_map="); diff --git a/sesman/scp_v1.c b/sesman/scp_v1.c index a0fff6d9..92e1dad5 100644 --- a/sesman/scp_v1.c +++ b/sesman/scp_v1.c @@ -110,7 +110,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) if (scount == 0) { /* no disconnected sessions - start a new one */ - log_message(LOG_LEVEL_DEBUG, "No disconnected sessions for this user" + log_message(LOG_LEVEL_DEBUG, "No disconnected sessions for this user " "- we create a new one"); if (0 != s->client_ip) diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 26e5c028..088b6676 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -1151,7 +1151,7 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port) if (!(self->chan_trans_up)) { - log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: error in" + log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: error in " "trans_connect chan"); } @@ -1164,7 +1164,7 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port) } else { - log_message(LOG_LEVEL_DEBUG,"xrdp_mm_connect_chansrv: chansrv" + log_message(LOG_LEVEL_DEBUG,"xrdp_mm_connect_chansrv: chansrv " "connect successful"); } } diff --git a/xup/xup.c b/xup/xup.c index 21fdedd5..8e904d52 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -211,7 +211,7 @@ lib_mod_connect(struct mod *mod) error = -1; if (trans_connect(mod->trans, mod->ip, con_port, 3000) == 0) { - LLOGLN(0, ("lib_mod_connect: connected to Xserver" + LLOGLN(0, ("lib_mod_connect: connected to Xserver " "(Xorg or X11rdp) sck %d", mod->trans->sck)); error = 0; } From 04fc814efd6d1fbcd06963d07d2027ccaf86936e Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 11 Feb 2016 22:15:22 -0800 Subject: [PATCH 4/8] Use silent rules by default if supported by Automake Silent rules make warnings stand out, so they are fixed early. --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index efb307ac..099b623f 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,9 @@ AC_C_CONST AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG +# Use silent rules by default if supported by Automake +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + case $host_os in *linux*) linux=yes From 0e75e13b425547a829ec9fb3a99c2ad68e6f5420 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 11 Feb 2016 23:40:27 -0800 Subject: [PATCH 5/8] Automake 1.7.2 is the oldest version working with xrdp Automake 1.6.x cannot deal with conditional EXTRA_LIBS. Automake 1.7 and 1.7.1 cannot deal with line continuation in SUBDIRS. It is important to have correct requirements to know what Automake features can be used. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 099b623f..af78a392 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_INIT([xrdp], [0.9.0], [xrdp-devel@googlegroups.com]) AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in) -AM_INIT_AUTOMAKE([1.6 foreign]) +AM_INIT_AUTOMAKE([1.7.2 foreign]) AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC AC_C_CONST From 9a1dea8e5015fd0d8bb5304fd05eae10efadf473 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 11 Feb 2016 23:27:54 -0800 Subject: [PATCH 6/8] Fix sloppy formatting in instfiles/Makefile.am Use spaces around = and +=, indent by 2 spaces. --- instfiles/Makefile.am | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/instfiles/Makefile.am b/instfiles/Makefile.am index 99f37b61..4ef77992 100644 --- a/instfiles/Makefile.am +++ b/instfiles/Makefile.am @@ -32,28 +32,28 @@ startscript_DATA = \ # # platform specific files # -SUBDIRS= +SUBDIRS = if LINUX -SUBDIRS+= \ - pam.d \ - pulse -startscript_DATA+= xrdp.sh +SUBDIRS += \ + pam.d \ + pulse +startscript_DATA += xrdp.sh if HAVE_SYSTEMD systemdsystemunit_DATA = \ - xrdp-sesman.service \ - xrdp.service + xrdp-sesman.service \ + xrdp.service else -SUBDIRS+= \ - default \ - init.d +SUBDIRS += \ + default \ + init.d endif # HAVE_SYSTEMD endif # LINUX if FREEBSD -SUBDIRS+= \ - pam.d \ - rc.d \ - pulse +SUBDIRS += \ + pam.d \ + rc.d \ + pulse endif # From ffc4efb9ce09ccc370571793607b19193d8cb15b Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 9 Feb 2016 21:10:30 -0800 Subject: [PATCH 7/8] Don't ignore files known to git That can cause unexpected behavior, especially with third party tools. The ignored files will be lost if the source tree is re-imported to another git repository, unless special care is taken. Whitelist all non-generated makefiles. To whitelist instfiles/pam.d/xrdp-sesman, add path to all generated executables listed in the top-level .gitignore, sort .gitignore alphabetically. Add mkinstalldir, it's used by Automake on some systems. --- .gitignore | 23 ++++++++++++----------- fontdump/.gitignore | 1 + sesman/chansrv/pcsc/.gitignore | 1 + sesman/chansrv/pulse/.gitignore | 1 + tests/.gitignore | 1 + xorg/.gitignore | 1 + 6 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 fontdump/.gitignore create mode 100644 sesman/chansrv/pcsc/.gitignore create mode 100644 sesman/chansrv/pulse/.gitignore create mode 100644 tests/.gitignore create mode 100644 xorg/.gitignore diff --git a/.gitignore b/.gitignore index 0437bf57..e7ca1e6b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ aclocal.m4 AUTHORS autom4te.cache/ ChangeLog +compile config_ac.h config_ac-h.in config.guess @@ -10,10 +11,11 @@ config.log config.status config.sub configure -compile depcomp .deps/ +genkeymap/xrdp-genkeymap install-sh +keygen/xrdp-keygen *.la .libs libtool @@ -22,18 +24,17 @@ ltmain.sh Makefile Makefile.in missing +mkinstalldirs NEWS *.o README +sesman/chansrv/xrdp-chansrv +sesman/sessvc/xrdp-sessvc +sesman/tools/xrdp-dis +sesman/tools/xrdp-sesadmin +sesman/tools/xrdp-sesrun +sesman/tools/xrdp-sestest +sesman/tools/xrdp-xcon +sesman/xrdp-sesman stamp-h1 -xrdp-chansrv -xrdp-genkeymap -xrdp-keygen -xrdp-sesadmin -xrdp-sesman -xrdp-sesrun -xrdp-sessvc -xrdp-sestest -xrdp-dis -xrdp-xcon xrdp/xrdp diff --git a/fontdump/.gitignore b/fontdump/.gitignore new file mode 100644 index 00000000..24600083 --- /dev/null +++ b/fontdump/.gitignore @@ -0,0 +1 @@ +!Makefile diff --git a/sesman/chansrv/pcsc/.gitignore b/sesman/chansrv/pcsc/.gitignore new file mode 100644 index 00000000..24600083 --- /dev/null +++ b/sesman/chansrv/pcsc/.gitignore @@ -0,0 +1 @@ +!Makefile diff --git a/sesman/chansrv/pulse/.gitignore b/sesman/chansrv/pulse/.gitignore new file mode 100644 index 00000000..24600083 --- /dev/null +++ b/sesman/chansrv/pulse/.gitignore @@ -0,0 +1 @@ +!Makefile diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 00000000..24600083 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +!Makefile diff --git a/xorg/.gitignore b/xorg/.gitignore new file mode 100644 index 00000000..24600083 --- /dev/null +++ b/xorg/.gitignore @@ -0,0 +1 @@ +!Makefile From dcab7552db2af346724c5090e529950b32a7076d Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Wed, 10 Feb 2016 10:24:09 -0800 Subject: [PATCH 8/8] Stop redefining libdir, use moduledir for ${libdir}/xrdp libdir is for shared and static libraries. Some xrdp libraries are loaded dynamically from a non-standard directory, so they are used like modules. Having separate libdir and moduledir would eventually allow to separate dynamically loaded modules from shared libraries. --- common/Makefile.am | 2 +- common/file_loc.h | 4 ++-- configure.ac | 3 ++- libxrdp/Makefile.am | 2 +- mc/Makefile.am | 2 +- neutrinordp/Makefile.am | 2 +- rdp/Makefile.am | 2 +- sesman/libscp/Makefile.am | 2 +- vnc/Makefile.am | 2 +- xrdp/Makefile.am | 2 +- xrdp/xrdp_mm.c | 2 +- xrdpapi/Makefile.am | 2 +- xrdpvr/Makefile.am | 2 +- xup/Makefile.am | 2 +- 14 files changed, 16 insertions(+), 15 deletions(-) diff --git a/common/Makefile.am b/common/Makefile.am index c8501586..cc72b22b 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -26,7 +26,7 @@ AM_CPPFLAGS = \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ -DXRDP_LOG_PATH=\"${localstatedir}/log\" -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libcommon.la libcommon_la_SOURCES = \ diff --git a/common/file_loc.h b/common/file_loc.h index 7389a1ed..8f5146cb 100644 --- a/common/file_loc.h +++ b/common/file_loc.h @@ -37,8 +37,8 @@ #define XRDP_SHARE_PATH "/usr/local/share/xrdp" #endif -#if !defined(XRDP_LIB_PATH) -#define XRDP_LIB_PATH "/usr/local/lib/xrdp" +#if !defined(XRDP_MODULE_PATH) +#define XRDP_MODULE_PATH "/usr/local/lib/xrdp" #endif #if !defined(XRDP_LOG_PATH) diff --git a/configure.ac b/configure.ac index af78a392..80fad1c3 100644 --- a/configure.ac +++ b/configure.ac @@ -226,7 +226,8 @@ AC_CHECK_HEADER([X11/extensions/Xrandr.h], [], CFLAGS="$save_CFLAGS" -libdir="${libdir}/xrdp"; +AC_SUBST([moduledir], '${libdir}/xrdp') + if test "x${prefix}" = "xNONE" ; then sysconfdir="/etc"; localstatedir="/var"; diff --git a/libxrdp/Makefile.am b/libxrdp/Makefile.am index 5b89b0c3..ade99c65 100644 --- a/libxrdp/Makefile.am +++ b/libxrdp/Makefile.am @@ -37,7 +37,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/common \ $(EXTRA_INCLUDES) -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libxrdp.la libxrdp_la_SOURCES = \ diff --git a/mc/Makefile.am b/mc/Makefile.am index f56dac5f..b636a09d 100644 --- a/mc/Makefile.am +++ b/mc/Makefile.am @@ -7,7 +7,7 @@ AM_CPPFLAGS = \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ -I$(top_srcdir)/common -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libmc.la libmc_la_SOURCES = mc.c diff --git a/neutrinordp/Makefile.am b/neutrinordp/Makefile.am index 58fe9bc2..932ddc78 100644 --- a/neutrinordp/Makefile.am +++ b/neutrinordp/Makefile.am @@ -16,7 +16,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/common \ $(FREERDP_CFLAGS) -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libxrdpneutrinordp.la libxrdpneutrinordp_la_SOURCES = xrdp-neutrinordp.c xrdp-color.c diff --git a/rdp/Makefile.am b/rdp/Makefile.am index 6d23b287..72c31101 100644 --- a/rdp/Makefile.am +++ b/rdp/Makefile.am @@ -15,7 +15,7 @@ AM_CPPFLAGS = \ $(EXTRA_DEFINES) \ -I$(top_srcdir)/common -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ librdp.la librdp_la_SOURCES = \ diff --git a/sesman/libscp/Makefile.am b/sesman/libscp/Makefile.am index 3172f2cb..627a3370 100644 --- a/sesman/libscp/Makefile.am +++ b/sesman/libscp/Makefile.am @@ -8,7 +8,7 @@ AM_CPPFLAGS = \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ -I$(top_srcdir)/common -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libscp.la libscp_la_SOURCES = \ diff --git a/vnc/Makefile.am b/vnc/Makefile.am index a9a3aa14..9d37c6da 100644 --- a/vnc/Makefile.am +++ b/vnc/Makefile.am @@ -7,7 +7,7 @@ AM_CPPFLAGS = \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ -I$(top_srcdir)/common -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libvnc.la libvnc_la_SOURCES = vnc.c diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am index 308f01a4..f20cda69 100644 --- a/xrdp/Makefile.am +++ b/xrdp/Makefile.am @@ -22,7 +22,7 @@ AM_CPPFLAGS = \ -DXRDP_SBIN_PATH=\"${sbindir}\" \ -DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ - -DXRDP_LIB_PATH=\"${libdir}\" \ + -DXRDP_MODULE_PATH=\"${moduledir}\" \ $(EXTRA_DEFINES) \ -I$(top_builddir) \ -I$(top_srcdir)/common \ diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 088b6676..64ebdaf4 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -357,7 +357,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) if (self->mod_handle == 0) { - g_snprintf(text, 255, "%s/%s", XRDP_LIB_PATH, lib); + g_snprintf(text, 255, "%s/%s", XRDP_MODULE_PATH, lib); /* Let the main thread load the lib,*/ self->mod_handle = g_xrdp_sync(xrdp_mm_sync_load, (tintptr)text, 0); diff --git a/xrdpapi/Makefile.am b/xrdpapi/Makefile.am index 8107ffeb..30001b2a 100644 --- a/xrdpapi/Makefile.am +++ b/xrdpapi/Makefile.am @@ -9,7 +9,7 @@ AM_CPPFLAGS = \ $(EXTRA_DEFINES) \ $(EXTRA_INCLUDES) -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libxrdpapi.la libxrdpapi_la_SOURCES = \ diff --git a/xrdpvr/Makefile.am b/xrdpvr/Makefile.am index f232ce41..0f2b7cbc 100644 --- a/xrdpvr/Makefile.am +++ b/xrdpvr/Makefile.am @@ -9,7 +9,7 @@ AM_CPPFLAGS = \ $(EXTRA_DEFINES) \ $(EXTRA_INCLUDES) -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libxrdpvr.la libxrdpvr_la_SOURCES = \ diff --git a/xup/Makefile.am b/xup/Makefile.am index d7017b42..7669a55f 100644 --- a/xup/Makefile.am +++ b/xup/Makefile.am @@ -7,7 +7,7 @@ AM_CPPFLAGS = \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ -I$(top_srcdir)/common -lib_LTLIBRARIES = \ +module_LTLIBRARIES = \ libxup.la libxup_la_SOURCES = xup.c