summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/list.c2
-rw-r--r--common/os_calls.c43
-rw-r--r--common/os_calls.h26
-rw-r--r--common/thread_calls.c15
-rw-r--r--common/trans.c98
-rw-r--r--configure.ac5
-rw-r--r--docs/man/Makefile.am4
-rw-r--r--docs/man/xrdp-sessvc.82
-rw-r--r--instfiles/Makefile.am12
-rw-r--r--instfiles/default/Makefile.am5
-rw-r--r--instfiles/init.d/Makefile.am6
-rw-r--r--instfiles/init.d/xrdp13
-rw-r--r--instfiles/pulse/Makefile.am5
-rw-r--r--instfiles/rc.d/Makefile.am6
-rw-r--r--instfiles/rc.d/xrdp4
-rw-r--r--keygen/Makefile.am9
-rw-r--r--keygen/keygen.c21
-rw-r--r--libxrdp/libxrdp.c5
-rw-r--r--libxrdp/xrdp_caps.c8
-rw-r--r--libxrdp/xrdp_iso.c7
-rw-r--r--libxrdp/xrdp_orders.c14
-rw-r--r--libxrdp/xrdp_rdp.c12
-rw-r--r--libxrdp/xrdp_sec.c6
-rw-r--r--m4/.gitignore3
-rw-r--r--m4/ax_append_flag.m471
-rw-r--r--m4/ax_cflags_warn_all.m4122
-rw-r--r--m4/ax_gcc_func_attribute.m4223
-rw-r--r--m4/ax_require_defined.m437
-rw-r--r--rdp/rdp_lic.c15
-rw-r--r--rdp/rdp_orders.c19
-rw-r--r--rdp/rdp_rdp.c18
-rw-r--r--sesman/Makefile.am13
-rw-r--r--sesman/chansrv/chansrv.c4
-rw-r--r--sesman/chansrv/chansrv_fuse.c4
-rw-r--r--sesman/chansrv/clipboard.c28
-rw-r--r--sesman/chansrv/clipboard_file.c5
-rw-r--r--sesman/chansrv/drdynvc.c8
-rw-r--r--sesman/chansrv/pulse/module-xrdp-sink.c4
-rw-r--r--sesman/chansrv/pulse/module-xrdp-source.c7
-rw-r--r--sesman/chansrv/rail.c36
-rw-r--r--sesman/chansrv/smartcard.c4
-rw-r--r--sesman/chansrv/smartcard_pcsc.c2
-rw-r--r--sesman/chansrv/sound.c2
-rw-r--r--sesman/chansrv/xcommon.c2
-rw-r--r--sesman/config.h6
-rw-r--r--sesman/libscp/libscp_lock.c22
-rw-r--r--sesman/libscp/libscp_v1s.c2
-rw-r--r--sesman/sesman.c13
-rw-r--r--sesman/sesman.ini3
-rw-r--r--sesman/session.c40
-rw-r--r--sesman/sessvc/sessvc.c1
-rw-r--r--sesman/sig.c6
-rw-r--r--sesman/tools/sesrun.c2
-rw-r--r--sesman/tools/sestest.c4
-rw-r--r--tests/tcp_proxy/main.c12
-rw-r--r--xorg/X11R7.6/rdp/rdpmain.c7
-rw-r--r--xorg/X11R7.6/rdp/rdprandr.c170
-rw-r--r--xorg/X11R7.6/rdp/rdprandr.h3
-rw-r--r--xorg/X11R7.6/rdp/rdpup.c35
m---------xorgxrdp0
-rw-r--r--xrdp/Makefile.am6
-rw-r--r--xrdp/xrdp.c108
-rw-r--r--xrdp/xrdp_mm.c9
-rw-r--r--xrdp/xrdp_painter.c2
-rw-r--r--xrdp/xrdp_wm.c2
-rw-r--r--xrdp/xrdpwin.c29
-rw-r--r--xup/xup.c6
67 files changed, 1071 insertions, 372 deletions
diff --git a/common/list.c b/common/list.c
index abab2fab..5873d41d 100644
--- a/common/list.c
+++ b/common/list.c
@@ -221,6 +221,6 @@ list_dump_items(struct list *self)
for (index = 0; index < self->count; index++)
{
- g_writeln("%d: %s", index, list_get_item(self, index));
+ g_writeln("%d: 0x%lx", index, list_get_item(self, index));
}
}
diff --git a/common/os_calls.c b/common/os_calls.c
index 991ebb44..dbef8da6 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -282,7 +282,7 @@ g_hexdump(char *p, int len)
g_printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
}
- g_writeln("");
+ g_writeln("%s", "");
offset += thisline;
line += thisline;
}
@@ -2207,6 +2207,7 @@ g_strdup(const char *in)
return p;
}
+
/*****************************************************************************/
/* if in = 0, return 0 else return newly alloced copy of input string
* if the input string is larger than maxlen the returned string will be
@@ -2238,6 +2239,7 @@ g_strndup(const char *in, const unsigned int maxlen)
return p;
}
+
/*****************************************************************************/
int APP_CC
g_strcmp(const char *c1, const char *c2)
@@ -2260,10 +2262,12 @@ g_strncmp_d(const char *s1, const char *s2, const char delim, int n)
char c1;
char c2;
+ c1 = 0;
+ c2 = 0;
while (n > 0)
{
- c1 = *s1++;
- c2 = *s2++;
+ c1 = *(s1++);
+ c2 = *(s2++);
if ((c1 == 0) || (c1 != c2) || (c1 == delim) || (c2 == delim))
{
return c1 - c2;
@@ -2724,17 +2728,6 @@ g_signal_user_interrupt(void (*func)(int))
/*****************************************************************************/
/* does not work in win32 */
void APP_CC
-g_signal_kill(void (*func)(int))
-{
-#if defined(_WIN32)
-#else
- signal(SIGKILL, func);
-#endif
-}
-
-/*****************************************************************************/
-/* does not work in win32 */
-void APP_CC
g_signal_terminate(void (*func)(int))
{
#if defined(_WIN32)
@@ -2851,6 +2844,28 @@ g_setuid(int pid)
}
/*****************************************************************************/
+int APP_CC
+g_setsid(void)
+{
+#if defined(_WIN32)
+ return -1;
+#else
+ return setsid();
+#endif
+}
+
+/*****************************************************************************/
+int APP_CC
+g_setlogin(const char *name)
+{
+#ifdef BSD
+ return setlogin(name);
+#else
+ return -1;
+#endif
+}
+
+/*****************************************************************************/
/* does not work in win32
returns pid of process that exits or zero if signal occurred */
int APP_CC
diff --git a/common/os_calls.h b/common/os_calls.h
index acfbe475..2ed2cb81 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -21,6 +21,10 @@
#if !defined(OS_CALLS_H)
#define OS_CALLS_H
+#if defined(HAVE_CONFIG_H)
+#include "config_ac.h"
+#endif
+
#ifndef NULL
#define NULL 0
#endif
@@ -41,17 +45,26 @@
#define g_tcp_select g_sck_select
#define g_close_wait_obj g_delete_wait_obj
+#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
+#define printflike(arg_format, arg_first_check) \
+ __attribute__((__format__(__printf__, arg_format, arg_first_check)))
+#else
+#define printflike(arg_format, arg_first_check)
+#endif
+
int APP_CC g_rm_temp_dir(void);
int APP_CC g_mk_temp_dir(const char* app_name);
void APP_CC g_init(const char* app_name);
void APP_CC g_deinit(void);
void* APP_CC g_malloc(int size, int zero);
void APP_CC g_free(void* ptr);
-void DEFAULT_CC g_printf(const char *format, ...);
-void DEFAULT_CC g_sprintf(char* dest, const char* format, ...);
-void DEFAULT_CC g_snprintf(char* dest, int len, const char* format, ...);
-void DEFAULT_CC g_writeln(const char* format, ...);
-void DEFAULT_CC g_write(const char* format, ...);
+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, ...) \
+ 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);
void APP_CC g_hexdump(char* p, int len);
void APP_CC g_memset(void* ptr, int val, int size);
void APP_CC g_memcpy(void* d_ptr, const void* s_ptr, int size);
@@ -147,7 +160,6 @@ void APP_CC g_signal_child_stop(void (*func)(int));
void APP_CC g_signal_segfault(void (*func)(int));
void APP_CC g_signal_hang_up(void (*func)(int));
void APP_CC g_signal_user_interrupt(void (*func)(int));
-void APP_CC g_signal_kill(void (*func)(int));
void APP_CC g_signal_terminate(void (*func)(int));
void APP_CC g_signal_pipe(void (*func)(int));
void APP_CC g_signal_usr1(void (*func)(int));
@@ -157,6 +169,8 @@ int APP_CC g_initgroups(const char* user, int gid);
int APP_CC g_getuid(void);
int APP_CC g_getgid(void);
int APP_CC g_setuid(int pid);
+int APP_CC g_setsid(void);
+int APP_CC g_setlogin(const char *name);
int APP_CC g_waitchild(void);
int APP_CC g_waitpid(int pid);
void APP_CC g_clearenv(void);
diff --git a/common/thread_calls.c b/common/thread_calls.c
index a68e902a..d828b353 100644
--- a/common/thread_calls.c
+++ b/common/thread_calls.c
@@ -20,6 +20,10 @@
#if defined(_WIN32)
#include <windows.h>
+#elif defined(__APPLE__)
+#include <pthread.h>
+#include <dispatch/dispatch.h>
+#include <dispatch/time.h>
#else
#include <pthread.h>
#include <semaphore.h>
@@ -159,6 +163,9 @@ tc_sem_create(int init_count)
sem = CreateSemaphore(0, init_count, init_count + 10, 0);
return (tbus)sem;
+#elif defined(__APPLE__)
+ dispatch_semaphore_t sem = dispatch_semaphore_create(init_count);
+ return (tbus)sem;
#else
sem_t *sem = (sem_t *)NULL;
@@ -174,6 +181,8 @@ tc_sem_delete(tbus sem)
{
#if defined(_WIN32)
CloseHandle((HANDLE)sem);
+#elif defined(__APPLE__)
+ dispatch_release((dispatch_semaphore_t)sem);
#else
sem_t *lsem;
@@ -190,6 +199,9 @@ tc_sem_dec(tbus sem)
#if defined(_WIN32)
WaitForSingleObject((HANDLE)sem, INFINITE);
return 0;
+#elif defined(__APPLE__)
+ dispatch_semaphore_wait((dispatch_semaphore_t)sem, DISPATCH_TIME_FOREVER);
+ return 0;
#else
sem_wait((sem_t *)sem);
return 0;
@@ -203,6 +215,9 @@ tc_sem_inc(tbus sem)
#if defined(_WIN32)
ReleaseSemaphore((HANDLE)sem, 1, 0);
return 0;
+#elif defined(__APPLE__)
+ dispatch_semaphore_signal((dispatch_semaphore_t)sem);
+ return 0;
#else
sem_post((sem_t *)sem);
return 0;
diff --git a/common/trans.c b/common/trans.c
index 2c44f28c..9611f768 100644
--- a/common/trans.c
+++ b/common/trans.c
@@ -330,7 +330,7 @@ trans_check_wait_objs(struct trans *self)
sizeof(self->addr) - 1);
g_strncpy(in_trans->port, self->port,
sizeof(self->port) - 1);
-
+ g_sck_set_non_blocking(in_sck);
if (self->trans_conn_in(self, in_trans) != 0)
{
trans_delete(in_trans);
@@ -442,45 +442,42 @@ trans_force_read_s(struct trans *self, struct stream *in_s, int size)
{
return 1;
}
- if (self->trans_can_recv(self, self->sck, 100))
+ rcvd = self->trans_recv(self, in_s->end, size);
+ if (rcvd == -1)
{
- rcvd = self->trans_recv(self, in_s->end, size);
- if (rcvd == -1)
+ if (g_tcp_last_error_would_block(self->sck))
{
- if (g_tcp_last_error_would_block(self->sck))
+ if (!self->trans_can_recv(self, self->sck, 100))
{
- }
- else
- {
- /* error */
- self->status = TRANS_STATUS_DOWN;
- return 1;
+ /* check for term here */
+ if (self->is_term != 0)
+ {
+ if (self->is_term())
+ {
+ /* term */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
+ }
+ }
}
}
- else if (rcvd == 0)
+ else
{
/* error */
self->status = TRANS_STATUS_DOWN;
return 1;
}
- else
- {
- in_s->end += rcvd;
- size -= rcvd;
- }
+ }
+ else if (rcvd == 0)
+ {
+ /* error */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
}
else
{
- /* check for term here */
- if (self->is_term != 0)
- {
- if (self->is_term())
- {
- /* term */
- self->status = TRANS_STATUS_DOWN;
- return 1;
- }
- }
+ in_s->end += rcvd;
+ size -= rcvd;
}
}
return 0;
@@ -514,44 +511,41 @@ trans_force_write_s(struct trans *self, struct stream *out_s)
}
while (total < size)
{
- if (g_tcp_can_send(self->sck, 100))
+ sent = self->trans_send(self, out_s->data + total, size - total);
+ if (sent == -1)
{
- sent = self->trans_send(self, out_s->data + total, size - total);
- if (sent == -1)
+ if (g_tcp_last_error_would_block(self->sck))
{
- if (g_tcp_last_error_would_block(self->sck))
- {
- }
- else
+ if (!g_tcp_can_send(self->sck, 100))
{
- /* error */
- self->status = TRANS_STATUS_DOWN;
- return 1;
+ /* check for term here */
+ if (self->is_term != 0)
+ {
+ if (self->is_term())
+ {
+ /* term */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
+ }
+ }
}
}
- else if (sent == 0)
+ else
{
/* error */
self->status = TRANS_STATUS_DOWN;
return 1;
}
- else
- {
- total = total + sent;
- }
+ }
+ else if (sent == 0)
+ {
+ /* error */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
}
else
{
- /* check for term here */
- if (self->is_term != 0)
- {
- if (self->is_term())
- {
- /* term */
- self->status = TRANS_STATUS_DOWN;
- return 1;
- }
- }
+ total = total + sent;
}
}
return 0;
diff --git a/configure.ac b/configure.ac
index 80fad1c3..50eff683 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script
-AC_PREREQ(2.59)
+AC_PREREQ(2.65)
AC_INIT([xrdp], [0.9.0], [xrdp-devel@googlegroups.com])
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
AM_INIT_AUTOMAKE([1.7.2 foreign])
@@ -13,6 +13,9 @@ PKG_PROG_PKG_CONFIG
# Use silent rules by default if supported by Automake
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+AX_CFLAGS_WARN_ALL
+AX_GCC_FUNC_ATTRIBUTE([format])
+
case $host_os in
*linux*)
linux=yes
diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am
index 507809bd..48c26559 100644
--- a/docs/man/Makefile.am
+++ b/docs/man/Makefile.am
@@ -1,4 +1,4 @@
-man_MANS = \
+dist_man_MANS = \
xrdp-dis.1 \
sesman.ini.5 \
xrdp.ini.5 \
@@ -14,4 +14,4 @@ man_MANS = \
noinst_man_MANS = \
xrdp-xcon.8
-EXTRA_DIST = $(man_MANS) $(noinst_man_MANS)
+EXTRA_DIST = $(noinst_man_MANS)
diff --git a/docs/man/xrdp-sessvc.8 b/docs/man/xrdp-sessvc.8
index 322c968a..77f75e85 100644
--- a/docs/man/xrdp-sessvc.8
+++ b/docs/man/xrdp-sessvc.8
@@ -3,7 +3,7 @@
xrdp\-sessvc \- \fBxrdp\fR session supervisor
.SH "SYNTAX"
-.B xrdp\-sessman
+.B xrdp\-sessvc
.I x_pid wm_pid
.SH "DESCRIPTION"
diff --git a/instfiles/Makefile.am b/instfiles/Makefile.am
index 4ef77992..f32eb639 100644
--- a/instfiles/Makefile.am
+++ b/instfiles/Makefile.am
@@ -1,15 +1,14 @@
EXTRA_DIST = \
xrdp.sh \
xrdp-sesman.service \
- xrdp.service \
- $(startscript_DATA)
+ xrdp.service
#
# files for all platforms
#
startscriptdir=$(sysconfdir)/xrdp
-startscript_DATA = \
+dist_startscript_DATA = \
km-0407.ini \
km-0409.ini \
km-040c.ini \
@@ -37,9 +36,9 @@ if LINUX
SUBDIRS += \
pam.d \
pulse
-startscript_DATA += xrdp.sh
+dist_startscript_SCRIPTS = xrdp.sh
if HAVE_SYSTEMD
-systemdsystemunit_DATA = \
+dist_systemdsystemunit_DATA = \
xrdp-sesman.service \
xrdp.service
else
@@ -62,9 +61,7 @@ endif
if LINUX
# must be tab below
install-data-hook:
- chmod 755 $(DESTDIR)$(sysconfdir)/xrdp/xrdp.sh
if [ -f $(DESTDIR)$(sysconfdir)/init.d/xrdp ]; then \
- chmod 755 $(DESTDIR)$(sysconfdir)/init.d/xrdp; \
sed -i 's|__BASE__|$(prefix)|' $(DESTDIR)$(sysconfdir)/init.d/xrdp; \
fi
endif
@@ -72,6 +69,5 @@ endif
if FREEBSD
# must be tab below
install-data-hook:
- chmod 755 $(DESTDIR)$(sysconfdir)/rc.d/xrdp
sed -i '' 's|%%PREFIX%%|$(prefix)|g' $(DESTDIR)$(sysconfdir)/rc.d/xrdp
endif
diff --git a/instfiles/default/Makefile.am b/instfiles/default/Makefile.am
index 6a7f4f2b..f379a46d 100644
--- a/instfiles/default/Makefile.am
+++ b/instfiles/default/Makefile.am
@@ -1,3 +1,2 @@
-EXTRA_DIST = xrdp
-startscriptdir=$(sysconfdir)/default
-startscript_DATA = xrdp
+startscriptdir = $(sysconfdir)/default
+dist_startscript_DATA = xrdp
diff --git a/instfiles/init.d/Makefile.am b/instfiles/init.d/Makefile.am
index d9e43ecb..2ffff4fe 100644
--- a/instfiles/init.d/Makefile.am
+++ b/instfiles/init.d/Makefile.am
@@ -1,4 +1,2 @@
-EXTRA_DIST = xrdp
-startscriptdir=$(sysconfdir)/init.d
-startscript_DATA = xrdp
-
+startscriptdir = $(sysconfdir)/init.d
+dist_startscript_SCRIPTS = xrdp
diff --git a/instfiles/init.d/xrdp b/instfiles/init.d/xrdp
index 8e5f42d1..f64e5965 100644
--- a/instfiles/init.d/xrdp
+++ b/instfiles/init.d/xrdp
@@ -23,7 +23,6 @@ SESMAN_START=yes
#USERID=xrdp
# the X11rdp backend only works as root at the moment - GH 20/03/2013
USERID=root
-RSAKEYS=/etc/xrdp/rsakeys.ini
NAME=xrdp
DESC="Remote Desktop Protocol server"
@@ -67,18 +66,6 @@ if [ "$(id -u)" = "0" ]; then
mkdir $PIDDIR
fi
chown $USERID:$USERID $PIDDIR
-
- # Check for rsa key
- if [ ! -f $RSAKEYS ] ; then
- log_action_begin_msg "Generating xrdp RSA keys..."
- (umask 077 ; xrdp-keygen xrdp $RSAKEYS)
- chown $USERID:$USERID $RSAKEYS
- if [ ! -f $RSAKEYS ] ; then
- log_action_end_msg 1 "could not create $RSAKEYS"
- exit 1
- fi
- log_action_end_msg 0 "done"
- fi
fi
diff --git a/instfiles/pulse/Makefile.am b/instfiles/pulse/Makefile.am
index fcd9ee4b..72b80d10 100644
--- a/instfiles/pulse/Makefile.am
+++ b/instfiles/pulse/Makefile.am
@@ -1,3 +1,2 @@
-EXTRA_DIST = default.pa
-pulsedir=$(sysconfdir)/xrdp/pulse
-pulse_DATA = default.pa
+pulsedir = $(sysconfdir)/xrdp/pulse
+dist_pulse_DATA = default.pa
diff --git a/instfiles/rc.d/Makefile.am b/instfiles/rc.d/Makefile.am
index 5edb8ccc..17993232 100644
--- a/instfiles/rc.d/Makefile.am
+++ b/instfiles/rc.d/Makefile.am
@@ -1,4 +1,2 @@
-EXTRA_DIST = xrdp
-startscriptdir=$(sysconfdir)/rc.d
-startscript_DATA = xrdp
-
+startscriptdir = $(sysconfdir)/rc.d
+dist_startscript_SCRIPTS = xrdp
diff --git a/instfiles/rc.d/xrdp b/instfiles/rc.d/xrdp
index d20f8108..9dec649e 100644
--- a/instfiles/rc.d/xrdp
+++ b/instfiles/rc.d/xrdp
@@ -61,10 +61,6 @@ xrdp_cmd() {
if [ "${rc_arg}" = "stop" ] ; then
xrdp_daemons=$(reverse_list ${xrdp_daemons})
fi
- # Generate rsakeys.ini on start
- if [ "${rc_arg}" = "start" -a ! -f %%PREFIX%%/etc/xrdp/rsakeys.ini ] ; then
- %%PREFIX%%/bin/xrdp-keygen xrdp %%PREFIX%%/etc/xrdp/rsakeys.ini
- fi
# Apply to all the daemons.
for name in ${xrdp_daemons}; do
diff --git a/keygen/Makefile.am b/keygen/Makefile.am
index 353f74df..25e20d50 100644
--- a/keygen/Makefile.am
+++ b/keygen/Makefile.am
@@ -13,3 +13,12 @@ xrdp_keygen_SOURCES = keygen.c
xrdp_keygen_LDADD = \
$(top_builddir)/common/libcommon.la
+
+xrdpsysconfdir = $(sysconfdir)/xrdp
+
+install-data-hook:
+ umask 077 && \
+ ./xrdp-keygen xrdp $(DESTDIR)$(xrdpsysconfdir)/rsakeys.ini
+
+uninstall-hook:
+ rm -f $(DESTDIR)$(xrdpsysconfdir)/rsakeys.ini
diff --git a/keygen/keygen.c b/keygen/keygen.c
index 8b40071f..bafcaf1c 100644
--- a/keygen/keygen.c
+++ b/keygen/keygen.c
@@ -34,8 +34,8 @@
/* this is the signature size in bytes */
#define TSSK_KEY_LENGTH 64
-/* default to 512 bit key size, can set changed, set */
-static int g_key_size_bits = 512;
+/* default to 2048 bit key size, can set changed, set */
+static int g_key_size_bits = 2048;
static tui8 g_exponent[4] =
{
@@ -195,11 +195,11 @@ static tui8 g_testkey2048[376] = /* 2048 bit test key */
static int APP_CC
out_params(void)
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("xrdp rsa key gen utility examples");
g_writeln(" xrdp-keygen xrdp ['path and file name' | auto] [512 or 2048]");
g_writeln(" xrdp-keygen test");
- g_writeln("");
+ g_writeln("%s", "");
return 0;
}
@@ -351,7 +351,7 @@ save_all(char *e_data, int e_len, char *n_data, int n_len,
}
g_writeln("saving to %s", filename);
- g_writeln("");
+ g_writeln("%s", "");
if (g_file_exist(filename))
{
@@ -411,15 +411,14 @@ key_gen(const char *path_and_file_name)
d_len = n_len;
sign_len = 64;
error = 0;
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("Generating %d bit rsa key...", g_key_size_bits);
- g_writeln("");
+ g_writeln("%s", "");
if (error == 0)
{
error = ssl_gen_key_xrdp1(g_key_size_bits, e_data, e_len, n_data, n_len,
d_data, d_len);
-
if (error != 0)
{
g_writeln("error %d in key_gen, ssl_gen_key_xrdp1", error);
@@ -429,7 +428,7 @@ key_gen(const char *path_and_file_name)
if (error == 0)
{
g_writeln("ssl_gen_key_xrdp1 ok");
- g_writeln("");
+ g_writeln("%s", "");
error = sign_key(e_data, e_len, n_data, n_len, sign_data, sign_len);
if (error != 0)
@@ -589,10 +588,10 @@ main(int argc, char **argv)
}
else if (g_strcasecmp(argv[1], "test") == 0)
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("testing 512 bit key");
key_test512();
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("testing 2048 bit key");
key_test2048();
return 0;
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index a823bfdf..0015f26b 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -253,8 +253,8 @@ libxrdp_process_data(struct xrdp_session *session, struct stream *s)
{
/*This situation can happen and this is a workaround*/
cont = 0;
- g_writeln("Serious programming error we were locked in a deadly loop") ;
- g_writeln("remaining :%d", s->end - s->next_packet);
+ g_writeln("Serious programming error: we were locked in a deadly loop");
+ g_writeln("Remaining: %d", (int) (s->end - s->next_packet));
s->next_packet = 0;
}
@@ -1298,7 +1298,6 @@ libxrdp_fastpath_send_surface(struct xrdp_session *session,
struct stream ls;
struct stream *s;
struct xrdp_rdp *rdp;
- int rv;
int sec_bytes;
int rdp_bytes;
int max_bytes;
diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c
index 6d109f76..8a57c003 100644
--- a/libxrdp/xrdp_caps.c
+++ b/libxrdp/xrdp_caps.c
@@ -550,6 +550,11 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s)
in_uint16_le(s, num_caps);
in_uint8s(s, 2); /* pad */
+ if ((cap_len < 0) || (cap_len > 1024 * 1024))
+ {
+ return 1;
+ }
+
for (index = 0; index < num_caps; index++)
{
p = s->p;
@@ -562,7 +567,8 @@ xrdp_caps_process_confirm_active(struct xrdp_rdp *self, struct stream *s)
in_uint16_le(s, len);
if ((len < 4) || !s_check_rem(s, len - 4))
{
- g_writeln("xrdp_caps_process_confirm_active: error len %d", len, s->end - s->p);
+ g_writeln("xrdp_caps_process_confirm_active: error: len %d, "
+ "remaining %d", len, (int) (s->end - s->p));
return 1;
}
len -= 4;
diff --git a/libxrdp/xrdp_iso.c b/libxrdp/xrdp_iso.c
index 8369226c..ce3baf70 100644
--- a/libxrdp/xrdp_iso.c
+++ b/libxrdp/xrdp_iso.c
@@ -355,11 +355,18 @@ xrdp_iso_incoming(struct xrdp_iso *self)
{
text[cookie_index] = cc_type;
cookie_index++;
+ if (cookie_index > 255)
+ {
+ cookie_index = 255;
+ }
if ((s->p[0] == 0x0D) && (s->p[1] == 0x0A))
{
in_uint8s(s, 2);
text[cookie_index] = 0;
cookie_index = 0;
+ if (g_strlen(text) > 0)
+ {
+ }
break;
}
in_uint8(s, cc_type);
diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c
index b2f1e582..d7a2d017 100644
--- a/libxrdp/xrdp_orders.c
+++ b/libxrdp/xrdp_orders.c
@@ -2641,6 +2641,7 @@ height(%d)", lines_sending, height);
return 0;
}
+#if defined(XRDP_JPEG)
/*****************************************************************************/
static int
xrdp_orders_send_as_jpeg(struct xrdp_orders *self,
@@ -2663,6 +2664,7 @@ xrdp_orders_send_as_jpeg(struct xrdp_orders *self,
return 1;
}
+#endif
#if defined(XRDP_NEUTRINORDP)
/*****************************************************************************/
@@ -2693,6 +2695,7 @@ xrdp_orders_send_as_rfx(struct xrdp_orders *self,
}
#endif
+#if defined(XRDP_JPEG) || defined(XRDP_NEUTRINORDP)
/*****************************************************************************/
static int APP_CC
xrdp_orders_out_v3(struct xrdp_orders *self, int cache_id, int cache_idx,
@@ -2733,6 +2736,7 @@ xrdp_orders_out_v3(struct xrdp_orders *self, int cache_id, int cache_idx,
out_uint8a(self->out_s, buf, bufsize);
return 0;
}
+#endif
/*****************************************************************************/
/* secondary drawing order (bitmap v3) using remotefx compression */
@@ -2741,12 +2745,16 @@ xrdp_orders_send_bitmap3(struct xrdp_orders *self,
int width, int height, int bpp, char *data,
int cache_id, int cache_idx, int hints)
{
- int e;
+ struct xrdp_client_info *ci;
+#if defined(XRDP_JPEG) || defined(XRDP_NEUTRINORDP)
int bufsize;
- int quality;
struct stream *xr_s; /* xrdp stream */
+#endif
+#if defined(XRDP_JPEG)
+ int e;
+ int quality;
struct stream *temp_s; /* xrdp stream */
- struct xrdp_client_info *ci;
+#endif
#if defined(XRDP_NEUTRINORDP)
STREAM *fr_s; /* FreeRDP stream */
RFX_CONTEXT *context;
diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c
index 1e58a1f4..00bda631 100644
--- a/libxrdp/xrdp_rdp.c
+++ b/libxrdp/xrdp_rdp.c
@@ -962,7 +962,6 @@ xrdp_rdp_process_data_sync(struct xrdp_rdp *self)
static int APP_CC
xrdp_rdp_process_screen_update(struct xrdp_rdp *self, struct stream *s)
{
- int op;
int left;
int top;
int right;
@@ -970,7 +969,7 @@ xrdp_rdp_process_screen_update(struct xrdp_rdp *self, struct stream *s)
int cx;
int cy;
- in_uint32_le(s, op);
+ in_uint8s(s, 4); /* op */
in_uint16_le(s, left);
in_uint16_le(s, top);
in_uint16_le(s, right);
@@ -1129,16 +1128,13 @@ xrdp_rdp_process_frame_ack(struct xrdp_rdp *self, struct stream *s)
int APP_CC
xrdp_rdp_process_data(struct xrdp_rdp *self, struct stream *s)
{
- int len;
int data_type;
- int ctype;
- int clen;
in_uint8s(s, 6);
- in_uint16_le(s, len);
+ in_uint8s(s, 2); /* len */
in_uint8(s, data_type);
- in_uint8(s, ctype);
- in_uint16_le(s, clen);
+ in_uint8s(s, 1); /* ctype */
+ in_uint8s(s, 2); /* clen */
DEBUG(("xrdp_rdp_process_data code %d", data_type));
switch (data_type)
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index 06dfdda7..3857e2d1 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -419,7 +419,7 @@ xrdp_load_keyboard_layout(struct xrdp_client_info *client_info)
}
else
{
- LLOGLN(0, ("xrdp_load_keyboard_layout: error opening %d",
+ LLOGLN(0, ("xrdp_load_keyboard_layout: error opening %s",
keyboard_cfg_file));
}
}
@@ -648,7 +648,6 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
int len_directory = 0;
int len_ip = 0;
int len_dll = 0;
- int tzone = 0;
char tmpdata[256];
/* initialize (zero out) local variables */
@@ -837,7 +836,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
{
return 1;
}
- in_uint32_le(s, tzone); /* len of timezone */
+ in_uint8s(s, 4); /* len of timezone */
in_uint8s(s, 62); /* skip */
in_uint8s(s, 22); /* skip misc. */
in_uint8s(s, 62); /* skip */
@@ -1814,7 +1813,6 @@ xrdp_sec_process_mcs_data_channels(struct xrdp_sec *self, struct stream *s)
{
int num_channels;
int index;
- struct mcs_channel_item *channel_item;
struct xrdp_client_info *client_info = (struct xrdp_client_info *)NULL;
client_info = &(self->rdp_layer->client_info);
diff --git a/m4/.gitignore b/m4/.gitignore
index 0f4126cd..94f2b516 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -1 +1,2 @@
-*.m4
+libtool.m4
+lt*.m4
diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4
new file mode 100644
index 00000000..08f2e07e
--- /dev/null
+++ b/m4/ax_append_flag.m4
@@ -0,0 +1,71 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
+#
+# DESCRIPTION
+#
+# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
+# added in between.
+#
+# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
+# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
+# FLAG.
+#
+# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 6
+
+AC_DEFUN([AX_APPEND_FLAG],
+[dnl
+AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
+AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
+AS_VAR_SET_IF(FLAGS,[
+ AS_CASE([" AS_VAR_GET(FLAGS) "],
+ [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
+ [
+ AS_VAR_APPEND(FLAGS,[" $1"])
+ AC_RUN_LOG([: FLAGS="$FLAGS"])
+ ])
+ ],
+ [
+ AS_VAR_SET(FLAGS,[$1])
+ AC_RUN_LOG([: FLAGS="$FLAGS"])
+ ])
+AS_VAR_POPDEF([FLAGS])dnl
+])dnl AX_APPEND_FLAG
diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4
new file mode 100644
index 00000000..1f077992
--- /dev/null
+++ b/m4/ax_cflags_warn_all.m4
@@ -0,0 +1,122 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
+#
+# DESCRIPTION
+#
+# Try to find a compiler option that enables most reasonable warnings.
+#
+# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
+# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
+#
+# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
+# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
+# Intel compilers. For a given compiler, the Fortran flags are much more
+# experimental than their C equivalents.
+#
+# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
+# - $2 add-value-if-not-found : nothing
+# - $3 action-if-found : add value to shellvariable
+# - $4 action-if-not-found : nothing
+#
+# NOTE: These macros depend on AX_APPEND_FLAG.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 15
+
+AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
+AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
+AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
+AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
+VAR,[VAR="no, unknown"
+ac_save_[]FLAGS="$[]FLAGS"
+for ac_arg dnl
+in "-warn all % -warn all" dnl Intel
+ "-pedantic % -Wall" dnl GCC
+ "-xstrconst % -v" dnl Solaris C
+ "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
+ "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
+ "-ansi -ansiE % -fullwarn" dnl IRIX
+ "+ESlit % +w1" dnl HP-UX C
+ "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
+ "-h conform % -h msglevel 2" dnl Cray C (Unicos)
+ #
+do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
+done
+FLAGS="$ac_save_[]FLAGS"
+])
+AS_VAR_POPDEF([FLAGS])dnl
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+case ".$VAR" in
+ .ok|.ok,*) m4_ifvaln($3,$3) ;;
+ .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
+ *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;;
+esac
+AS_VAR_POPDEF([VAR])dnl
+])dnl AX_FLAGS_WARN_ALL
+dnl implementation tactics:
+dnl the for-argument contains a list of options. The first part of
+dnl these does only exist to detect the compiler - usually it is
+dnl a global option to enable -ansi or -extrawarnings. All other
+dnl compilers will fail about it. That was needed since a lot of
+dnl compilers will give false positives for some option-syntax
+dnl like -Woption or -Xoption as they think of it is a pass-through
+dnl to later compile stages or something. The "%" is used as a
+dnl delimiter. A non-option comment can be given after "%%" marks
+dnl which will be shown but not added to the respective C/CXXFLAGS.
+
+AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([C])
+AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([C])
+])
+
+AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([C++])
+AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([C++])
+])
+
+AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
+AC_LANG_PUSH([Fortran])
+AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
+AC_LANG_POP([Fortran])
+])
diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4
new file mode 100644
index 00000000..c788ca9b
--- /dev/null
+++ b/m4/ax_gcc_func_attribute.m4
@@ -0,0 +1,223 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
+#
+# DESCRIPTION
+#
+# This macro checks if the compiler supports one of GCC's function
+# attributes; many other compilers also provide function attributes with
+# the same syntax. Compiler warnings are used to detect supported
+# attributes as unsupported ones are ignored by default so quieting
+# warnings when using this macro will yield false positives.
+#
+# The ATTRIBUTE parameter holds the name of the attribute to be checked.
+#
+# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
+#
+# The macro caches its result in the ax_cv_have_func_attribute_<attribute>
+# variable.
+#
+# The macro currently supports the following function attributes:
+#
+# alias
+# aligned
+# alloc_size
+# always_inline
+# artificial
+# cold
+# const
+# constructor
+# constructor_priority for constructor attribute with priority
+# deprecated
+# destructor
+# dllexport
+# dllimport
+# error
+# externally_visible
+# flatten
+# format
+# format_arg
+# gnu_inline
+# hot
+# ifunc
+# leaf
+# malloc
+# noclone
+# noinline
+# nonnull
+# noreturn
+# nothrow
+# optimize
+# pure
+# unused
+# used
+# visibility
+# warning
+# warn_unused_result
+# weak
+# weakref
+#
+# Unsuppored function attributes will be tested with a prototype returning
+# an int and not accepting any arguments and the result of the check might
+# be wrong or meaningless so use with care.
+#
+# LICENSE
+#
+# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 3
+
+AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
+ AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
+
+ AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+ m4_case([$1],
+ [alias], [
+ int foo( void ) { return 0; }
+ int bar( void ) __attribute__(($1("foo")));
+ ],
+ [aligned], [
+ int foo( void ) __attribute__(($1(32)));
+ ],
+ [alloc_size], [
+ void *foo(int a) __attribute__(($1(1)));
+ ],
+ [always_inline], [
+ inline __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [artificial], [
+ inline __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [cold], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [const], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [constructor_priority], [
+ int foo( void ) __attribute__((__constructor__(65535/2)));
+ ],
+ [constructor], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [deprecated], [
+ int foo( void ) __attribute__(($1("")));
+ ],
+ [destructor], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [dllexport], [
+ __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [dllimport], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [error], [
+ int foo( void ) __attribute__(($1("")));
+ ],
+ [externally_visible], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [flatten], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [format], [
+ int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
+ ],
+ [format_arg], [
+ char *foo(const char *p) __attribute__(($1(1)));
+ ],
+ [gnu_inline], [
+ inline __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [hot], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [ifunc], [
+ int my_foo( void ) { return 0; }
+ static int (*resolve_foo(void))(void) { return my_foo; }
+ int foo( void ) __attribute__(($1("resolve_foo")));
+ ],
+ [leaf], [
+ __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [malloc], [
+ void *foo( void ) __attribute__(($1));
+ ],
+ [noclone], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [noinline], [
+ __attribute__(($1)) int foo( void ) { return 0; }
+ ],
+ [nonnull], [
+ int foo(char *p) __attribute__(($1(1)));
+ ],
+ [noreturn], [
+ void foo( void ) __attribute__(($1));
+ ],
+ [nothrow], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [optimize], [
+ __attribute__(($1(3))) int foo( void ) { return 0; }
+ ],
+ [pure], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [unused], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [used], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [visibility], [
+ int foo_def( void ) __attribute__(($1("default")));
+ int foo_hid( void ) __attribute__(($1("hidden")));
+ int foo_int( void ) __attribute__(($1("internal")));
+ int foo_pro( void ) __attribute__(($1("protected")));
+ ],
+ [warning], [
+ int foo( void ) __attribute__(($1("")));
+ ],
+ [warn_unused_result], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [weak], [
+ int foo( void ) __attribute__(($1));
+ ],
+ [weakref], [
+ static int foo( void ) { return 0; }
+ static int bar( void ) __attribute__(($1("foo")));
+ ],
+ [
+ m4_warn([syntax], [Unsupported attribute $1, the test may fail])
+ int foo( void ) __attribute__(($1));
+ ]
+ )], [])
+ ],
+ dnl GCC doesn't exit with an error if an unknown attribute is
+ dnl provided but only outputs a warning, so accept the attribute
+ dnl only if no warning were issued.
+ [AS_IF([test -s conftest.err],
+ [AS_VAR_SET([ac_var], [no])],
+ [AS_VAR_SET([ac_var], [yes])])],
+ [AS_VAR_SET([ac_var], [no])])
+ ])
+
+ AS_IF([test yes = AS_VAR_GET([ac_var])],
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
+ [Define to 1 if the system has the `$1' function attribute])], [])
+
+ AS_VAR_POPDEF([ac_var])
+])
diff --git a/m4/ax_require_defined.m4 b/m4/ax_require_defined.m4
new file mode 100644
index 00000000..cae11112
--- /dev/null
+++ b/m4/ax_require_defined.m4
@@ -0,0 +1,37 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_REQUIRE_DEFINED(MACRO)
+#
+# DESCRIPTION
+#
+# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
+# been defined and thus are available for use. This avoids random issues
+# where a macro isn't expanded. Instead the configure script emits a
+# non-fatal:
+#
+# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
+#
+# It's like AC_REQUIRE except it doesn't expand the required macro.
+#
+# Here's an example:
+#
+# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+#
+# LICENSE
+#
+# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
+ m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
+])dnl AX_REQUIRE_DEFINED
diff --git a/rdp/rdp_lic.c b/rdp/rdp_lic.c
index 2441bc7f..799c14b7 100644
--- a/rdp/rdp_lic.c
+++ b/rdp/rdp_lic.c
@@ -73,6 +73,7 @@ rdp_lic_generate_hwid(struct rdp_lic *self, char *hwid)
LICENCE_HWID_SIZE - 4);
}
+#if 0
/*****************************************************************************/
/* Present an existing licence to the server */
static void APP_CC
@@ -112,6 +113,7 @@ rdp_lic_present(struct rdp_lic *self, char *client_random, char *rsa_data,
rdp_sec_send(self->sec_layer, s, sec_flags);
free_stream(s);
}
+#endif
/*****************************************************************************/
/* Send a licence request packet */
@@ -161,13 +163,7 @@ rdp_lic_process_demand(struct rdp_lic *self, struct stream *s)
{
char null_data[SEC_MODULUS_SIZE];
char *server_random;
- char signature[LICENCE_SIGNATURE_SIZE];
- char hwid[LICENCE_HWID_SIZE];
- char *licence_data;
- int licence_size;
- void *crypt_key;
- licence_data = 0;
/* Retrieve the server random from the incoming packet */
in_uint8p(s, server_random, SEC_RANDOM_SIZE);
/* We currently use null client keys. This is a bit naughty but, hey,
@@ -176,10 +172,17 @@ rdp_lic_process_demand(struct rdp_lic *self, struct stream *s)
rdp_lic_generate_keys(self, null_data, server_random, null_data);
#if 0
+ int licence_size;
+ char *licence_data;
+
licence_size = 0; /* todo load_licence(&licence_data); */
if (licence_size > 0)
{
+ void *crypt_key;
+ char hwid[LICENCE_HWID_SIZE];
+ char signature[LICENCE_SIGNATURE_SIZE];
+
/* Generate a signature for the HWID buffer */
rdp_lic_generate_hwid(self, hwid);
rdp_sec_sign(signature, 16, self->licence_sign_key, 16,
diff --git a/rdp/rdp_orders.c b/rdp/rdp_orders.c
index 3372a815..1cad819d 100644
--- a/rdp/rdp_orders.c
+++ b/rdp/rdp_orders.c
@@ -225,7 +225,6 @@ rdp_orders_process_raw_bmpcache(struct rdp_orders *self, struct stream *s,
int flags)
{
int cache_idx = 0;
- int bufsize = 0;
int cache_id = 0;
int width = 0;
int height = 0;
@@ -244,7 +243,7 @@ rdp_orders_process_raw_bmpcache(struct rdp_orders *self, struct stream *s,
in_uint8(s, height);
in_uint8(s, bpp);
Bpp = (bpp + 7) / 8;
- in_uint16_le(s, bufsize);
+ in_uint8s(s, 2); /* bufsize */
in_uint16_le(s, cache_idx);
inverted = (char *)g_malloc(width * height * Bpp, 0);
@@ -326,15 +325,11 @@ rdp_orders_process_bmpcache(struct rdp_orders *self, struct stream *s,
int bpp = 0;
int Bpp = 0;
int bufsize = 0;
- int pad1 = 0;
- int pad2 = 0;
- int row_size = 0;
- int final_size = 0;
struct rdp_bitmap *bitmap = (struct rdp_bitmap *)NULL;
struct stream *rec_s = (struct stream *)NULL;
in_uint8(s, cache_id);
- in_uint8(s, pad1);
+ in_uint8s(s, 1); /* pad */
in_uint8(s, width);
in_uint8(s, height);
in_uint8(s, bpp);
@@ -348,10 +343,10 @@ rdp_orders_process_bmpcache(struct rdp_orders *self, struct stream *s,
}
else
{
- in_uint16_le(s, pad2);
+ in_uint8s(s, 2); /* pad */
in_uint16_le(s, size);
- in_uint16_le(s, row_size);
- in_uint16_le(s, final_size);
+ in_uint8s(s, 2); /* row_size */
+ in_uint8s(s, 2); /* final_size */
}
in_uint8p(s, data, size);
@@ -1115,8 +1110,8 @@ static void APP_CC
rdp_orders_process_desksave(struct rdp_orders *self, struct stream *s,
int present, int delta)
{
- int width = 0;
- int height = 0;
+ //int width = 0;
+ //int height = 0;
if (present & 0x01)
{
diff --git a/rdp/rdp_rdp.c b/rdp/rdp_rdp.c
index 9ce63664..d5c8e27f 100644
--- a/rdp/rdp_rdp.c
+++ b/rdp/rdp_rdp.c
@@ -506,8 +506,6 @@ static int APP_CC
rdp_rdp_process_pointer_pdu(struct rdp_rdp *self, struct stream *s)
{
int message_type;
- int x;
- int y;
int rv;
rv = 0;
@@ -517,8 +515,8 @@ rdp_rdp_process_pointer_pdu(struct rdp_rdp *self, struct stream *s)
switch (message_type)
{
case RDP_POINTER_MOVE:
- in_uint16_le(s, x);
- in_uint16_le(s, y);
+ in_uint8s(s, 2); /* x */
+ in_uint8s(s, 2); /* y */
break;
case RDP_POINTER_COLOR:
rv = rdp_rdp_process_color_pointer_pdu(self, s);
@@ -934,15 +932,13 @@ int APP_CC
rdp_rdp_process_data_pdu(struct rdp_rdp *self, struct stream *s)
{
int data_pdu_type;
- int ctype;
- int len;
int rv;
rv = 0;
in_uint8s(s, 6); /* shareid, pad, streamid */
- in_uint16_le(s, len);
+ in_uint8s(s, 2); /* len */
in_uint8(s, data_pdu_type);
- in_uint8(s, ctype);
+ in_uint8s(s, 1); /* ctype */
in_uint8s(s, 2); /* clen */
switch (data_pdu_type)
@@ -983,14 +979,12 @@ rdp_rdp_process_general_caps(struct rdp_rdp *self, struct stream *s)
static void APP_CC
rdp_rdp_process_bitmap_caps(struct rdp_rdp *self, struct stream *s)
{
- int width = 0;
- int height = 0;
int bpp = 0;
in_uint16_le(s, bpp);
in_uint8s(s, 6);
- in_uint16_le(s, width);
- in_uint16_le(s, height);
+ in_uint8s(s, 2); /* width */
+ in_uint8s(s, 2); /* height */
self->mod->rdp_bpp = bpp;
/* todo, call reset if needed and use width and height */
}
diff --git a/sesman/Makefile.am b/sesman/Makefile.am
index c40112aa..68dba28e 100644
--- a/sesman/Makefile.am
+++ b/sesman/Makefile.am
@@ -1,6 +1,3 @@
-
-EXTRA_DIST = sesman.ini startwm.sh
-
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
@@ -67,8 +64,10 @@ xrdp_sesman_LDADD = \
sesmansysconfdir=$(sysconfdir)/xrdp
-sesmansysconf_DATA = \
- sesman.ini \
+dist_sesmansysconf_DATA = \
+ sesman.ini
+
+dist_sesmansysconf_SCRIPTS = \
startwm.sh
SUBDIRS = \
@@ -76,7 +75,3 @@ SUBDIRS = \
tools \
sessvc \
chansrv
-
-# must be tab below
-install-data-hook:
- chmod 755 $(DESTDIR)$(sysconfdir)/xrdp/startwm.sh
diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c
index b45fde34..e3d2f5d2 100644
--- a/sesman/chansrv/chansrv.c
+++ b/sesman/chansrv/chansrv.c
@@ -756,7 +756,6 @@ int DEFAULT_CC
my_trans_data_in(struct trans *trans)
{
struct stream *s = (struct stream *)NULL;
- int id = 0;
int size = 0;
int error = 0;
@@ -772,7 +771,7 @@ my_trans_data_in(struct trans *trans)
LOGM((LOG_LEVEL_DEBUG, "my_trans_data_in:"));
s = trans_get_in_s(trans);
- in_uint32_le(s, id);
+ in_uint8s(s, 4); /* id */
in_uint32_le(s, size);
error = trans_force_read(trans, size - 8);
@@ -1525,7 +1524,6 @@ main(int argc, char **argv)
LOGM((LOG_LEVEL_ALWAYS, "main: app started pid %d(0x%8.8x)", pid, pid));
/* set up signal handler */
- g_signal_kill(term_signal_handler); /* SIGKILL */
g_signal_terminate(term_signal_handler); /* SIGTERM */
g_signal_user_interrupt(term_signal_handler); /* SIGINT */
g_signal_pipe(nil_signal_handler); /* SIGPIPE */
diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c
index 7997dfb9..0bb9ceff 100644
--- a/sesman/chansrv/chansrv_fuse.c
+++ b/sesman/chansrv/chansrv_fuse.c
@@ -39,8 +39,6 @@
//#define USE_SYNC_FLAG
-static char g_fuse_mount_name[256] = "xrdp_client";
-
/* FUSE mount point */
char g_fuse_root_path[256] = "";
char g_fuse_clipboard_path[256] = ""; /* for clipboard use */
@@ -239,6 +237,8 @@ struct opendir_req
struct fuse_file_info *fi;
};
+static char g_fuse_mount_name[256] = "xrdp_client";
+
FIFO g_fifo_opendir;
static struct list *g_req_list = 0;
diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c
index 929805f9..a170dd23 100644
--- a/sesman/chansrv/clipboard.c
+++ b/sesman/chansrv/clipboard.c
@@ -1697,9 +1697,9 @@ clipboard_event_selection_owner_notify(XEvent *xevent)
XFixesSelectionNotifyEvent *lxevent;
lxevent = (XFixesSelectionNotifyEvent *)xevent;
- log_debug("clipboard_event_selection_owner_notify: %p", lxevent->owner);
+ log_debug("clipboard_event_selection_owner_notify: 0x%lx", lxevent->owner);
log_debug("clipboard_event_selection_owner_notify: "
- "window %d subtype %d owner %d g_wnd %d",
+ "window %ld subtype %d owner %ld g_wnd %ld",
lxevent->window, lxevent->subtype, lxevent->owner, g_wnd);
if (lxevent->owner == g_wnd)
@@ -1735,7 +1735,7 @@ clipboard_get_window_property(Window wnd, Atom prop, Atom *type, int *fmt,
Atom ltype;
log_debug("clipboard_get_window_property:");
- log_debug(" prop %d name %s", prop, get_atom_text(prop));
+ log_debug(" prop %ld name %s", prop, get_atom_text(prop));
lxdata = 0;
ltype = 0;
XGetWindowProperty(g_display, wnd, prop, 0, 0, 0,
@@ -1873,7 +1873,7 @@ clipboard_event_selection_notify(XEvent *xevent)
if (rv == 0)
{
- log_debug("clipboard_event_selection_notify: wnd %p prop %s",
+ log_debug("clipboard_event_selection_notify: wnd 0x%lx prop %s",
lxevent->requestor,
get_atom_text(lxevent->property));
rv = clipboard_get_window_property(lxevent->requestor, lxevent->property,
@@ -1922,7 +1922,7 @@ clipboard_event_selection_notify(XEvent *xevent)
atom = atoms[index];
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d",
atom, get_atom_text(atom), XA_STRING));
- log_debug("clipboard_event_selection_notify: 0x%x %s",
+ log_debug("clipboard_event_selection_notify: 0x%lx %s",
atom, get_atom_text(atom));
if (atom == g_utf8_atom)
{
@@ -1943,15 +1943,15 @@ clipboard_event_selection_notify(XEvent *xevent)
}
else
{
- log_error("clipboard_event_selection_notify: unknown atom 0x%x", atom);
+ log_error("clipboard_event_selection_notify: unknown atom 0x%lx", atom);
}
}
}
else
{
log_error("clipboard_event_selection_notify: error, "
- "target is 'TARGETS' and type[%d] or fmt[%d] not right, "
- "should be type[%d], fmt[%d]", type, fmt, XA_ATOM, 32);
+ "target is 'TARGETS' and type[%ld] or fmt[%d] not right, "
+ "should be type[%ld], fmt[%d]", type, fmt, XA_ATOM, 32);
}
}
else if (lxevent->target == g_utf8_atom)
@@ -2138,9 +2138,9 @@ clipboard_event_selection_request(XEvent *xevent)
char *xdata;
lxev = (XSelectionRequestEvent *)xevent;
- log_debug("clipboard_event_selection_request: %p", lxev->property);
- log_debug("clipboard_event_selection_request: g_wnd %d, "
- ".requestor %d .owner %d .selection %d '%s' .target %d .property %d",
+ log_debug("clipboard_event_selection_request: 0x%lx", lxev->property);
+ log_debug("clipboard_event_selection_request: g_wnd %ld, "
+ ".requestor %ld .owner %ld .selection %ld '%s' .target %ld .property %ld",
g_wnd, lxev->requestor, lxev->owner, lxev->selection,
get_atom_text(lxev->selection),
lxev->target, lxev->property);
@@ -2326,8 +2326,8 @@ clipboard_event_property_notify(XEvent *xevent)
char *cptr;
log_debug("clipboard_event_property_notify:");
- log_debug("clipboard_event_property_notify: PropertyNotify .window %d "
- ".state %d .atom %d %s", xevent->xproperty.window,
+ log_debug("clipboard_event_property_notify: PropertyNotify .window %ld "
+ ".state %d .atom %ld %s", xevent->xproperty.window,
xevent->xproperty.state, xevent->xproperty.atom,
get_atom_text(xevent->xproperty.atom));
@@ -2412,7 +2412,7 @@ clipboard_event_property_notify(XEvent *xevent)
}
else
{
- log_error("clipboard_event_property_notify: error unknown type %d",
+ log_error("clipboard_event_property_notify: error unknown type %ld",
g_clip_s2c.type);
clipboard_send_data_response_failed();
}
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 4f3f1ade..562ee82d 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -102,6 +102,7 @@ static int g_file_request_sent_type = 0;
#define CB_EPOCH_DIFF 11644473600LL
/*****************************************************************************/
+#if 0
static tui64 APP_CC
timeval2wintime(struct timeval *tv)
{
@@ -113,6 +114,7 @@ timeval2wintime(struct timeval *tv)
result += tv->tv_usec * 10;
return result;
}
+#endif
/*****************************************************************************/
/* this will replace %20 or any hex with the space or correct char
@@ -529,7 +531,6 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status,
int lindex;
int dwFlags;
int nPositionLow;
- int nPositionHigh;
int cbRequested;
//int clipDataId;
@@ -539,7 +540,7 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status,
in_uint32_le(s, lindex);
in_uint32_le(s, dwFlags);
in_uint32_le(s, nPositionLow);
- in_uint32_le(s, nPositionHigh);
+ in_uint8s(s, 4); /* nPositionHigh */
in_uint32_le(s, cbRequested);
//in_uint32_le(s, clipDataId); /* options, used when locking */
if (dwFlags & CB_FILECONTENTS_SIZE)
diff --git a/sesman/chansrv/drdynvc.c b/sesman/chansrv/drdynvc.c
index 5c20661e..5b9224ca 100644
--- a/sesman/chansrv/drdynvc.c
+++ b/sesman/chansrv/drdynvc.c
@@ -342,24 +342,24 @@ drdynvc_process_data_first(struct stream *s, unsigned char cmd)
uint32_t chan_id;
int bytes_in_stream;
- int data_len;
int Len;
drdynvc_get_chan_id(s, cmd, &chan_id);
Len = (cmd >> 2) & 0x03;
+ /* skip data_len */
if (Len == 0)
{
- in_uint8(s, data_len);
+ in_uint8s(s, 1);
}
else if (Len == 1)
{
- in_uint16_le(s, data_len);
+ in_uint8s(s, 2);
}
else
{
- in_uint32_le(s, data_len);
+ in_uint8s(s, 4);
}
bytes_in_stream = stream_length_after_p(s);
diff --git a/sesman/chansrv/pulse/module-xrdp-sink.c b/sesman/chansrv/pulse/module-xrdp-sink.c
index f56644b9..79cd7b27 100644
--- a/sesman/chansrv/pulse/module-xrdp-sink.c
+++ b/sesman/chansrv/pulse/module-xrdp-sink.c
@@ -440,7 +440,11 @@ static void thread_func(void *userdata) {
pa_rtpoll_set_timer_disabled(u->rtpoll);
}
+#if defined(PA_CHECK_VERSION) && PA_CHECK_VERSION(6, 0, 0)
+ if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
+#else
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) {
+#endif
goto fail;
}
diff --git a/sesman/chansrv/pulse/module-xrdp-source.c b/sesman/chansrv/pulse/module-xrdp-source.c
index 52409606..78124f9d 100644
--- a/sesman/chansrv/pulse/module-xrdp-source.c
+++ b/sesman/chansrv/pulse/module-xrdp-source.c
@@ -339,8 +339,13 @@ static void thread_func(void *userdata) {
}
/* Hmm, nothing to do. Let's sleep */
- if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)
+#if defined(PA_CHECK_VERSION) && PA_CHECK_VERSION(6, 0, 0)
+ if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
+#else
+ if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) {
+#endif
goto fail;
+ }
if (ret == 0)
goto finish;
diff --git a/sesman/chansrv/rail.c b/sesman/chansrv/rail.c
index 09f40eba..cad16471 100644
--- a/sesman/chansrv/rail.c
+++ b/sesman/chansrv/rail.c
@@ -508,7 +508,7 @@ rail_win_popdown(void)
window_attributes.map_state == IsViewable &&
list_index_of(g_window_list, children[i]) >= 0)
{
- LOG(10, (" dismiss pop up 0x%8.8x", children[i]));
+ LOG(10, (" dismiss pop up 0x%8.8lx", children[i]));
rail_send_key_esc(children[i]);
rv = 1;
}
@@ -756,7 +756,7 @@ rail_win_set_state(Window win, unsigned long state)
int old_state;
unsigned long data[2] = { state, None };
- LOG(10, (" rail_win_set_state: %d", state));
+ LOG(10, (" rail_win_set_state: %ld", state));
/* check whether WM_STATE exists */
old_state = rail_win_get_state(win);
if (old_state == -1)
@@ -1259,7 +1259,7 @@ rail_win_send_text(Window win)
}
if (data && len > 0)
{
- LOG(10, ("chansrv::rail_win_send_text: 0x%8.8x text %s length %d",
+ LOG(10, ("chansrv::rail_win_send_text: 0x%8.8lx text %s length %d",
win, data, len));
make_stream(s);
init_stream(s, len + 1024);
@@ -1289,7 +1289,7 @@ rail_destroy_window(Window window_id)
{
struct stream *s;
- LOG(10, ("chansrv::rail_destroy_window 0x%8.8x", window_id));
+ LOG(10, ("chansrv::rail_destroy_window 0x%8.8lx", window_id));
make_stream(s);
init_stream(s, 1024);
@@ -1309,7 +1309,7 @@ rail_show_window(Window window_id, int show_state)
int flags;
struct stream* s;
- LOG(10, ("chansrv::rail_show_window 0x%8.8x 0x%x", window_id, show_state));
+ LOG(10, ("chansrv::rail_show_window 0x%8.8lx 0x%x", window_id, show_state));
make_stream(s);
init_stream(s, 1024);
@@ -1351,7 +1351,7 @@ rail_create_window(Window window_id, Window owner_id)
struct rail_window_data* rwd;
struct stream* s;
- LOG(10, ("chansrv::rail_create_window 0x%8.8x", window_id));
+ LOG(10, ("chansrv::rail_create_window 0x%8.8lx", window_id));
rwd = rail_get_window_data_safe(window_id);
if (rwd == 0)
@@ -1507,7 +1507,7 @@ rail_configure_request_window(XConfigureRequestEvent* config)
if (mask & CWStackMode)
{
LOG(10, ("chansrv::rail_configure_request_window: CWStackMode "
- "detail 0x%8.8x above 0x%8.8x", config->detail, config->above));
+ "detail 0x%8.8x above 0x%8.8lx", config->detail, config->above));
if (config->detail == Above)
{
LOG(10, ("chansrv::rail_configure_request_window: bring to front "
@@ -1808,7 +1808,7 @@ rail_xevent(void *xevent)
{
case PropertyNotify:
prop_name = XGetAtomName(g_display, lxevent->xproperty.atom);
- LOG(10, (" got PropertyNotify window_id 0x%8.8x %s state new %d",
+ LOG(10, (" got PropertyNotify window_id 0x%8.8lx %s state new %d",
lxevent->xproperty.window, prop_name,
lxevent->xproperty.state == PropertyNewValue));
@@ -1831,7 +1831,7 @@ rail_xevent(void *xevent)
break;
case ConfigureRequest:
- LOG(10, (" got ConfigureRequest window_id 0x%8.8x", lxevent->xconfigurerequest.window));
+ LOG(10, (" got ConfigureRequest window_id 0x%8.8lx", lxevent->xconfigurerequest.window));
g_memset(&xwc, 0, sizeof(xwc));
xwc.x = lxevent->xconfigurerequest.x;
xwc.y = lxevent->xconfigurerequest.y;
@@ -1849,13 +1849,13 @@ rail_xevent(void *xevent)
break;
case CreateNotify:
- LOG(10, (" got CreateNotify window 0x%8.8x parent 0x%8.8x",
+ LOG(10, (" got CreateNotify window 0x%8.8lx parent 0x%8.8lx",
lxevent->xcreatewindow.window, lxevent->xcreatewindow.parent));
rail_select_input(lxevent->xcreatewindow.window);
break;
case DestroyNotify:
- LOG(10, (" got DestroyNotify window 0x%8.8x event 0x%8.8x",
+ LOG(10, (" got DestroyNotify window 0x%8.8lx event 0x%8.8lx",
lxevent->xdestroywindow.window, lxevent->xdestroywindow.event));
if (lxevent->xdestroywindow.window != lxevent->xdestroywindow.event)
{
@@ -1871,12 +1871,12 @@ rail_xevent(void *xevent)
break;
case MapRequest:
- LOG(10, (" got MapRequest window 0x%8.8x", lxevent->xmaprequest.window));
+ LOG(10, (" got MapRequest window 0x%8.8lx", lxevent->xmaprequest.window));
XMapWindow(g_display, lxevent->xmaprequest.window);
break;
case MapNotify:
- LOG(10, (" got MapNotify window 0x%8.8x event 0x%8.8x",
+ LOG(10, (" got MapNotify window 0x%8.8lx event 0x%8.8lx",
lxevent->xmap.window, lxevent->xmap.event));
if (lxevent->xmap.window != lxevent->xmap.event)
{
@@ -1902,7 +1902,7 @@ rail_xevent(void *xevent)
break;
case UnmapNotify:
- LOG(10, (" got UnmapNotify 0x%8.8x", lxevent->xunmap.event));
+ LOG(10, (" got UnmapNotify 0x%8.8lx", lxevent->xunmap.event));
if (lxevent->xunmap.window != lxevent->xunmap.event)
{
break;
@@ -1910,7 +1910,7 @@ rail_xevent(void *xevent)
if (is_window_valid_child_of_root(lxevent->xunmap.window))
{
index = list_index_of(g_window_list, lxevent->xunmap.window);
- LOG(10, (" window 0x%8.8x is unmapped", lxevent->xunmap.window));
+ LOG(10, (" window 0x%8.8lx is unmapped", lxevent->xunmap.window));
if (index >= 0)
{
XGetWindowAttributes(g_display, lxevent->xunmap.window, &wnd_attributes);
@@ -1929,7 +1929,7 @@ rail_xevent(void *xevent)
break;
case ConfigureNotify:
- LOG(10, (" got ConfigureNotify 0x%8.8x event 0x%8.8x", lxevent->xconfigure.window,
+ LOG(10, (" got ConfigureNotify 0x%8.8lx event 0x%8.8lx", lxevent->xconfigure.window,
lxevent->xconfigure.event));
rv = 0;
if (lxevent->xconfigure.event != lxevent->xconfigure.window ||
@@ -1975,8 +1975,8 @@ rail_xevent(void *xevent)
break;
case ReparentNotify:
- LOG(10, (" got ReparentNotify window 0x%8.8x parent 0x%8.8x "
- "event 0x%8.8x x %d y %d override redirect %d",
+ LOG(10, (" got ReparentNotify window 0x%8.8lx parent 0x%8.8lx "
+ "event 0x%8.8lx x %d y %d override redirect %d",
lxevent->xreparent.window, lxevent->xreparent.parent,
lxevent->xreparent.event, lxevent->xreparent.x,
lxevent->xreparent.y, lxevent->xreparent.override_redirect));
diff --git a/sesman/chansrv/smartcard.c b/sesman/chansrv/smartcard.c
index a07e36eb..02a30d1a 100644
--- a/sesman/chansrv/smartcard.c
+++ b/sesman/chansrv/smartcard.c
@@ -1854,8 +1854,8 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes,
}
log_debug("send_bytes %d recv_bytes %d send dwProtocol %d cbPciLength %d "
- "extra_bytes %d recv dwProtocol %d cbPciLength %d", send_bytes,
- recv_bytes, send_ior->dwProtocol, send_ior->cbPciLength,
+ "extra_bytes %d recv dwProtocol %d cbPciLength %d extra_bytes %d",
+ send_bytes, recv_bytes, send_ior->dwProtocol, send_ior->cbPciLength,
send_ior->extra_bytes, recv_ior->dwProtocol, recv_ior->cbPciLength,
recv_ior->extra_bytes);
diff --git a/sesman/chansrv/smartcard_pcsc.c b/sesman/chansrv/smartcard_pcsc.c
index 9824432e..bf3d11bb 100644
--- a/sesman/chansrv/smartcard_pcsc.c
+++ b/sesman/chansrv/smartcard_pcsc.c
@@ -259,7 +259,7 @@ free_uds_client(struct pcsc_uds_client *uds_client)
}
list_delete(context->cards);
}
- LLOGLN(10, (" left over context 0x%8.8x", context->context));
+ LLOGLN(10, (" left over context %p", context->context));
scard_send_cancel(0, context->context, context->context_bytes);
scard_send_release_context(0, context->context,
context->context_bytes);
diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c
index a0899f67..66108651 100644
--- a/sesman/chansrv/sound.c
+++ b/sesman/chansrv/sound.c
@@ -103,6 +103,7 @@ static struct xr_wave_format_ex g_pcm_44100 =
g_pcm_44100_data /* data */
};
+#if defined(XRDP_OPUS)
static char g_opus_44100_data[] = { 0 };
static struct xr_wave_format_ex g_opus_44100 =
{
@@ -115,6 +116,7 @@ static struct xr_wave_format_ex g_opus_44100 =
0, /* data size */
g_opus_44100_data /* data */
};
+#endif
#if defined(XRDP_OPUS)
diff --git a/sesman/chansrv/xcommon.c b/sesman/chansrv/xcommon.c
index d6d2d4b4..9aae4a06 100644
--- a/sesman/chansrv/xcommon.c
+++ b/sesman/chansrv/xcommon.c
@@ -63,11 +63,13 @@ xcommon_error_handler(Display *dis, XErrorEvent *xer)
/* The X server had an internal error. This is the last function called.
Do any cleanup that needs to be done on exit, like removing temporary files.
Don't worry about memory leaks */
+#if 0
static int DEFAULT_CC
xcommon_fatal_handler(Display *dis)
{
return 0;
}
+#endif
/*****************************************************************************/
/* returns time in milliseconds
diff --git a/sesman/config.h b/sesman/config.h
index 61337665..d4e86105 100644
--- a/sesman/config.h
+++ b/sesman/config.h
@@ -220,16 +220,14 @@ struct config_sesman
*/
struct list* rdp_params;
/**
- * @var log
- * @brief Log configuration struct
+ * @var xorg_params
+ * @brief Xorg additional parameter list
*/
-
struct list* xorg_params;
/**
* @var log
* @brief Log configuration struct
*/
-
//struct log_config log;
/**
* @var sec
diff --git a/sesman/libscp/libscp_lock.c b/sesman/libscp/libscp_lock.c
index bd3ff771..848c1966 100644
--- a/sesman/libscp/libscp_lock.c
+++ b/sesman/libscp/libscp_lock.c
@@ -20,14 +20,14 @@
*/
#include "libscp_lock.h"
+#include "thread_calls.h"
-#include <semaphore.h>
#include <pthread.h>
pthread_mutex_t lock_fork; /* this lock protects the counters */
pthread_mutexattr_t lock_fork_attr; /* mutex attributes */
-sem_t lock_fork_req; /* semaphore on which the process that are going to fork suspend on */
-sem_t lock_fork_wait; /* semaphore on which the suspended process wait on */
+tbus lock_fork_req; /* semaphore on which the process that are going to fork suspend on */
+tbus lock_fork_wait; /* semaphore on which the suspended process wait on */
int lock_fork_forkers_count; /* threads that want to fork */
int lock_fork_blockers_count; /* threads thar are blocking fork */
int lock_fork_waiting_count; /* threads suspended until the fork finishes */
@@ -38,8 +38,8 @@ scp_lock_init(void)
/* initializing fork lock */
pthread_mutexattr_init(&lock_fork_attr);
pthread_mutex_init(&lock_fork, &lock_fork_attr);
- sem_init(&lock_fork_req, 0, 0);
- sem_init(&lock_fork_wait, 0, 0);
+ lock_fork_req = tc_sem_create(0);
+ lock_fork_wait = tc_sem_create(0);
/* here we don't use locking because lock_init() should be called BEFORE */
/* any thread is created */
@@ -58,14 +58,14 @@ scp_lock_fork_request(void)
if (lock_fork_blockers_count == 0)
{
/* if no one is blocking fork(), then we're allowed to fork */
- sem_post(&lock_fork_req);
+ tc_sem_inc(lock_fork_req);
}
lock_fork_forkers_count++;
pthread_mutex_unlock(&lock_fork);
/* we wait to be allowed to fork() */
- sem_wait(&lock_fork_req);
+ tc_sem_dec(lock_fork_req);
}
/******************************************************************************/
@@ -78,13 +78,13 @@ scp_lock_fork_release(void)
/* if there's someone else that want to fork, we let him fork() */
if (lock_fork_forkers_count > 0)
{
- sem_post(&lock_fork_req);
+ tc_sem_inc(lock_fork_req);
}
for (; lock_fork_waiting_count > 0; lock_fork_waiting_count--)
{
/* waking up the other processes */
- sem_post(&lock_fork_wait);
+ tc_sem_inc(lock_fork_wait);
}
pthread_mutex_unlock(&lock_fork);
@@ -107,7 +107,7 @@ scp_lock_fork_critical_section_end(int blocking)
/* then we let him go */
if ((lock_fork_blockers_count == 0) && (lock_fork_forkers_count > 0))
{
- sem_post(&lock_fork_req);
+ tc_sem_inc(lock_fork_req);
}
pthread_mutex_unlock(&lock_fork);
@@ -129,7 +129,7 @@ scp_lock_fork_critical_section_start(void)
pthread_mutex_unlock(&lock_fork);
/* we wait until the fork finishes */
- sem_wait(&lock_fork_wait);
+ tc_sem_dec(lock_fork_wait);
}
else
diff --git a/sesman/libscp/libscp_v1s.c b/sesman/libscp/libscp_v1s.c
index 6d69d187..b7d422c7 100644
--- a/sesman/libscp/libscp_v1s.c
+++ b/sesman/libscp/libscp_v1s.c
@@ -647,7 +647,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
/* if we got here, the requested sid wasn't one from the list we sent */
/* we should kill the connection */
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error (no such session in list)", __LINE__);
- return SCP_CLIENT_STATE_INTERNAL_ERR;
+ return SCP_SERVER_STATE_INTERNAL_ERR;
}
else if (cmd == 44)
{
diff --git a/sesman/sesman.c b/sesman/sesman.c
index 30ca3a79..64728376 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -46,7 +46,6 @@ sesman_main_loop(void)
int error;
int robjs_count;
int cont;
- int pid;
tbus sck_obj;
tbus robjs[8];
@@ -137,7 +136,8 @@ int DEFAULT_CC
main(int argc, char **argv)
{
int fd;
- enum logReturns error;
+ enum logReturns log_error;
+ int error;
int daemon = 1;
int pid;
char pid_s[32];
@@ -241,7 +241,7 @@ main(int argc, char **argv)
{
g_printf("sesman is already running.\n");
g_printf("if it's not running, try removing ");
- g_printf(pid_file);
+ g_printf("%s", pid_file);
g_printf("\n");
g_deinit();
g_exit(1);
@@ -268,11 +268,11 @@ main(int argc, char **argv)
g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH);
/* starting logging subsystem */
- error = log_start(cfg_file, "xrdp-sesman");
+ log_error = log_start(cfg_file, "xrdp-sesman");
- if (error != LOG_STARTUP_OK)
+ if (log_error != LOG_STARTUP_OK)
{
- switch (error)
+ switch (log_error)
{
case LOG_ERROR_MALLOC:
g_writeln("error on malloc. cannot start logging. quitting.");
@@ -331,7 +331,6 @@ main(int argc, char **argv)
#if 1
g_signal_hang_up(sig_sesman_reload_cfg); /* SIGHUP */
g_signal_user_interrupt(sig_sesman_shutdown); /* SIGINT */
- g_signal_kill(sig_sesman_shutdown); /* SIGKILL */
g_signal_terminate(sig_sesman_shutdown); /* SIGTERM */
g_signal_child_stop(sig_sesman_session_end); /* SIGCHLD */
#endif
diff --git a/sesman/sesman.ini b/sesman/sesman.ini
index a58af383..3d090076 100644
--- a/sesman/sesman.ini
+++ b/sesman/sesman.ini
@@ -63,6 +63,7 @@ EnableSyslog=1
SyslogLevel=DEBUG
[X11rdp]
+param0=X11rdp
param1=-bs
param2=-ac
param3=-nolisten
@@ -70,6 +71,7 @@ param4=tcp
param5=-uds
[Xvnc]
+param0=Xvnc
param1=-bs
param2=-ac
param3=-nolisten
@@ -79,6 +81,7 @@ param6=-dpi
param7=96
[Xorg]
+param0=Xorg
param1=-config
param2=xrdp/xorg.conf
param3=-logfile
diff --git a/sesman/session.c b/sesman/session.c
index 3860c199..02bb6fa7 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -412,9 +412,10 @@ 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];
+ char screen[32]; /* display number */
char text[256];
char passwd_file[256];
char *pfile;
@@ -504,16 +505,17 @@ session_start_fork(int width, int height, int bpp, char *username,
* Create a new session and process group since the 4.4BSD
* setlogin() affects the entire process group
*/
- if (setsid() < 0)
+ if (g_setsid() < 0)
{
- log_message(LOG_LEVEL_ERROR,
- "setsid failed - pid %d", g_getpid());
+ log_message(LOG_LEVEL_ERROR,
+ "setsid failed - pid %d", g_getpid());
}
- if (setlogin(username) < 0)
+ if (g_setlogin(username) < 0)
{
- log_message(LOG_LEVEL_ERROR,
- "setlogin failed for user %s - pid %d", username, g_getpid());
+ log_message(LOG_LEVEL_ERROR,
+ "setlogin failed for user %s - pid %d", username,
+ g_getpid());
}
}
@@ -651,8 +653,12 @@ session_start_fork(int width, int height, int bpp, char *username,
xserver_params = list_create();
xserver_params->auto_free = 1;
+ /* get path of Xorg from config */
+ xserver = g_strdup((const char *)list_get_item(g_cfg->xorg_params, 0));
+ list_remove_item(g_cfg->xorg_params, 0);
+
/* these are the must have parameters */
- list_add_item(xserver_params, (tintptr) g_strdup("Xorg"));
+ list_add_item(xserver_params, (tintptr) g_strdup(xserver));
list_add_item(xserver_params, (tintptr) g_strdup(screen));
/* additional parameters from sesman.ini file */
@@ -673,7 +679,7 @@ session_start_fork(int width, int height, int bpp, char *username,
g_setenv("XRDP_START_HEIGHT", geometry, 1);
/* fire up Xorg */
- g_execvp("Xorg", pp1);
+ g_execvp(xserver, pp1);
}
else if (type == SESMAN_SESSION_TYPE_XVNC)
{
@@ -681,8 +687,12 @@ session_start_fork(int width, int height, int bpp, char *username,
xserver_params = list_create();
xserver_params->auto_free = 1;
+ /* get path of Xvnc from config */
+ xserver = g_strdup((const char *)list_get_item(g_cfg->vnc_params, 0));
+ list_remove_item(g_cfg->vnc_params, 0);
+
/* these are the must have parameters */
- list_add_item(xserver_params, (tintptr)g_strdup("Xvnc"));
+ list_add_item(xserver_params, (tintptr)g_strdup(xserver));
list_add_item(xserver_params, (tintptr)g_strdup(screen));
list_add_item(xserver_params, (tintptr)g_strdup("-geometry"));
list_add_item(xserver_params, (tintptr)g_strdup(geometry));
@@ -700,15 +710,19 @@ session_start_fork(int width, int height, int bpp, char *username,
list_add_item(xserver_params, 0);
pp1 = (char **)xserver_params->items;
log_message(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
- g_execvp("Xvnc", pp1);
+ g_execvp(xserver, pp1);
}
else if (type == SESMAN_SESSION_TYPE_XRDP)
{
xserver_params = list_create();
xserver_params->auto_free = 1;
+ /* get path of X11rdp from config */
+ xserver = g_strdup((const char *)list_get_item(g_cfg->rdp_params, 0));
+ list_remove_item(g_cfg->rdp_params, 0);
+
/* these are the must have parameters */
- list_add_item(xserver_params, (tintptr)g_strdup("X11rdp"));
+ list_add_item(xserver_params, (tintptr)g_strdup(xserver));
list_add_item(xserver_params, (tintptr)g_strdup(screen));
list_add_item(xserver_params, (tintptr)g_strdup("-geometry"));
list_add_item(xserver_params, (tintptr)g_strdup(geometry));
@@ -724,7 +738,7 @@ session_start_fork(int width, int height, int bpp, char *username,
list_add_item(xserver_params, 0);
pp1 = (char **)xserver_params->items;
log_message(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
- g_execvp("X11rdp", pp1);
+ g_execvp(xserver, pp1);
}
else
{
diff --git a/sesman/sessvc/sessvc.c b/sesman/sessvc/sessvc.c
index ce62cb47..dce88d17 100644
--- a/sesman/sessvc/sessvc.c
+++ b/sesman/sessvc/sessvc.c
@@ -93,7 +93,6 @@ main(int argc, char **argv)
return 1;
}
- g_signal_kill(term_signal_handler); /* SIGKILL */
g_signal_terminate(term_signal_handler); /* SIGTERM */
g_signal_user_interrupt(term_signal_handler); /* SIGINT */
g_signal_pipe(nil_signal_handler); /* SIGPIPE */
diff --git a/sesman/sig.c b/sesman/sig.c
index d881515b..b10be5fb 100644
--- a/sesman/sig.c
+++ b/sesman/sig.c
@@ -158,7 +158,6 @@ sig_handler_thread(void *arg)
sigaddset(&waitmask, SIGHUP);
sigaddset(&waitmask, SIGCHLD);
sigaddset(&waitmask, SIGTERM);
- sigaddset(&waitmask, SIGKILL);
sigaddset(&waitmask, SIGINT);
// sigaddset(&waitmask, SIGFPE);
@@ -188,11 +187,6 @@ sig_handler_thread(void *arg)
LOG_DBG("sesman received SIGINT", 0);
sig_sesman_shutdown(recv_signal);
break;
- case SIGKILL:
- /* we die */
- LOG_DBG("sesman received SIGKILL", 0);
- sig_sesman_shutdown(recv_signal);
- break;
case SIGTERM:
/* we die */
LOG_DBG("sesman received SIGTERM", 0);
diff --git a/sesman/tools/sesrun.c b/sesman/tools/sesrun.c
index a9181583..19932620 100644
--- a/sesman/tools/sesrun.c
+++ b/sesman/tools/sesrun.c
@@ -115,7 +115,7 @@ main(int argc, char **argv)
{
in_uint16_be(in_s, data);
in_uint16_be(in_s, display);
- g_printf("ok %d display %d\n", data, display);
+ g_printf("ok %d display %d\n", (int)data, display);
}
}
}
diff --git a/sesman/tools/sestest.c b/sesman/tools/sestest.c
index cf28f803..e1c09cf2 100644
--- a/sesman/tools/sestest.c
+++ b/sesman/tools/sestest.c
@@ -201,8 +201,8 @@ int inputSession(struct SCP_SESSION *s)
}
g_printf("session type:\n");
- g_printf("0: Xvnc\n", SCP_SESSION_TYPE_XVNC);
- g_printf("1: x11rdp\n", SCP_SESSION_TYPE_XRDP);
+ g_printf("%d: Xvnc\n", SCP_SESSION_TYPE_XVNC);
+ g_printf("%d: x11rdp\n", SCP_SESSION_TYPE_XRDP);
integer = menuSelect(1);
if (integer == 1)
diff --git a/tests/tcp_proxy/main.c b/tests/tcp_proxy/main.c
index 1cc58889..3a62c98c 100644
--- a/tests/tcp_proxy/main.c
+++ b/tests/tcp_proxy/main.c
@@ -26,7 +26,7 @@
#include <errno.h>
#include <locale.h>
#include <netdb.h>
-#include <sys/types.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -109,7 +109,7 @@ g_hexdump(char *p, int len)
g_printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
}
- g_writeln("");
+ g_writeln("%s", "");
offset += thisline;
line += thisline;
}
@@ -399,13 +399,6 @@ g_signal_user_interrupt(void (*func)(int))
/*****************************************************************************/
static void APP_CC
-g_signal_kill(void (*func)(int))
-{
- signal(SIGKILL, func);
-}
-
-/*****************************************************************************/
-static void APP_CC
g_signal_terminate(void (*func)(int))
{
signal(SIGTERM, func);
@@ -685,7 +678,6 @@ main(int argc, char **argv)
g_init("tcp_proxy");
g_signal_user_interrupt(proxy_shutdown); /* SIGINT */
- g_signal_kill(proxy_shutdown); /* SIGKILL */
g_signal_usr1(clear_counters); /* SIGUSR1 */
g_signal_terminate(proxy_shutdown); /* SIGTERM */
diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c
index 95de7be0..c08b15cd 100644
--- a/xorg/X11R7.6/rdp/rdpmain.c
+++ b/xorg/X11R7.6/rdp/rdpmain.c
@@ -139,6 +139,8 @@ static miPointerScreenFuncRec g_rdpPointerCursorFuncs =
rdpPointerNewEventScreen
};
+int glGetBufferSubData(void);
+
/******************************************************************************/
/* returns error, zero is good */
static int
@@ -189,6 +191,11 @@ set_bpp(int bpp)
g_greenBits = 8;
g_blueBits = 8;
}
+ else if (g_bpp == 33)
+ {
+ /* will never happen */
+ glGetBufferSubData();
+ }
else
{
rv = 1;
diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c
index d0ee6b1c..46c4908d 100644
--- a/xorg/X11R7.6/rdp/rdprandr.c
+++ b/xorg/X11R7.6/rdp/rdprandr.c
@@ -38,6 +38,14 @@ extern WindowPtr g_invalidate_window; /* in rdpmain.c */
static XID g_wid = 0;
+static int g_panning = 0;
+
+#define LOG_LEVEL 1
+#define LLOG(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
+
/******************************************************************************/
Bool
rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
@@ -68,15 +76,8 @@ rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
Bool
rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
- int width;
- int height;
-
ErrorF("rdpRRGetInfo:\n");
*pRotations = RR_Rotate_0;
-
- width = g_rdpScreen.width;
- height = g_rdpScreen.height;
- rdpRRRegisterSize(pScreen, width, height);
return TRUE;
}
@@ -214,6 +215,19 @@ Bool
rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
ErrorF("rdpRRCrtcGetGamma:\n");
+ crtc->gammaSize = 1;
+ if (crtc->gammaRed == NULL)
+ {
+ crtc->gammaRed = g_malloc(32, 1);
+ }
+ if (crtc->gammaBlue == NULL)
+ {
+ crtc->gammaBlue = g_malloc(32, 1);
+ }
+ if (crtc->gammaGreen == NULL)
+ {
+ crtc->gammaGreen = g_malloc(32, 1);
+ }
return TRUE;
}
@@ -257,6 +271,11 @@ rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
{
ErrorF("rdpRRGetPanning:\n");
+ if (!g_panning)
+ {
+ return FALSE;
+ }
+
if (totalArea != 0)
{
totalArea->x1 = 0;
@@ -292,3 +311,140 @@ rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
ErrorF("rdpRRSetPanning:\n");
return TRUE;
}
+
+/******************************************************************************/
+static RROutputPtr
+rdpRRAddOutput(const char *aname, int x, int y, int width, int height)
+{
+ RRModePtr mode;
+ RRCrtcPtr crtc;
+ RROutputPtr output;
+ xRRModeInfo modeInfo;
+ char name[64];
+
+ sprintf (name, "%dx%d", width, height);
+ memset (&modeInfo, 0, sizeof(modeInfo));
+ modeInfo.width = width;
+ modeInfo.height = height;
+ modeInfo.nameLength = strlen(name);
+ mode = RRModeGet(&modeInfo, name);
+ if (mode == 0)
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RRModeGet failed"));
+ return 0;
+ }
+
+ crtc = RRCrtcCreate(g_pScreen, NULL);
+ if (crtc == 0)
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RRCrtcCreate failed"));
+ RRModeDestroy(mode);
+ return 0;
+ }
+ output = RROutputCreate(g_pScreen, aname, strlen(aname), NULL);
+ if (output == 0)
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RROutputCreate failed"));
+ RRCrtcDestroy(crtc);
+ RRModeDestroy(mode);
+ return 0;
+ }
+ if (!RROutputSetClones(output, NULL, 0))
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RROutputSetClones failed"));
+ }
+ if (!RROutputSetModes(output, &mode, 1, 0))
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RROutputSetModes failed"));
+ }
+ if (!RROutputSetCrtcs(output, &crtc, 1))
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RROutputSetCrtcs failed"));
+ }
+ if (!RROutputSetConnection(output, RR_Connected))
+ {
+ LLOGLN(0, ("rdpRRAddOutput: RROutputSetConnection failed"));
+ }
+ RRCrtcNotify(crtc, mode, x, y, RR_Rotate_0, NULL, 1, &output);
+
+ return output;
+}
+
+/******************************************************************************/
+static void
+RRSetPrimaryOutput(rrScrPrivPtr pScrPriv, RROutputPtr output)
+{
+ if (pScrPriv->primaryOutput == output)
+ {
+ return;
+ }
+ /* clear the old primary */
+ if (pScrPriv->primaryOutput)
+ {
+ RROutputChanged(pScrPriv->primaryOutput, 0);
+ pScrPriv->primaryOutput = NULL;
+ }
+ /* set the new primary */
+ if (output)
+ {
+ pScrPriv->primaryOutput = output;
+ RROutputChanged(output, 0);
+ }
+ pScrPriv->layoutChanged = TRUE;
+}
+
+/******************************************************************************/
+int
+rdpRRSetRdpOutputs(void)
+{
+ rrScrPrivPtr pRRScrPriv;
+ int index;
+ int width;
+ int height;
+ char text[256];
+ RROutputPtr output;
+
+ pRRScrPriv = rrGetScrPriv(g_pScreen);
+
+ LLOGLN(0, ("rdpRRSetRdpOutputs: numCrtcs %d", pRRScrPriv->numCrtcs));
+ while (pRRScrPriv->numCrtcs > 0)
+ {
+ RRCrtcDestroy(pRRScrPriv->crtcs[0]);
+ }
+ LLOGLN(0, ("rdpRRSetRdpOutputs: numOutputs %d", pRRScrPriv->numOutputs));
+ while (pRRScrPriv->numOutputs > 0)
+ {
+ RROutputDestroy(pRRScrPriv->outputs[0]);
+ }
+
+ if (g_rdpScreen.client_info.monitorCount == 0)
+ {
+ rdpRRAddOutput("rdp0", 0, 0, g_rdpScreen.width, g_rdpScreen.height);
+ }
+ else
+ {
+ for (index = 0; index < g_rdpScreen.client_info.monitorCount; index++)
+ {
+ snprintf(text, 255, "rdp%d", index);
+ width = g_rdpScreen.client_info.minfo[index].right - g_rdpScreen.client_info.minfo[index].left + 1;
+ height = g_rdpScreen.client_info.minfo[index].bottom - g_rdpScreen.client_info.minfo[index].top + 1;
+ output = rdpRRAddOutput(text,
+ g_rdpScreen.client_info.minfo[index].left,
+ g_rdpScreen.client_info.minfo[index].top,
+ width, height);
+ if ((output != 0) && (g_rdpScreen.client_info.minfo[index].is_primary))
+ {
+ RRSetPrimaryOutput(pRRScrPriv, output);
+ }
+ }
+ }
+
+ for (index = 0; index < pRRScrPriv->numOutputs; index++)
+ {
+ RROutputSetCrtcs(pRRScrPriv->outputs[index], pRRScrPriv->crtcs,
+ pRRScrPriv->numCrtcs);
+ }
+
+ return 0;
+}
+
diff --git a/xorg/X11R7.6/rdp/rdprandr.h b/xorg/X11R7.6/rdp/rdprandr.h
index 3aba7e1a..1860fa96 100644
--- a/xorg/X11R7.6/rdp/rdprandr.h
+++ b/xorg/X11R7.6/rdp/rdprandr.h
@@ -57,4 +57,7 @@ Bool
rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border);
+int
+rdpRRSetRdpOutputs(void);
+
#endif
diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c
index 0532d063..c9091a7d 100644
--- a/xorg/X11R7.6/rdp/rdpup.c
+++ b/xorg/X11R7.6/rdp/rdpup.c
@@ -22,6 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "rdp.h"
#include "xrdp_rail.h"
#include "rdpglyph.h"
+#include "rdprandr.h"
#include <signal.h>
#include <sys/ipc.h>
@@ -712,7 +713,6 @@ sck_can_recv(int sck, int millis)
static int
process_screen_size_msg(int width, int height, int bpp)
{
- RRScreenSizePtr pSize;
int mmwidth;
int mmheight;
int bytes;
@@ -784,9 +784,6 @@ process_screen_size_msg(int width, int height, int bpp)
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
- pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
- RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize);
-
if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height))
{
LLOGLN(0, (" calling RRScreenSizeSet"));
@@ -930,6 +927,7 @@ rdpup_process_msg(struct stream *s)
int y;
int cx;
int cy;
+ int index;
RegionRec reg;
BoxRec box;
@@ -1119,16 +1117,45 @@ rdpup_process_msg(struct stream *s)
{
LLOGLN(0, (" client can not do new(color) cursor"));
}
+
if (g_rdpScreen.client_info.monitorCount > 0)
{
LLOGLN(0, (" client can do multimon"));
LLOGLN(0, (" client monitor data, monitorCount= %d", g_rdpScreen.client_info.monitorCount));
+ box.x1 = g_rdpScreen.client_info.minfo[0].left;
+ box.y1 = g_rdpScreen.client_info.minfo[0].top;
+ box.x2 = g_rdpScreen.client_info.minfo[0].right;
+ box.y2 = g_rdpScreen.client_info.minfo[0].bottom;
g_do_multimon = 1;
+ /* adjust monitor info so it's not negitive */
+ for (index = 1; index < g_rdpScreen.client_info.monitorCount; index++)
+ {
+ box.x1 = min(box.x1, g_rdpScreen.client_info.minfo[index].left);
+ box.y1 = min(box.y1, g_rdpScreen.client_info.minfo[index].top);
+ box.x2 = max(box.x2, g_rdpScreen.client_info.minfo[index].right);
+ box.y2 = max(box.y2, g_rdpScreen.client_info.minfo[index].bottom);
+ }
+ for (index = 0; index < g_rdpScreen.client_info.monitorCount; index++)
+ {
+ g_rdpScreen.client_info.minfo[index].left -= box.x1;
+ g_rdpScreen.client_info.minfo[index].top -= box.y1;
+ g_rdpScreen.client_info.minfo[index].right -= box.x1;
+ g_rdpScreen.client_info.minfo[index].bottom -= box.y1;
+ LLOGLN(0, (" left %d top %d right %d bottom %d",
+ g_rdpScreen.client_info.minfo[index].left,
+ g_rdpScreen.client_info.minfo[index].top,
+ g_rdpScreen.client_info.minfo[index].right,
+ g_rdpScreen.client_info.minfo[index].bottom));
+ }
+ rdpRRSetRdpOutputs();
+ RRTellChanged(g_pScreen);
}
else
{
LLOGLN(0, (" client can not do multimon"));
g_do_multimon = 0;
+ rdpRRSetRdpOutputs();
+ RRTellChanged(g_pScreen);
}
rdpLoadLayout(&(g_rdpScreen.client_info));
diff --git a/xorgxrdp b/xorgxrdp
-Subproject 3379d2c483599b00b1af34a2f6ae5bbc358299a
+Subproject a0add6c7fc543b06836642d3960b38556e35076
diff --git a/xrdp/Makefile.am b/xrdp/Makefile.am
index d9fc2a67..67ff4df8 100644
--- a/xrdp/Makefile.am
+++ b/xrdp/Makefile.am
@@ -1,5 +1,3 @@
-EXTRA_DIST = $(xrdpsysconf_DATA) $(xrdppkgdata_DATA)
-
EXTRA_INCLUDES =
EXTRA_LIBS =
EXTRA_FLAGS =
@@ -60,13 +58,13 @@ xrdp_LDFLAGS = \
xrdpsysconfdir=$(sysconfdir)/xrdp
-xrdpsysconf_DATA = \
+dist_xrdpsysconf_DATA = \
xrdp.ini \
xrdp_keyboard.ini
xrdppkgdatadir=$(datadir)/xrdp
-xrdppkgdata_DATA = \
+dist_xrdppkgdata_DATA = \
ad24b.bmp \
ad256.bmp \
xrdp24b.bmp \
diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c
index 12fcb2fa..88743cc6 100644
--- a/xrdp/xrdp.c
+++ b/xrdp/xrdp.c
@@ -107,7 +107,7 @@ xrdp_shutdown(int sig)
threadid = tc_get_threadid();
g_writeln("shutting down");
- g_writeln("signal %d threadid %p", sig, threadid);
+ g_writeln("signal %d threadid %lld", sig, (long long)threadid);
if (!g_is_wait_obj_set(g_term_event))
{
@@ -293,65 +293,87 @@ xrdp_process_params(int argc, char **argv,
}
/*****************************************************************************/
-int DEFAULT_CC
-main(int argc, char **argv)
+/* Basic sanity checks before any forking */
+int
+xrdp_sanity_check(void)
{
- int test;
+ int intval = 1;
int host_be;
- char cfg_file[256];
- enum logReturns error;
- struct xrdp_startup_params *startup_params;
- int pid;
- int fd;
- int no_daemon;
- char text[256];
- char pid_file[256];
-
- g_init("xrdp");
- ssl_init();
-
- for (test = 0; test < argc; test++)
- {
- DEBUG(("Argument %i - %s", test, argv[test]));
- }
+ char key_file[256];
/* check compiled endian with actual endian */
- test = 1;
- host_be = !((int)(*(unsigned char *)(&test)));
+ host_be = !((int)(*(unsigned char *)(&intval)));
+
#if defined(B_ENDIAN)
if (!host_be)
+ {
+ g_writeln("Not a big endian machine, edit arch.h");
+ return 1;
+ }
#endif
#if defined(L_ENDIAN)
- if (host_be)
+ if (host_be)
+ {
+ g_writeln("Not a little endian machine, edit arch.h");
+ return 1;
+ }
#endif
- {
- g_writeln("endian wrong, edit arch.h");
- return 0;
- }
/* check long, int and void* sizes */
if (sizeof(int) != 4)
{
g_writeln("unusable int size, must be 4");
- return 0;
+ return 1;
}
if (sizeof(long) != sizeof(void *))
{
g_writeln("long size must match void* size");
- return 0;
+ return 1;
}
if (sizeof(long) != 4 && sizeof(long) != 8)
{
g_writeln("unusable long size, must be 4 or 8");
- return 0;
+ return 1;
}
if (sizeof(tui64) != 8)
{
g_writeln("unusable tui64 size, must be 8");
- return 0;
+ return 1;
+ }
+
+ g_snprintf(key_file, 255, "%s/rsakeys.ini", XRDP_CFG_PATH);
+ if (!g_file_exist(key_file))
+ {
+ g_writeln("File %s is missing, create it using xrdp-keygen", key_file);
+ return 1;
+ }
+
+ return 0;
+}
+
+/*****************************************************************************/
+int DEFAULT_CC
+main(int argc, char **argv)
+{
+ int test;
+ char cfg_file[256];
+ enum logReturns error;
+ struct xrdp_startup_params *startup_params;
+ int pid;
+ int fd;
+ int no_daemon;
+ char text[256];
+ char pid_file[256];
+
+ g_init("xrdp");
+ ssl_init();
+
+ for (test = 0; test < argc; test++)
+ {
+ DEBUG(("Argument %i - %s", test, argv[test]));
}
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
@@ -363,7 +385,7 @@ main(int argc, char **argv)
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
- g_writeln("");
+ g_writeln("%s", "");
g_deinit();
g_exit(0);
}
@@ -373,34 +395,41 @@ main(int argc, char **argv)
if (startup_params->help)
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://www.xrdp.org for more information.");
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("Usage: xrdp [options]");
g_writeln(" --help: show help");
g_writeln(" --nodaemon: don't fork into background");
g_writeln(" --kill: shut down xrdp");
g_writeln(" --port: tcp listen port");
g_writeln(" --fork: fork on new connection");
- g_writeln("");
+ g_writeln("%s", "");
g_deinit();
g_exit(0);
}
if (startup_params->version)
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2014");
g_writeln("See http://www.xrdp.org for more information.");
g_writeln("Version %s", PACKAGE_VERSION);
- g_writeln("");
+ g_writeln("%s", "");
g_deinit();
g_exit(0);
}
+ if (xrdp_sanity_check() != 0)
+ {
+ g_writeln("Fatal error occurred, exiting");
+ g_deinit();
+ g_exit(1);
+ }
+
if (startup_params->kill)
{
g_writeln("stopping xrdp");
@@ -463,8 +492,8 @@ main(int argc, char **argv)
if (g_file_exist(pid_file)) /* xrdp.pid */
{
- g_writeln("It looks like xrdp is already running,");
- g_writeln("if not delete the xrdp.pid file and try again");
+ g_writeln("It looks like xrdp is already running.");
+ g_writeln("If not, delete %s and try again.", pid_file);
g_deinit();
g_exit(0);
}
@@ -563,7 +592,6 @@ main(int argc, char **argv)
g_threadid = tc_get_threadid();
g_listen = xrdp_listen_create();
g_signal_user_interrupt(xrdp_shutdown); /* SIGINT */
- g_signal_kill(xrdp_shutdown); /* SIGKILL */
g_signal_pipe(pipe_sig); /* SIGPIPE */
g_signal_terminate(xrdp_shutdown); /* SIGTERM */
g_signal_child_stop(xrdp_child); /* SIGCHLD */
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index 64ebdaf4..1ee0b3bc 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -817,6 +817,7 @@ xrdp_mm_process_rail_create_window(struct xrdp_mm* self, struct stream* s)
return rv;
}
+#if 0
/*****************************************************************************/
/* returns error
process rail configure window order */
@@ -883,6 +884,7 @@ xrdp_mm_process_rail_configure_window(struct xrdp_mm* self, struct stream* s)
g_free(rwso.visibility_rects);
return rv;
}
+#endif
/*****************************************************************************/
/* returns error
@@ -1056,7 +1058,6 @@ xrdp_mm_chan_data_in(struct trans *trans)
{
struct xrdp_mm *self;
struct stream *s;
- int id;
int size;
int error;
@@ -1073,7 +1074,7 @@ xrdp_mm_chan_data_in(struct trans *trans)
return 1;
}
- in_uint32_le(s, id);
+ in_uint8s(s, 4); /* id */
in_uint32_le(s, size);
error = trans_force_read(trans, size - 8);
@@ -2658,7 +2659,7 @@ server_msg(struct xrdp_mod *mod, char *msg, int code)
if (code == 1)
{
- g_writeln(msg);
+ g_writeln("%s",msg);
return 0;
}
@@ -2929,7 +2930,6 @@ int read_allowed_channel_names(struct list *names, struct list *values)
int fd;
int ret = 0;
char cfg_file[256];
- int pos;
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file);
@@ -2938,7 +2938,6 @@ int read_allowed_channel_names(struct list *names, struct list *values)
{
names->auto_free = 1;
values->auto_free = 1;
- pos = 0;
/* all values in this section can be valid channel names */
if (file_read_section(fd, "channels", names, values) == 0)
diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c
index e47f36ed..522c83d5 100644
--- a/xrdp/xrdp_painter.c
+++ b/xrdp/xrdp_painter.c
@@ -915,7 +915,6 @@ xrdp_painter_composite(struct xrdp_painter* self,
int k;
int dx;
int dy;
- int palette_id;
int cache_srcidx;
int cache_mskidx;
@@ -939,7 +938,6 @@ xrdp_painter_composite(struct xrdp_painter* self,
dstx += dx;
dsty += dy;
- palette_id = 0;
cache_srcidx = src->item_index;
cache_mskidx = -1;
if (mskflags & 1)
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index 362d0d0a..ddadbe5a 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -1867,7 +1867,7 @@ void add_string_to_logwindow(char *msg, struct list *log)
do
{
new_part_message = g_strndup(current_pointer, LOG_WINDOW_CHAR_PER_LINE) ;
- g_writeln(new_part_message);
+ g_writeln("%s",new_part_message);
list_add_item(log, (long)new_part_message);
processedlen = processedlen + g_strlen(new_part_message);
current_pointer = current_pointer + g_strlen(new_part_message) ;
diff --git a/xrdp/xrdpwin.c b/xrdp/xrdpwin.c
index 99eb5c76..224efc0c 100644
--- a/xrdp/xrdpwin.c
+++ b/xrdp/xrdpwin.c
@@ -344,16 +344,16 @@ main(int argc, char **argv)
g_strncasecmp(argv[1], "--help", 255) == 0 ||
g_strncasecmp(argv[1], "-h", 255) == 0)
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2011");
g_writeln("See http://xrdp.sourceforge.net for more information.");
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("Usage: xrdp [options]");
g_writeln(" -h: show help");
g_writeln(" -install: install service");
g_writeln(" -remove: remove service");
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
else if (g_strncasecmp(argv[1], "-install", 255) == 0 ||
@@ -423,7 +423,7 @@ main(int argc, char **argv)
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
}
@@ -431,7 +431,7 @@ main(int argc, char **argv)
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
@@ -499,34 +499,34 @@ main(int argc, char **argv)
g_strncasecmp(argv[1], "--help", 255) == 0 ||
g_strncasecmp(argv[1], "-h", 255) == 0)
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2011");
g_writeln("See http://xrdp.sourceforge.net for more information.");
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("Usage: xrdp [options]");
g_writeln(" -h: show help");
g_writeln(" -nodaemon: don't fork into background");
g_writeln(" -kill: shut down xrdp");
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
else if ((g_strncasecmp(argv[1], "-v", 255) == 0) ||
(g_strncasecmp(argv[1], "--version", 255) == 0))
{
- g_writeln("");
+ g_writeln("%s", "");
g_writeln("xrdp: A Remote Desktop Protocol server.");
g_writeln("Copyright (C) Jay Sorg 2004-2011");
g_writeln("See http://xrdp.sourceforge.net for more information.");
g_writeln("Version %s", PACKAGE_VERSION);
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
else
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
}
@@ -534,14 +534,14 @@ main(int argc, char **argv)
{
g_writeln("Unknown Parameter");
g_writeln("xrdp -h for help");
- g_writeln("");
+ g_writeln("%s", "");
g_exit(0);
}
if (g_file_exist(pid_file)) /* xrdp.pid */
{
- g_writeln("It looks like xrdp is already running,");
- g_writeln("if not delete the xrdp.pid file and try again");
+ g_writeln("It looks like xrdp is already running.");
+ g_writeln("If not, delete %s and try again.", pid_file);
g_exit(0);
}
@@ -618,7 +618,6 @@ main(int argc, char **argv)
g_threadid = tc_get_threadid();
g_listen = xrdp_listen_create();
g_signal_user_interrupt(xrdp_shutdown); /* SIGINT */
- g_signal_kill(xrdp_shutdown); /* SIGKILL */
g_signal_pipe(pipe_sig); /* SIGPIPE */
g_signal_terminate(xrdp_shutdown); /* SIGTERM */
g_sync_mutex = tc_mutex_create();
diff --git a/xup/xup.c b/xup/xup.c
index 8e904d52..c93fa799 100644
--- a/xup/xup.c
+++ b/xup/xup.c
@@ -212,7 +212,7 @@ lib_mod_connect(struct mod *mod)
if (trans_connect(mod->trans, mod->ip, con_port, 3000) == 0)
{
LLOGLN(0, ("lib_mod_connect: connected to Xserver "
- "(Xorg or X11rdp) sck %d", mod->trans->sck));
+ "(Xorg or X11rdp) sck %ld", mod->trans->sck));
error = 0;
}
@@ -1151,10 +1151,6 @@ process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s)
int shmem_offset;
int width;
int height;
- int x;
- int y;
- int cx;
- int cy;
int index;
int rv;
tsi16 *ldrects;