diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index d1735c70..cd1a6979 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -348,6 +348,8 @@ int g_directory_exist(const char* dirname); int g_chmod_hex(const char* filename, int flags); +const char * +g_socket_dir(void); void hexdump(unsigned char *p, unsigned int len); void diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index 7540e12e..7a1d444c 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -769,7 +769,8 @@ ddxGiveUp(void) { sprintf(unixSocketName, "/tmp/.X11-unix/X%s", display); unlink(unixSocketName); - sprintf(unixSocketName, "/tmp/.xrdp/xrdp_disconnect_display_%s", display); + sprintf(unixSocketName, "%s/xrdp_disconnect_display_%s", + g_socket_dir(), display); unlink(unixSocketName); if (g_uds_data[0] != 0) @@ -823,7 +824,7 @@ ddxUseMsg(void) ErrorF("X11rdp specific options\n"); ErrorF("-geometry WxH set framebuffer width & height\n"); ErrorF("-depth D set framebuffer depth\n"); - ErrorF("-uds create and listen on /tmp/.xrdp/xrdp_display_x\n"); + ErrorF("-uds create and listen on xrdp_display_x\n"); ErrorF("\n"); exit(1); } diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c index f8316ff8..4e0eca3c 100644 --- a/xorg/X11R7.6/rdp/rdpmisc.c +++ b/xorg/X11R7.6/rdp/rdpmisc.c @@ -517,6 +517,22 @@ g_chmod_hex(const char *filename, int flags) return chmod(filename, fl); } +/*****************************************************************************/ +/* returns directory where UNIX sockets are located */ +const char * +g_socket_dir(void) +{ + const char *socket_dir; + + socket_dir = getenv("XRDP_SOCKET_PATH"); + if (socket_dir == NULL || socket_dir[0] == '\0') + { + socket_dir = "/tmp/.xrdp"; + } + + return socket_dir; +} + /* produce a hex dump */ void hexdump(unsigned char *p, unsigned int len) diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 42435f8b..34b8cf45 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -1233,16 +1233,19 @@ rdpup_init(void) char text[256]; char *ptext; int i; + const char *socket_dir; - if (!g_directory_exist("/tmp/.xrdp")) + socket_dir = g_socket_dir(); + + if (!g_directory_exist(socket_dir)) { - if (!g_create_dir("/tmp/.xrdp")) + if (!g_create_dir(socket_dir)) { - LLOGLN(0, ("rdpup_init: g_create_dir failed")); + LLOGLN(0, ("rdpup_init: g_create_dir(%s) failed", socket_dir)); return 0; } - g_chmod_hex("/tmp/.xrdp", 0x1777); + g_chmod_hex(socket_dir, 0x1777); } i = atoi(display); @@ -1266,7 +1269,7 @@ rdpup_init(void) if (g_use_uds) { - g_sprintf(g_uds_data, "/tmp/.xrdp/xrdp_display_%s", display); + g_sprintf(g_uds_data, "%s/xrdp_display_%s", socket_dir, display); if (g_listen_sck == 0) { @@ -1304,7 +1307,7 @@ rdpup_init(void) if (g_dis_listen_sck != 0) { - g_sprintf(text, "/tmp/.xrdp/xrdp_disconnect_display_%s", display); + g_sprintf(text, "%s/xrdp_disconnect_display_%s", socket_dir, display); if (g_tcp_local_bind(g_dis_listen_sck, text) == 0) {