summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPavel Roskin <plroskin@gmail.com>2017-03-14 21:45:50 -0700
committerjsorg71 <jay.sorg@gmail.com>2017-03-17 22:25:05 -0700
commit58c9cb43e9e83a6f5cc8a13cd84aa67cce8cacd5 (patch)
tree4440da8a15401e221175c4b6d3df6c44253e3f2e /common
parentfc2572f60b574cf5bc45f1c7b58698681f39ac50 (diff)
downloadxrdp-proprietary-58c9cb43e9e83a6f5cc8a13cd84aa67cce8cacd5.tar.gz
xrdp-proprietary-58c9cb43e9e83a6f5cc8a13cd84aa67cce8cacd5.zip
Make socket directory configurable, don't hardcode /tmp/.xrdp
Use XRDP_SOCKET_PATH in file_loc.h Don't define any non-socket paths in file_loc.h, they should come from the makefiles. Define all paths unconditionally, they should not be defined elsewhere. Pass XRDP_SOCKET_PATH as environment variable to the backends.
Diffstat (limited to 'common')
-rw-r--r--common/Makefile.am3
-rw-r--r--common/file_loc.h49
-rw-r--r--common/os_calls.c11
3 files changed, 14 insertions, 49 deletions
diff --git a/common/Makefile.am b/common/Makefile.am
index 0af033a3..dab9d524 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -16,7 +16,8 @@ AM_CPPFLAGS = \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
- -DXRDP_LOG_PATH=\"${localstatedir}/log\"
+ -DXRDP_LOG_PATH=\"${localstatedir}/log\" \
+ -DXRDP_SOCKET_PATH=\"${socketdir}\"
if XRDP_DEBUG
AM_CPPFLAGS += -DXRDP_DEBUG
diff --git a/common/file_loc.h b/common/file_loc.h
index 8f5146cb..45178964 100644
--- a/common/file_loc.h
+++ b/common/file_loc.h
@@ -21,48 +21,11 @@
#if !defined(FILE_LOC_H)
#define FILE_LOC_H
-#if !defined(XRDP_CFG_PATH)
-#define XRDP_CFG_PATH "/etc/xrdp"
-#endif
-
-#if !defined(XRDP_PID_PATH)
-#define XRDP_PID_PATH "/var/run"
-#endif
-
-#if !defined(XRDP_SBIN_PATH)
-#define XRDP_SBIN_PATH "/usr/local/sbin"
-#endif
-
-#if !defined(XRDP_SHARE_PATH)
-#define XRDP_SHARE_PATH "/usr/local/share/xrdp"
-#endif
-
-#if !defined(XRDP_MODULE_PATH)
-#define XRDP_MODULE_PATH "/usr/local/lib/xrdp"
-#endif
-
-#if !defined(XRDP_LOG_PATH)
-#define XRDP_LOG_PATH "/var/log"
-#endif
-
-#if !defined(XRDP_CHANSRV_STR)
-#define XRDP_CHANSRV_STR "/tmp/.xrdp/xrdp_chansrv_socket_%d"
-#endif
-
-#if !defined(CHANSRV_PORT_OUT_STR)
-#define CHANSRV_PORT_OUT_STR "/tmp/.xrdp/xrdp_chansrv_audio_out_socket_%d"
-#endif
-
-#if !defined(CHANSRV_PORT_IN_STR)
-#define CHANSRV_PORT_IN_STR "/tmp/.xrdp/xrdp_chansrv_audio_in_socket_%d"
-#endif
-
-#if !defined(CHANSRV_API_STR)
-#define CHANSRV_API_STR "/tmp/.xrdp/xrdpapi_%d"
-#endif
-
-#if !defined(XRDP_X11RDP_STR)
-#define XRDP_X11RDP_STR "/tmp/.xrdp/xrdp_display_%d"
-#endif
+#define XRDP_CHANSRV_STR XRDP_SOCKET_PATH "/xrdp_chansrv_socket_%d"
+#define CHANSRV_PORT_OUT_STR XRDP_SOCKET_PATH "/xrdp_chansrv_audio_out_socket_%d"
+#define CHANSRV_PORT_IN_STR XRDP_SOCKET_PATH "/xrdp_chansrv_audio_in_socket_%d"
+#define CHANSRV_API_STR XRDP_SOCKET_PATH "/xrdpapi_%d"
+#define XRDP_X11RDP_STR XRDP_SOCKET_PATH "/xrdp_display_%d"
+#define XRDP_DISCONNECT_STR XRDP_SOCKET_PATH "/xrdp_disconnect_display_%d"
#endif
diff --git a/common/os_calls.c b/common/os_calls.c
index f85e5d2e..a0d8ce1a 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -111,18 +111,19 @@ g_rm_temp_dir(void)
int
g_mk_temp_dir(const char *app_name)
{
- if (!g_directory_exist("/tmp/.xrdp"))
+ if (!g_directory_exist(XRDP_SOCKET_PATH))
{
- if (!g_create_dir("/tmp/.xrdp"))
+ if (!g_create_dir(XRDP_SOCKET_PATH))
{
/* if failed, still check if it got created by someone else */
- if (!g_directory_exist("/tmp/.xrdp"))
+ if (!g_directory_exist(XRDP_SOCKET_PATH))
{
- printf("g_mk_temp_dir: g_create_dir failed\n");
+ printf("g_mk_temp_dir: g_create_dir(%s) failed\n",
+ XRDP_SOCKET_PATH);
return 1;
}
}
- g_chmod_hex("/tmp/.xrdp", 0x1777);
+ g_chmod_hex(XRDP_SOCKET_PATH, 0x1777);
}
return 0;
}