summaryrefslogtreecommitdiffstats
path: root/sesman/chansrv
diff options
context:
space:
mode:
authorKoichiro IWAO <meta@vmeta.jp>2017-05-09 14:24:38 +0900
committermetalefty <meta@vmeta.jp>2017-05-16 10:41:06 +0900
commite1d11a74da97df1bc79e17d8992f3c04fd6c1606 (patch)
tree8db31ba67547c4866a5099157476a39b8bf6fb05 /sesman/chansrv
parent1acef2567c08b85cdf21fd708430606a70c28016 (diff)
downloadxrdp-proprietary-e1d11a74da97df1bc79e17d8992f3c04fd6c1606.tar.gz
xrdp-proprietary-e1d11a74da97df1bc79e17d8992f3c04fd6c1606.zip
pulse: respect XRDP_SOCKET_PATH environment variable
Diffstat (limited to 'sesman/chansrv')
-rw-r--r--sesman/chansrv/pulse/Makefile6
-rw-r--r--sesman/chansrv/pulse/module-xrdp-sink.c9
-rw-r--r--sesman/chansrv/pulse/module-xrdp-source.c9
3 files changed, 18 insertions, 6 deletions
diff --git a/sesman/chansrv/pulse/Makefile b/sesman/chansrv/pulse/Makefile
index f216f7aa..74977221 100644
--- a/sesman/chansrv/pulse/Makefile
+++ b/sesman/chansrv/pulse/Makefile
@@ -3,10 +3,8 @@
#
# change this to your pulseaudio source directory
-PULSE_DIR = /home/lk/pulseaudio-1.1
-# change this if you're using non-default socket directory
-SOCK_DIR = /tmp/.xrdp
-CFLAGS = -Wall -O2 -I$(PULSE_DIR) -I$(PULSE_DIR)/src -DHAVE_CONFIG_H -fPIC -DXRDP_SOCKET_PATH=\"$(SOCK_DIR)\"
+PULSE_DIR = /tmp/pulseaudio-10.0
+CFLAGS = -Wall -O2 -I$(PULSE_DIR) -I$(PULSE_DIR)/src -DHAVE_CONFIG_H -fPIC
all: module-xrdp-sink.so module-xrdp-source.so
diff --git a/sesman/chansrv/pulse/module-xrdp-sink.c b/sesman/chansrv/pulse/module-xrdp-sink.c
index 3e51940d..768b0795 100644
--- a/sesman/chansrv/pulse/module-xrdp-sink.c
+++ b/sesman/chansrv/pulse/module-xrdp-sink.c
@@ -292,6 +292,7 @@ static int lsend(int fd, char *data, int bytes) {
static int data_send(struct userdata *u, pa_memchunk *chunk) {
char *data;
+ char *socket_dir;
int bytes;
int sent;
int fd;
@@ -308,7 +309,13 @@ static int data_send(struct userdata *u, pa_memchunk *chunk) {
memset(&s, 0, sizeof(s));
s.sun_family = AF_UNIX;
bytes = sizeof(s.sun_path) - 1;
- snprintf(s.sun_path, bytes, CHANSRV_PORT_OUT_STR, u->display_num);
+ socket_dir = getenv("XRDP_SOCKET_PATH");
+ if (socket_dir == NULL || socket_dir[0] == '\0')
+ {
+ socket_dir = "/tmp/.xrdp";
+ }
+ snprintf(s.sun_path, bytes, "%s/" CHANSRV_PORT_OUT_BASE_STR,
+ socket_dir, u->display_num);
pa_log_debug("trying to connect to %s", s.sun_path);
if (connect(fd, (struct sockaddr *)&s,
sizeof(struct sockaddr_un)) != 0) {
diff --git a/sesman/chansrv/pulse/module-xrdp-source.c b/sesman/chansrv/pulse/module-xrdp-source.c
index 6aa73ecd..a7dd19c9 100644
--- a/sesman/chansrv/pulse/module-xrdp-source.c
+++ b/sesman/chansrv/pulse/module-xrdp-source.c
@@ -177,6 +177,7 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
int read_bytes;
struct sockaddr_un s;
char *data;
+ char *socket_dir;
char buf[11];
unsigned char ubuf[10];
@@ -186,7 +187,13 @@ static int data_get(struct userdata *u, pa_memchunk *chunk) {
memset(&s, 0, sizeof(s));
s.sun_family = AF_UNIX;
bytes = sizeof(s.sun_path) - 1;
- snprintf(s.sun_path, bytes, CHANSRV_PORT_IN_STR, u->display_num);
+ socket_dir = getenv("XRDP_SOCKET_PATH");
+ if (socket_dir == NULL || socket_dir[0] == '\0')
+ {
+ socket_dir = "/tmp/.xrdp";
+ }
+ snprintf(s.sun_path, bytes, "%s/" CHANSRV_PORT_IN_BASE_STR,
+ socket_dir, u->display_num);
pa_log_debug("Trying to connect to %s", s.sun_path);
if (connect(fd, (struct sockaddr *) &s, sizeof(struct sockaddr_un)) != 0) {