summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c18
-rw-r--r--common/os_calls.h6
-rw-r--r--common/xrdp_client_info.h1
-rw-r--r--configure.ac11
-rw-r--r--docs/man/xrdp.ini.54
-rw-r--r--libxrdp/xrdp_sec.c58
-rw-r--r--sesman/chansrv/Makefile.am5
-rw-r--r--sesman/chansrv/chansrv_fuse.c5
-rw-r--r--sesman/chansrv/clipboard_file.c6
-rw-r--r--sesman/chansrv/sound.c219
-rw-r--r--sesman/chansrv/wave-format-server.txt467
-rw-r--r--sesman/env.c47
-rw-r--r--sesman/env.h2
-rw-r--r--sesman/session.c51
-rw-r--r--xorg/X11R7.6/rdp/rdprandr.c2
-rw-r--r--xorg/X11R7.6/xkeyboard-config-2.0.patch88
-rw-r--r--xrdp/xrdp_keyboard.ini2
-rw-r--r--xrdp/xrdp_login_wnd.c34
-rw-r--r--xrdp/xrdp_wm.c21
19 files changed, 942 insertions, 105 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index dbef8da6..2c8e37cd 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -207,14 +207,17 @@ g_sprintf(char *dest, const char *format, ...)
}
/*****************************************************************************/
-void DEFAULT_CC
+int DEFAULT_CC
g_snprintf(char *dest, int len, const char *format, ...)
{
+ int err;
va_list ap;
va_start(ap, format);
- vsnprintf(dest, len, format, ap);
+ err = vsnprintf(dest, len, format, ap);
va_end(ap);
+
+ return err;
}
/*****************************************************************************/
@@ -2995,10 +2998,11 @@ g_sigterm(int pid)
/*****************************************************************************/
/* returns 0 if ok */
+/* the caller is responsible to free the buffs */
/* does not work in win32 */
int APP_CC
-g_getuser_info(const char *username, int *gid, int *uid, char *shell,
- char *dir, char *gecos)
+g_getuser_info(const char *username, int *gid, int *uid, char **shell,
+ char **dir, char **gecos)
{
#if defined(_WIN32)
return 1;
@@ -3021,17 +3025,17 @@ g_getuser_info(const char *username, int *gid, int *uid, char *shell,
if (dir != 0)
{
- g_strcpy(dir, pwd_1->pw_dir);
+ *dir = g_strdup(pwd_1->pw_dir);
}
if (shell != 0)
{
- g_strcpy(shell, pwd_1->pw_shell);
+ *shell = g_strdup(pwd_1->pw_shell);
}
if (gecos != 0)
{
- g_strcpy(gecos, pwd_1->pw_gecos);
+ *gecos = g_strdup(pwd_1->pw_gecos);
}
return 0;
diff --git a/common/os_calls.h b/common/os_calls.h
index 2ed2cb81..9f0e61fb 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -61,7 +61,7 @@ void APP_CC g_free(void* ptr);
void DEFAULT_CC g_printf(const char *format, ...) printflike(1, 2);
void DEFAULT_CC g_sprintf(char* dest, const char* format, ...) \
printflike(2, 3);
-void DEFAULT_CC g_snprintf(char* dest, int len, const char* format, ...) \
+int DEFAULT_CC g_snprintf(char* dest, int len, const char* format, ...) \
printflike(3, 4);
void DEFAULT_CC g_writeln(const char* format, ...) printflike(1, 2);
void DEFAULT_CC g_write(const char* format, ...) printflike(1, 2);
@@ -179,8 +179,8 @@ char* APP_CC g_getenv(const char* name);
int APP_CC g_exit(int exit_code);
int APP_CC g_getpid(void);
int APP_CC g_sigterm(int pid);
-int APP_CC g_getuser_info(const char* username, int* gid, int* uid, char* shell,
- char* dir, char* gecos);
+int APP_CC g_getuser_info(const char* username, int* gid, int* uid, char** shell,
+ char** dir, char** gecos);
int APP_CC g_getgroup_info(const char* groupname, int* gid);
int APP_CC g_check_user_in_group(const char* username, int gid, int* ok);
int APP_CC g_time1(void);
diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h
index d1ce1e1e..f003ee2a 100644
--- a/common/xrdp_client_info.h
+++ b/common/xrdp_client_info.h
@@ -110,6 +110,7 @@ struct xrdp_client_info
int multimon; /* 0 = deny , 1 = allow */
int monitorCount; /* number of monitors detected (max = 16) */
struct monitor_info minfo[16]; /* client monitor data */
+ struct monitor_info minfo_wm[16]; /* client monitor data, non-negative values */
int keyboard_type;
int keyboard_subtype;
diff --git a/configure.ac b/configure.ac
index 50eff683..ac1d0ada 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,10 @@ AC_ARG_ENABLE(opus, AS_HELP_STRING([--enable-opus],
[Build opus(audio codec) (default: no)]),
[], [enable_opus=no])
AM_CONDITIONAL(XRDP_OPUS, [test x$enable_opus = xyes])
+AC_ARG_ENABLE(mp3lame, AS_HELP_STRING([--enable-mp3lame],
+ [Build lame mp3(audio codec) (default: no)]),
+ [], [enable_mp3lame=no])
+AM_CONDITIONAL(XRDP_MP3LAME, [test x$enable_mp3lame = xyes])
# checking for openssl
AC_CHECK_HEADER([openssl/rc4.h], [],
@@ -179,6 +183,13 @@ then
[AC_MSG_ERROR([please install libopus-dev or opus-devel])])
fi
+# checking for lame mp3
+if test "x$enable_mp3lame" = "xyes"
+then
+ AC_CHECK_HEADER([lame/lame.h], [],
+ [AC_MSG_ERROR([please install libmp3lame-dev or lamemp3-devel])])
+fi
+
# checking for TurboJPEG
if test "x$enable_tjpeg" = "xyes"
then
diff --git a/docs/man/xrdp.ini.5 b/docs/man/xrdp.ini.5
index 131c0796..8e6969cd 100644
--- a/docs/man/xrdp.ini.5
+++ b/docs/man/xrdp.ini.5
@@ -215,6 +215,10 @@ Specifies the ip address of the host to connect to.
\fBport\fR=\fI<number>\fR|\fI\-1\fR
Specifies the port number to connect to. If set to \fI\-1\fR, the default port for the specified library is used.
+.TP
+\fBcode\fR=\fI<number>\fR|\fI\-1\fR
+Specifies the session type, the default, \fI\0\fR, is Xvnc, \fI\10\fR, is X11rdp, and \fI\20\fR, uses Xorg driver mode.
+
.SH "EXAMPLES"
This is an example \fBxrdp.ini\fR:
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index 3857e2d1..af0cedf2 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -1873,15 +1873,16 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
int y1;
int x2;
int y2;
+ int got_primary;
struct xrdp_client_info *client_info = (struct xrdp_client_info *)NULL;
client_info = &(self->rdp_layer->client_info);
- DEBUG(("processing monitors data, allow_multimon is %d", client_info->multimon));
+ LLOGLN(10, ("xrdp_sec_process_mcs_data_monitors: processing monitors data, allow_multimon is %d", client_info->multimon));
/* this is an option set in xrdp.ini */
if (client_info->multimon != 1) /* are multi-monitors allowed ? */
{
- DEBUG(("[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not "
+ LLOGLN(0, ("[INFO] xrdp_sec_process_mcs_data_monitors: multimon is not "
"allowed, skipping"));
return 0;
}
@@ -1889,7 +1890,7 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
//verify flags - must be 0x0
if (flags != 0)
{
- DEBUG(("[ERROR] xrdp_sec_process_mcs_data_monitors: flags MUST be "
+ LLOGLN(0, ("[ERROR] xrdp_sec_process_mcs_data_monitors: flags MUST be "
"zero, detected: %d", flags));
return 1;
}
@@ -1897,12 +1898,12 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
//verify monitorCount - max 16
if (monitorCount > 16)
{
- DEBUG(("[ERROR] xrdp_sec_process_mcs_data_monitors: max allowed "
+ LLOGLN(0, ("[ERROR] xrdp_sec_process_mcs_data_monitors: max allowed "
"monitors is 16, detected: %d", monitorCount));
return 1;
}
- g_writeln("monitorCount= %d", monitorCount); // for debugging only
+ LLOGLN(10, ("xrdp_sec_process_mcs_data_monitors: monitorCount= %d", monitorCount));
client_info->monitorCount = monitorCount;
@@ -1910,6 +1911,7 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
y1 = 0;
x2 = 0;
y2 = 0;
+ got_primary = 0;
/* Add client_monitor_data to client_info struct, will later pass to X11rdp */
for (index = 0; index < monitorCount; index++)
{
@@ -1933,15 +1935,57 @@ xrdp_sec_process_mcs_data_monitors(struct xrdp_sec *self, struct stream *s)
y2 = MAX(y2, client_info->minfo[index].bottom);
}
- g_writeln("got a monitor: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d", client_info->minfo[index].left,
- client_info->minfo[index].top, client_info->minfo[index].right, client_info->minfo[index].bottom, client_info->minfo[index].is_primary);
+ if (client_info->minfo[index].is_primary)
+ {
+ got_primary = 1;
+ }
+
+ LLOGLN(10, ("xrdp_sec_process_mcs_data_monitors: got a monitor [%d]: left= %d, top= %d, right= %d, bottom= %d, is_primary?= %d",
+ index,
+ client_info->minfo[index].left,
+ client_info->minfo[index].top,
+ client_info->minfo[index].right,
+ client_info->minfo[index].bottom,
+ client_info->minfo[index].is_primary));
}
+ if (!got_primary)
+ {
+ /* no primary monitor was set, choose the leftmost monitor as primary */
+ for (index = 0; index < monitorCount; index++)
+ {
+ if (client_info->minfo[index].left == x1 &&
+ client_info->minfo[index].top == y1)
+ {
+ client_info->minfo[index].is_primary = 1;
+ break;
+ }
+ }
+ }
+
+ /* set wm geometry */
if ((x2 > x1) && (y2 > y1))
{
client_info->width = (x2 - x1) + 1;
client_info->height = (y2 - y1) + 1;
}
+ /* make sure virtual desktop size is ok */
+ if (client_info->width > 0x7FFE || client_info->width < 0xC8 ||
+ client_info->height > 0x7FFE || client_info->height < 0xC8)
+ {
+ LLOGLN(0, ("[ERROR] xrdp_sec_process_mcs_data_monitors: error, virtual desktop width / height is too large"));
+ return 1; /* error */
+ }
+
+ /* keep a copy of non negative monitor info values for xrdp_wm usage */
+ for (index = 0; index < monitorCount; index++)
+ {
+ client_info->minfo_wm[index].left = client_info->minfo[index].left - x1;
+ client_info->minfo_wm[index].top = client_info->minfo[index].top - y1;
+ client_info->minfo_wm[index].right = client_info->minfo[index].right - x1;
+ client_info->minfo_wm[index].bottom = client_info->minfo[index].bottom - y1;
+ client_info->minfo_wm[index].is_primary = client_info->minfo[index].is_primary;
+ }
return 0;
}
diff --git a/sesman/chansrv/Makefile.am b/sesman/chansrv/Makefile.am
index 45597e12..c4cd1a3f 100644
--- a/sesman/chansrv/Makefile.am
+++ b/sesman/chansrv/Makefile.am
@@ -13,6 +13,11 @@ EXTRA_DEFINES += -DXRDP_OPUS
EXTRA_LIBS += -lopus
endif
+if XRDP_MP3LAME
+EXTRA_DEFINES += -DXRDP_MP3LAME
+EXTRA_LIBS += -lmp3lame
+endif
+
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index 0bb9ceff..80bde674 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -780,6 +780,11 @@ int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex)
2, /* parent inode */
filename,
S_IFREG);
+ if (xinode == NULL)
+ {
+ log_debug("failed to create file in xrdp filesystem");
+ return -1;
+ }
xinode->size = size;
xinode->lindex = lindex;
xinode->is_loc_resource = 1;
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 562ee82d..8c2f2189 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -660,7 +660,11 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
"supported [%s]", cfd->cFileName);
continue;
}
- xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex);
+ if (xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex) == -1)
+ {
+ log_error("clipboard_c2s_in_files: failed to add clip dir item");
+ continue;
+ }
if (file_count > 0)
{
diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c
index 66108651..e2b6f53b 100644
--- a/sesman/chansrv/sound.c
+++ b/sesman/chansrv/sound.c
@@ -35,6 +35,11 @@
static OpusEncoder *g_opus_encoder = 0;
#endif
+#if defined(XRDP_MP3LAME)
+#include <lame/lame.h>
+static lame_global_flags *g_lame_encoder = 0;
+#endif
+
extern int g_rdpsnd_chan_id; /* in chansrv.c */
extern int g_display_num; /* in chansrv.c */
@@ -72,12 +77,12 @@ struct xr_wave_format_ex
int nBlockAlign;
int wBitsPerSample;
int cbSize;
- char *data;
+ tui8 *data;
};
/* output formats */
-static char g_pcm_22050_data[] = { 0 };
+static tui8 g_pcm_22050_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_22050 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -90,7 +95,7 @@ static struct xr_wave_format_ex g_pcm_22050 =
g_pcm_22050_data /* data */
};
-static char g_pcm_44100_data[] = { 0 };
+static tui8 g_pcm_44100_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_44100 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -104,7 +109,7 @@ static struct xr_wave_format_ex g_pcm_44100 =
};
#if defined(XRDP_OPUS)
-static char g_opus_44100_data[] = { 0 };
+static tui8 g_opus_44100_data[] = { 0 };
static struct xr_wave_format_ex g_opus_44100 =
{
0x0069, /* wFormatTag - WAVE_FORMAT_OPUS */
@@ -118,27 +123,40 @@ static struct xr_wave_format_ex g_opus_44100 =
};
#endif
-
-#if defined(XRDP_OPUS)
-#define SND_NUM_OUTP_FORMATS 3
-static struct xr_wave_format_ex *g_wave_outp_formats[SND_NUM_OUTP_FORMATS] =
+#if defined(XRDP_MP3LAME)
+static tui8 g_mp3lame_44100_data[] = { 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x01, 0x00, 0x71, 0x05 };
+static struct xr_wave_format_ex g_mp3lame_44100 =
{
- &g_pcm_44100,
- &g_pcm_22050,
- &g_opus_44100
+ 0x0055, /* wFormatTag - WAVE_FORMAT_MPEGLAYER3 */
+ 2, /* num of channels */
+ 44100, /* samples per sec */
+ 176400, /* avg bytes per sec */
+ 4, /* block align */
+ 0, /* bits per sample */
+ 12, /* data size */
+ g_mp3lame_44100_data /* data */
};
-#else
-#define SND_NUM_OUTP_FORMATS 2
-static struct xr_wave_format_ex *g_wave_outp_formats[SND_NUM_OUTP_FORMATS] =
+#endif
+
+static struct xr_wave_format_ex *g_wave_outp_formats[] =
{
&g_pcm_44100,
- &g_pcm_22050
-};
+ &g_pcm_22050,
+#if defined(XRDP_OPUS)
+ &g_opus_44100,
+#endif
+#if defined(XRDP_MP3LAME)
+ &g_mp3lame_44100,
#endif
+ 0
+};
static int g_client_does_opus = 0;
static int g_client_opus_index = 0;
+static int g_client_does_mp3lame = 0;
+static int g_client_mp3lame_index = 0;
+
/* index into list from client */
static int g_current_client_format_index = 0;
@@ -147,7 +165,7 @@ static int g_current_server_format_index = 0;
/* input formats */
-static char g_pcm_inp_22050_data[] = { 0 };
+static tui8 g_pcm_inp_22050_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_inp_22050 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -160,7 +178,7 @@ static struct xr_wave_format_ex g_pcm_inp_22050 =
g_pcm_inp_22050_data /* data */
};
-static char g_pcm_inp_44100_data[] = { 0 };
+static tui8 g_pcm_inp_44100_data[] = { 0 };
static struct xr_wave_format_ex g_pcm_inp_44100 =
{
1, /* wFormatTag - WAVE_FORMAT_PCM */
@@ -173,11 +191,11 @@ static struct xr_wave_format_ex g_pcm_inp_44100 =
g_pcm_inp_44100_data /* data */
};
-#define SND_NUM_INP_FORMATS 2
-static struct xr_wave_format_ex *g_wave_inp_formats[SND_NUM_INP_FORMATS] =
+static struct xr_wave_format_ex *g_wave_inp_formats[] =
{
&g_pcm_inp_44100,
- &g_pcm_inp_22050
+ &g_pcm_inp_22050,
+ 0
};
static int g_client_input_format_index = 0;
@@ -204,8 +222,13 @@ sound_send_server_output_formats(void)
struct stream *s;
int bytes;
int index;
+ int num_formats;
char *size_ptr;
+ num_formats = sizeof(g_wave_outp_formats) /
+ sizeof(g_wave_outp_formats[0]) - 1;
+ LOG(10, ("sound_send_server_output_formats: num_formats %d", num_formats));
+
make_stream(s);
init_stream(s, 8182);
out_uint16_le(s, SNDC_FORMATS);
@@ -215,9 +238,9 @@ sound_send_server_output_formats(void)
out_uint32_le(s, 0); /* dwVolume */
out_uint32_le(s, 0); /* dwPitch */
out_uint16_le(s, 0); /* wDGramPort */
- out_uint16_le(s, SND_NUM_OUTP_FORMATS); /* wNumberOfFormats */
+ out_uint16_le(s, num_formats); /* wNumberOfFormats */
out_uint8(s, g_cBlockNo); /* cLastBlockConfirmed */
- out_uint16_le(s, 2); /* wVersion */
+ out_uint16_le(s, 5); /* wVersion */
out_uint8(s, 0); /* bPad */
/* sndFormats */
@@ -239,7 +262,7 @@ sound_send_server_output_formats(void)
00 00
*/
- for (index = 0; index < SND_NUM_OUTP_FORMATS; index++)
+ for (index = 0; index < num_formats; index++)
{
out_uint16_le(s, g_wave_outp_formats[index]->wFormatTag);
out_uint16_le(s, g_wave_outp_formats[index]->nChannels);
@@ -341,10 +364,18 @@ sound_process_output_format(int aindex, int wFormatTag, int nChannels,
if (wFormatTag == 0x0069)
{
+ LOG(0, ("wFormatTag, opus"));
g_client_does_opus = 1;
g_client_opus_index = aindex;
g_bbuf_size = 11520;
}
+ else if (wFormatTag == 0x0055)
+ {
+ LOG(0, ("wFormatTag, mp3"));
+ g_client_does_mp3lame = 1;
+ g_client_mp3lame_index = aindex;
+ g_bbuf_size = 11520;
+ }
return 0;
}
@@ -403,7 +434,7 @@ sound_process_output_formats(struct stream *s, int size)
/*****************************************************************************/
static int
-sound_wave_compress(char *data, int data_bytes, int *format_index)
+sound_wave_compress_opus(char *data, int data_bytes, int *format_index)
{
unsigned char *cdata;
int cdata_bytes;
@@ -428,7 +459,7 @@ sound_wave_compress(char *data, int data_bytes, int *format_index)
&error);
if (g_opus_encoder == 0)
{
- LOG(0, ("sound_wave_compress: opus_encoder_create failed"));
+ LOG(0, ("sound_wave_compress_opus: opus_encoder_create failed"));
return data_bytes;
}
}
@@ -465,7 +496,95 @@ sound_wave_compress(char *data, int data_bytes, int *format_index)
/*****************************************************************************/
static int
-sound_wave_compress(char *data, int data_bytes, int *format_index)
+sound_wave_compress_opus(char *data, int data_bytes, int *format_index)
+{
+ return data_bytes;
+}
+
+#endif
+
+#if defined(XRDP_MP3LAME)
+
+/*****************************************************************************/
+static int
+sound_wave_compress_mp3lame(char *data, int data_bytes, int *format_index)
+{
+ int rv;
+ int cdata_bytes;
+ int odata_bytes;
+ unsigned char *cdata;
+
+ cdata = NULL;
+ rv = data_bytes;
+
+ if (g_client_does_mp3lame == 0)
+ {
+ return rv;
+ }
+
+ if (g_lame_encoder == 0)
+ {
+ /* init mp3 lame encoder */
+ LOG(0, ("sound_wave_compress_mp3lame: using mp3lame"));
+
+ g_lame_encoder = lame_init();
+ if (g_lame_encoder == 0)
+ {
+ LOG(0, ("sound_wave_compress_mp3lame: lame_init() failed"));
+ return rv;
+ }
+ lame_set_num_channels(g_lame_encoder, g_mp3lame_44100.nChannels);
+ lame_set_in_samplerate(g_lame_encoder, g_mp3lame_44100.nSamplesPerSec);
+ if (lame_init_params(g_lame_encoder) == -1)
+ {
+ LOG(0, ("sound_wave_compress_mp3lame: lame_init_params() failed"));
+ return rv;
+ }
+
+ LOG(0, ("sound_wave_compress_mp3lame: lame config:"));
+ LOG(0, (" brate : %d", lame_get_brate(g_lame_encoder)));
+ LOG(0, (" compression ratio: %f", lame_get_compression_ratio(g_lame_encoder)));
+ LOG(0, (" encoder delay : %d", lame_get_encoder_delay(g_lame_encoder)));
+ LOG(0, (" frame size : %d", lame_get_framesize(g_lame_encoder)));
+ LOG(0, (" encoder padding : %d", lame_get_encoder_padding(g_lame_encoder)));
+ LOG(0, (" mode : %d", lame_get_mode(g_lame_encoder)));
+ }
+
+ odata_bytes = data_bytes;
+ cdata_bytes = data_bytes;
+ cdata = (unsigned char *) g_malloc(cdata_bytes, 0);
+ if (data_bytes < g_bbuf_size)
+ {
+ g_memset(data + data_bytes, 0, g_bbuf_size - data_bytes);
+ data_bytes = g_bbuf_size;
+ }
+ cdata_bytes = lame_encode_buffer_interleaved(g_lame_encoder,
+ (short int *) data,
+ data_bytes / 4,
+ cdata,
+ cdata_bytes);
+ if (cdata_bytes < 0)
+ {
+ LOG(0, ("sound_wave_compress: lame_encode_buffer_interleaved() "
+ "failed, error %d", cdata_bytes));
+ return rv;
+ }
+ if ((cdata_bytes > 0) && (cdata_bytes < odata_bytes))
+ {
+ *format_index = g_client_mp3lame_index;
+ g_memcpy(data, cdata, cdata_bytes);
+ rv = cdata_bytes;
+ }
+
+ g_free(cdata);
+ return rv;
+}
+
+#else
+
+/*****************************************************************************/
+static int
+sound_wave_compress_mp3lame(char *data, int data_bytes, int *format_index)
{
return data_bytes;
}
@@ -473,6 +592,21 @@ sound_wave_compress(char *data, int data_bytes, int *format_index)
#endif
/*****************************************************************************/
+static int
+sound_wave_compress(char *data, int data_bytes, int *format_index)
+{
+ if (g_client_does_opus)
+ {
+ return sound_wave_compress_opus(data, data_bytes, format_index);
+ }
+ else if (g_client_does_mp3lame)
+ {
+ return sound_wave_compress_mp3lame(data, data_bytes, format_index);
+ }
+ return data_bytes;
+}
+
+/*****************************************************************************/
/* send wave message to client */
static int
sound_send_wave_data_chunk(char *data, int data_bytes)
@@ -820,6 +954,9 @@ sound_init(void)
g_client_does_opus = 0;
g_client_opus_index = 0;
+ g_client_does_mp3lame = 0;
+ g_client_mp3lame_index = 0;
+
return 0;
}
@@ -852,6 +989,15 @@ sound_deinit(void)
g_audio_c_trans_in = 0;
}
+#if defined(XRDP_MP3LAME)
+ if (g_lame_encoder)
+ {
+ lame_close(g_lame_encoder);
+ g_lame_encoder = 0;
+ g_client_does_mp3lame = 0;
+ }
+#endif
+
fifo_deinit(&g_in_fifo);
return 0;
@@ -1014,10 +1160,15 @@ sound_check_wait_objs(void)
static int APP_CC
sound_send_server_input_formats(void)
{
- struct stream* s;
- int bytes;
- int index;
- char* size_ptr;
+ struct stream *s;
+ int bytes;
+ int index;
+ int num_formats;
+ char *size_ptr;
+
+ num_formats = sizeof(g_wave_inp_formats) /
+ sizeof(g_wave_inp_formats[0]) - 1;
+ LOG(10, ("sound_send_server_input_formats: num_formats %d", num_formats));
make_stream(s);
init_stream(s, 8182);
@@ -1026,8 +1177,8 @@ sound_send_server_input_formats(void)
out_uint16_le(s, 0); /* size, set later */
out_uint32_le(s, 0); /* unused */
out_uint32_le(s, 0); /* unused */
- out_uint16_le(s, SND_NUM_INP_FORMATS); /* wNumberOfFormats */
- out_uint16_le(s, 2); /* wVersion */
+ out_uint16_le(s, num_formats); /* wNumberOfFormats */
+ out_uint16_le(s, 5); /* wVersion */
/*
wFormatTag 2 byte offset 0
@@ -1040,7 +1191,7 @@ sound_send_server_input_formats(void)
data variable offset 18
*/
- for (index = 0; index < SND_NUM_INP_FORMATS; index++)
+ for (index = 0; index < num_formats; index++)
{
out_uint16_le(s, g_wave_inp_formats[index]->wFormatTag);
out_uint16_le(s, g_wave_inp_formats[index]->nChannels);
diff --git a/sesman/chansrv/wave-format-server.txt b/sesman/chansrv/wave-format-server.txt
index 1d0bb91e..3a197a71 100644
--- a/sesman/chansrv/wave-format-server.txt
+++ b/sesman/chansrv/wave-format-server.txt
@@ -464,3 +464,470 @@ wFormatTag=353 nChannels=1 nSamplesPerSec=8000 nAvgBytesPerSec=750 nBlockAlign=4
?
wFormatTag=66 nChannels=1 nSamplesPerSec=8000 nAvgBytesPerSec=666 nBlockAlign=20 wBitsPerSample=0 cbSize=10
0000 03 00 ce 9a 32 f7 a2 ae de ac ....2.....
+
+
+
+//***************************************************************
+// Windows 7 SP1 x64 Server Formats
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 176400 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44359 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44251 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22179 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22125 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 8957 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+
+//***************************************************************
+// Windows 10 10586 x64 Server Formats
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 24000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 20000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 16000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 12000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 176400 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44359 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44251 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22179 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22125 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 8957 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+
+//***************************************************************
+// Windows Server 2016 TP4 x64 Server Formats
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 24000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 20000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 16000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_AAC_MS:
+wFormatTag: 0xA106 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 12000 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 176400 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44359 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 44100 nAvgBytesPerSec: 44251 nBlockAlign: 2048 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22179 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 22125 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 44100 nAvgBytesPerSec: 8957 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+
+
+
+
+//***************************************************************
+// Windows XP SP3 x86 Server Formats
+WAVE_FORMAT_PCM:
+wFormatTag: 0x0001 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 88200 nBlockAlign: 4 wBitsPerSample: 16 cbSize: 0
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 44100 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22311 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 22201 nBlockAlign: 1024 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 22050 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 22050 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 22050 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 22050 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 16000 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 16000 nBlockAlign: 2 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11289 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 11177 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11155 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 11100 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 11025 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 11025 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8192 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 8110 nBlockAlign: 512 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_ALAW:
+wFormatTag: 0x0006 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 8000 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MULAW:
+wFormatTag: 0x0007 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 8000 nBlockAlign: 1 wBitsPerSample: 8 cbSize: 0
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 7000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 7000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 6000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 6000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5644 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 5588 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 5000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 5000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4478 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_ADPCM:
+wFormatTag: 0x0002 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4096 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 32
+
+WAVE_FORMAT_DVI_ADPCM:
+wFormatTag: 0x0011 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 4055 nBlockAlign: 256 wBitsPerSample: 4 cbSize: 2
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 4005 nBlockAlign: 186 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 16000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 4000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 3000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 22050 nAvgBytesPerSec: 2519 nBlockAlign: 117 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 2 nSamplesPerSec: 22050 nAvgBytesPerSec: 2519 nBlockAlign: 117 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2500 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 12000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 11025 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2250 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2239 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2000 nBlockAlign: 64 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 16000 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 2000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_GSM610:
+wFormatTag: 0x0031 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1625 nBlockAlign: 65 wBitsPerSample: 0 cbSize: 2
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 2 nSamplesPerSec: 8000 nAvgBytesPerSec: 1500 nBlockAlign: 96 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 1249 nBlockAlign: 58 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_DSPGROUP_TRUESPEECH :
+wFormatTag: 0x0022 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1067 nBlockAlign: 32 wBitsPerSample: 1 cbSize: 32
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 1012 nBlockAlign: 47 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1000 nBlockAlign: 64 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 12000 nAvgBytesPerSec: 1000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 11025 nAvgBytesPerSec: 1000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MPEGLAYER3:
+wFormatTag: 0x0055 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 1000 nBlockAlign: 1 wBitsPerSample: 0 cbSize: 12
+
+WAVE_FORMAT_MSG723:
+wFormatTag: 0x0042 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 800 nBlockAlign: 24 wBitsPerSample: 0 cbSize: 10
+
+WAVE_FORMAT_WMAUDIO2:
+wFormatTag: 0x0161 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 750 nBlockAlign: 48 wBitsPerSample: 16 cbSize: 47
+
+WAVE_FORMAT_MSG723:
+wFormatTag: 0x0042 nChannels: 1 nSamplesPerSec: 8000 nAvgBytesPerSec: 666 nBlockAlign: 20 wBitsPerSample: 0 cbSize: 10
+
diff --git a/sesman/env.c b/sesman/env.c
index 6bad2c4f..d8bb1e98 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -81,8 +81,9 @@ env_check_password_file(char *filename, char *passwd)
}
/******************************************************************************/
+/* its the responsibility of the caller to free passwd_file */
int DEFAULT_CC
-env_set_user(char *username, char *passwd_file, int display,
+env_set_user(char *username, char **passwd_file, int display,
struct list *env_names, struct list* env_values)
{
int error;
@@ -90,15 +91,17 @@ env_set_user(char *username, char *passwd_file, int display,
int pw_gid;
int uid;
int index;
+ int len;
char *name;
char *value;
- char pw_shell[256];
- char pw_dir[256];
- char pw_gecos[256];
+ char *pw_shell;
+ char *pw_dir;
char text[256];
- error = g_getuser_info(username, &pw_gid, &pw_uid, pw_shell, pw_dir,
- pw_gecos);
+ pw_shell = 0;
+ pw_dir = 0;
+
+ error = g_getuser_info(username, &pw_gid, &pw_uid, &pw_shell, &pw_dir, 0);
if (error == 0)
{
@@ -147,28 +150,48 @@ env_set_user(char *username, char *passwd_file, int display,
if (0 == g_cfg->auth_file_path)
{
/* if no auth_file_path is set, then we go for
- $HOME/.vnc/sesman_username_passwd */
+ $HOME/.vnc/sesman_username_passwd */
if (g_mkdir(".vnc") < 0)
{
log_message(LOG_LEVEL_ERROR,
- "env_set_user: error creating .vnc dir");
+ "env_set_user: error creating .vnc dir");
+ }
+
+ len = g_snprintf(NULL, 0, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
+
+ *passwd_file = (char *) g_malloc(len + 1, 1);
+ if (*passwd_file != NULL)
+ {
+ g_sprintf(*passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
}
- g_sprintf(passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
}
else
{
/* we use auth_file_path as requested */
- g_sprintf(passwd_file, g_cfg->auth_file_path, username);
+ len = g_snprintf(NULL, 0, g_cfg->auth_file_path, username);
+
+ *passwd_file = (char *) g_malloc(len + 1, 1);
+ if (*passwd_file != NULL)
+ {
+ g_sprintf(*passwd_file, g_cfg->auth_file_path, username);
+ }
}
- LOG_DBG("pass file: %s", passwd_file);
+ if (*passwd_file != NULL)
+ {
+ LOG_DBG("pass file: %s", *passwd_file);
+ }
}
+
+ g_free(pw_dir);
+ g_free(pw_shell);
}
}
else
{
log_message(LOG_LEVEL_ERROR,
- "error getting user info for user %s", username);
+ "error getting user info for user %s",
+ username);
}
return error;
diff --git a/sesman/env.h b/sesman/env.h
index 378e7fd1..23828080 100644
--- a/sesman/env.h
+++ b/sesman/env.h
@@ -50,7 +50,7 @@ env_check_password_file(char* filename, char* password);
*
*/
int DEFAULT_CC
-env_set_user(char* username, char* passwd_file, int display,
+env_set_user(char* username, char** passwd_file, int display,
struct list *env_names, struct list* env_values);
#endif
diff --git a/sesman/session.c b/sesman/session.c
index 02bb6fa7..ebd7e382 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -284,8 +284,11 @@ session_start_sessvc(int xpid, int wmpid, long data, char *username, int display
list_add_item(sessvc_params, (tintptr)g_strdup(wmpid_str));
list_add_item(sessvc_params, 0); /* mandatory */
- env_set_user(username, 0, display,
- g_cfg->session_variables1, g_cfg->session_variables2);
+ env_set_user(username,
+ 0,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
/* executing sessvc */
g_execvp(exe_path, ((char **)sessvc_params->items));
@@ -412,19 +415,18 @@ session_start_fork(int width, int height, int bpp, char *username,
int pampid = 0;
int xpid = 0;
int i = 0;
- char *xserver; /* absolute/relative path to Xorg/X11rdp/Xvnc */
char geometry[32];
char depth[32];
char screen[32]; /* display number */
char text[256];
- char passwd_file[256];
- char *pfile;
+ char execvpparams[2048];
+ char *xserver; /* absolute/relative path to Xorg/X11rdp/Xvnc */
+ char *passwd_file;
char **pp1 = (char **)NULL;
struct session_chain *temp = (struct session_chain *)NULL;
struct list *xserver_params = (struct list *)NULL;
- time_t ltime;
struct tm stime;
- char execvpparams[2048];
+ time_t ltime;
/* initialize (zero out) local variables: */
g_memset(&ltime, 0, sizeof(time_t));
@@ -433,7 +435,8 @@ session_start_fork(int width, int height, int bpp, char *username,
g_memset(depth, 0, sizeof(char) * 32);
g_memset(screen, 0, sizeof(char) * 32);
g_memset(text, 0, sizeof(char) * 256);
- g_memset(passwd_file, 0, sizeof(char) * 256);
+
+ passwd_file = 0;
/* check to limit concurrent sessions */
if (g_session_count >= g_cfg->sess.max_sessions)
@@ -537,7 +540,9 @@ session_start_fork(int width, int height, int bpp, char *username,
}
else if (pampid == 0)
{
- env_set_user(username, 0, display,
+ env_set_user(username,
+ 0,
+ display,
g_cfg->session_variables1,
g_cfg->session_variables2);
if (x_server_running(display))
@@ -632,14 +637,23 @@ session_start_fork(int width, int height, int bpp, char *username,
}
else if (xpid == 0) /* child */
{
- pfile = 0;
if (type == SESMAN_SESSION_TYPE_XVNC)
{
- pfile = passwd_file;
+ env_set_user(username,
+ &passwd_file,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
}
- env_set_user(username, pfile, display,
- g_cfg->session_variables1,
- g_cfg->session_variables2);
+ else
+ {
+ env_set_user(username,
+ 0,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
+ }
+
g_snprintf(text, 255, "%d", g_cfg->sess.max_idle_time);
g_setenv("XRDP_SESMAN_MAX_IDLE_TIME", text, 1);
@@ -701,6 +715,8 @@ session_start_fork(int width, int height, int bpp, char *username,
list_add_item(xserver_params, (tintptr)g_strdup("-rfbauth"));
list_add_item(xserver_params, (tintptr)g_strdup(passwd_file));
+ g_free(passwd_file);
+
/* additional parameters from sesman.ini file */
//config_read_xserver_params(SESMAN_SESSION_TYPE_XVNC,
// xserver_params);
@@ -829,8 +845,11 @@ session_reconnect_fork(int display, char *username)
}
else if (pid == 0)
{
- env_set_user(username, 0, display,
- g_cfg->session_variables1, g_cfg->session_variables2);
+ env_set_user(username,
+ 0,
+ display,
+ g_cfg->session_variables1,
+ g_cfg->session_variables2);
g_snprintf(text, 255, "%s/%s", XRDP_CFG_PATH, "reconnectwm.sh");
if (g_file_exist(text))
diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c
index 46c4908d..2a040a9b 100644
--- a/xorg/X11R7.6/rdp/rdprandr.c
+++ b/xorg/X11R7.6/rdp/rdprandr.c
@@ -439,11 +439,13 @@ rdpRRSetRdpOutputs(void)
}
}
+#if 0
for (index = 0; index < pRRScrPriv->numOutputs; index++)
{
RROutputSetCrtcs(pRRScrPriv->outputs[index], pRRScrPriv->crtcs,
pRRScrPriv->numCrtcs);
}
+#endif
return 0;
}
diff --git a/xorg/X11R7.6/xkeyboard-config-2.0.patch b/xorg/X11R7.6/xkeyboard-config-2.0.patch
new file mode 100644
index 00000000..a77f117a
--- /dev/null
+++ b/xorg/X11R7.6/xkeyboard-config-2.0.patch
@@ -0,0 +1,88 @@
+diff -rupP xkeyboard-config-2.0.orig/rules/HDR xkeyboard-config-2.0/rules/HDR
+--- xkeyboard-config-2.0.orig/rules/HDR 2016-06-28 19:31:02.814647638 +0900
++++ xkeyboard-config-2.0/rules/HDR 2016-06-28 19:33:58.251517616 +0900
+@@ -15,6 +15,7 @@
+ ! model layout[3] variant[3] = symbols
+ ! model layout[4] variant[4] = symbols
+ ! model = symbols
++! model layout = symbols
+ ! layout variant = compat
+ ! layout[1] variant[1] = compat
+ ! layout[2] variant[2] = compat
+diff -rupP xkeyboard-config-2.0.orig/rules/Makefile.am xkeyboard-config-2.0/rules/Makefile.am
+--- xkeyboard-config-2.0.orig/rules/Makefile.am 2016-06-28 19:31:02.814647638 +0900
++++ xkeyboard-config-2.0/rules/Makefile.am 2016-06-28 20:58:22.276629031 +0900
+@@ -41,6 +41,7 @@ HDR compat/base.ml2v2_s.part extras/bas
+ HDR compat/base.ml3v3_s.part extras/base.ml3v3_s.part \
+ HDR compat/base.ml4v4_s.part extras/base.ml4v4_s.part \
+ HDR base.m_s.part \
++HDR base.ml_s1.part \
+ HDR compat/base.lv_c.part \
+ HDR compat/base.l1v1_c.part \
+ HDR compat/base.l2v2_c.part \
+@@ -114,6 +115,7 @@ HDR extras/base.ml2v2_s.part \
+ HDR extras/base.ml3v3_s.part \
+ HDR extras/base.ml4v4_s.part \
+ HDR base.m_s.part \
++HDR base.ml_s1.part \
+ HDR \
+ HDR \
+ HDR \
+@@ -183,6 +185,7 @@ base.ml2_s.part \
+ base.ml3_s.part \
+ base.ml4_s.part \
+ base.m_s.part \
++base.ml_s1.part \
+ base.ml_c.part \
+ base.ml1_c.part \
+ base.m_t.part \
+diff -rupP xkeyboard-config-2.0.orig/rules/Makefile.in xkeyboard-config-2.0/rules/Makefile.in
+--- xkeyboard-config-2.0.orig/rules/Makefile.in 2016-06-28 19:31:02.850647811 +0900
++++ xkeyboard-config-2.0/rules/Makefile.in 2016-06-28 21:00:57.569398853 +0900
+@@ -239,6 +239,7 @@ SUBDIRS = bin compat extras
+ @USE_COMPAT_RULES_FALSE@HDR extras/base.ml3v3_s.part \
+ @USE_COMPAT_RULES_FALSE@HDR extras/base.ml4v4_s.part \
+ @USE_COMPAT_RULES_FALSE@HDR base.m_s.part \
++@USE_COMPAT_RULES_FALSE@HDR base.ml_s1.part \
+ @USE_COMPAT_RULES_FALSE@HDR \
+ @USE_COMPAT_RULES_FALSE@HDR \
+ @USE_COMPAT_RULES_FALSE@HDR \
+@@ -275,6 +276,7 @@ SUBDIRS = bin compat extras
+ @USE_COMPAT_RULES_TRUE@HDR compat/base.ml3v3_s.part extras/base.ml3v3_s.part \
+ @USE_COMPAT_RULES_TRUE@HDR compat/base.ml4v4_s.part extras/base.ml4v4_s.part \
+ @USE_COMPAT_RULES_TRUE@HDR base.m_s.part \
++@USE_COMPAT_RULES_TRUE@HDR base.ml_s1.part \
+ @USE_COMPAT_RULES_TRUE@HDR compat/base.lv_c.part \
+ @USE_COMPAT_RULES_TRUE@HDR compat/base.l1v1_c.part \
+ @USE_COMPAT_RULES_TRUE@HDR compat/base.l2v2_c.part \
+@@ -378,6 +380,7 @@ base.ml2_s.part \
+ base.ml3_s.part \
+ base.ml4_s.part \
+ base.m_s.part \
++base.ml_s1.part \
+ base.ml_c.part \
+ base.ml1_c.part \
+ base.m_t.part \
+diff -rupP xkeyboard-config-2.0.orig/rules/base.ml_s1.part xkeyboard-config-2.0/rules/base.ml_s1.part
+--- xkeyboard-config-2.0.orig/rules/base.ml_s1.part 1970-01-01 09:00:00.000000000 +0900
++++ xkeyboard-config-2.0/rules/base.ml_s1.part 2016-06-28 19:59:05.238990192 +0900
+@@ -0,0 +1 @@
++ $inetkbds jp = +jp(henkan)
+diff -rupP xkeyboard-config-2.0.orig/symbols/jp xkeyboard-config-2.0/symbols/jp
+--- xkeyboard-config-2.0.orig/symbols/jp 2016-06-28 19:31:03.046648788 +0900
++++ xkeyboard-config-2.0/symbols/jp 2016-06-28 19:32:57.367215702 +0900
+@@ -105,6 +105,14 @@ xkb_symbols "common" {
+ };
+ };
+
++partial alphanumeric_keys
++xkb_symbols "henkan" {
++ key <XFER> {
++ type[Group1]= "PC_ALT_LEVEL2",
++ symbols[Group1]= [ Henkan, Mode_switch ]
++ };
++};
++
+ // OADG109A map
+ partial alphanumeric_keys
+ xkb_symbols "OADG109A" {
diff --git a/xrdp/xrdp_keyboard.ini b/xrdp/xrdp_keyboard.ini
index 0f1a28cb..21e27f1c 100644
--- a/xrdp/xrdp_keyboard.ini
+++ b/xrdp/xrdp_keyboard.ini
@@ -100,7 +100,7 @@ layouts_map=rdp_layouts_map_mac
[rdp_keyboard_jp]
keyboard_type=7
keyboard_subtype=2
-model=jp106
+model=pc105
rdp_layouts=default_rdp_layouts
layouts_map=default_layouts_map
diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c
index 337ec236..c9fca912 100644
--- a/xrdp/xrdp_login_wnd.c
+++ b/xrdp/xrdp_login_wnd.c
@@ -618,14 +618,18 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
int log_width;
int log_height;
int regular;
- int i = 0;
- int primaryxoffset = 0;
- int primaryyoffset = 0;
+ int primary_x_offset;
+ int primary_y_offset;
+ int index;
+ int x;
+ int y;
+ int cx;
+ int cy;
globals = &self->xrdp_config->cfg_globals;
- primaryxoffset = self->screen->width / 2;
- primaryyoffset = self->screen->height / 2;
+ primary_x_offset = self->screen->width / 2;
+ primary_y_offset = self->screen->height / 2;
log_width = globals->ls_width;
log_height = globals->ls_height;
@@ -648,12 +652,17 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
/* multimon scenario, draw login window on primary monitor */
if (self->client_info->monitorCount > 1)
{
- for (i = 0; i < self->client_info->monitorCount; ++i)
+ for (index = 0; index < self->client_info->monitorCount; index++)
{
- if (self->client_info->minfo[i].is_primary)
+ if (self->client_info->minfo_wm[index].is_primary)
{
- primaryxoffset = self->screen->width - (self->client_info->minfo[i].right / 2) - 1;
- primaryyoffset = self->screen->height - (self->client_info->minfo[i].bottom / 2) - 1;
+ x = self->client_info->minfo_wm[index].left;
+ y = self->client_info->minfo_wm[index].top;
+ cx = self->client_info->minfo_wm[index].right;
+ cy = self->client_info->minfo_wm[index].bottom;
+
+ primary_x_offset = x + ((cx - x) / 2);
+ primary_y_offset = y + ((cy - y) / 2);
break;
}
}
@@ -667,11 +676,8 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
self->login_window->owner = self->screen;
self->login_window->bg_color = globals->ls_bg_color;
- self->login_window->left = primaryxoffset -
- self->login_window->width / 2;
-
- self->login_window->top = primaryyoffset -
- self->login_window->height / 2;
+ self->login_window->left = primary_x_offset - self->login_window->width / 2;
+ self->login_window->top = primary_y_offset - self->login_window->height / 2;
self->login_window->notify = xrdp_wm_login_notify;
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index 8ce18bb6..3b223902 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -1884,9 +1884,9 @@ xrdp_wm_show_log(struct xrdp_wm *self)
int h;
int xoffset;
int yoffset;
- int i;
- int primaryxoffset = 0;
- int primaryyoffset = 0;
+ int index;
+ int primary_x_offset;
+ int primary_y_offset;
if (self->hide_log_window)
@@ -1916,15 +1916,18 @@ xrdp_wm_show_log(struct xrdp_wm *self)
yoffset = 2;
}
+ primary_x_offset = 0;
+ primary_y_offset = 0;
+
/* multimon scenario, draw log window on primary monitor */
if (self->client_info->monitorCount > 1)
{
- for (i = 0; i < self->client_info->monitorCount; ++i)
+ for (index = 0; index < self->client_info->monitorCount; index++)
{
- if (self->client_info->minfo[i].is_primary)
+ if (self->client_info->minfo_wm[index].is_primary)
{
- primaryxoffset = self->screen->width - self->client_info->minfo[i].right - 1;
- primaryyoffset = self->screen->height - self->client_info->minfo[i].bottom - 1;
+ primary_x_offset = self->client_info->minfo_wm[index].left;
+ primary_y_offset = self->client_info->minfo_wm[index].top;
break;
}
}
@@ -1937,8 +1940,8 @@ xrdp_wm_show_log(struct xrdp_wm *self)
self->log_wnd->parent = self->screen;
self->log_wnd->owner = self->screen;
self->log_wnd->bg_color = self->grey;
- self->log_wnd->left = primaryxoffset + xoffset;
- self->log_wnd->top = primaryyoffset + yoffset;
+ self->log_wnd->left = primary_x_offset + xoffset;
+ self->log_wnd->top = primary_y_offset + yoffset;
set_string(&(self->log_wnd->caption1), "Connection Log");
/* ok button */
but = xrdp_bitmap_create(DEFAULT_BUTTON_W, DEFAULT_BUTTON_H, self->screen->bpp, WND_TYPE_BUTTON, self);