Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config.log
config.status
config.sub
configure
*.core
depcomp
.deps/
genkeymap/xrdp-genkeymap
Expand Down Expand Up @@ -41,6 +42,11 @@ sesman/xrdp-sesman
sesman/sesman.ini
*.so
stamp-h1
test-driver
test-suite.log
tests/test.sh.log
tests/test.sh.trs
tests/common/os_calls/g_time
xrdp/xrdp
xrdp/xrdp.ini
configure_params.h
5 changes: 4 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \
--without-systemdsystemunitdir \
--enable-strict-locations

# There're mixed contents automake and non-automake files/directories
# under tests/ directory. List only non-automakes EXTRA_DIST.
EXTRA_DIST = \
COPYING \
README.md \
Expand Down Expand Up @@ -64,7 +66,8 @@ SUBDIRS = \
genkeymap \
xrdpapi \
pkgconfig \
$(XRDPVRDIR)
$(XRDPVRDIR) \
tests

distclean-local:
-rm -f xrdp_configure_options.h
3 changes: 3 additions & 0 deletions common/arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ typedef unsigned long uintptr_t;
#endif
#endif

#define __STDC_FORMAT_MACROS
#include <inttypes.h>

typedef int bool_t;

/* you can define L_ENDIAN or B_ENDIAN and NEED_ALIGN or NO_NEED_ALIGN
Expand Down
10 changes: 5 additions & 5 deletions common/os_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -3538,24 +3538,24 @@ g_time1(void)
/*****************************************************************************/
/* returns the number of milliseconds since the machine was
started. */
int
uint64_t
g_time2(void)
{
#if defined(_WIN32)
return (int)GetTickCount();
return (uint64_t)GetTickCount();
#else
struct tms tm;
clock_t num_ticks = 0;
g_memset(&tm, 0, sizeof(struct tms));
num_ticks = times(&tm);
return (int)(num_ticks * 10);
return (uint64_t)(num_ticks * 10);
#endif
}

/*****************************************************************************/
/* returns time in milliseconds, uses gettimeofday
does not work in win32 */
int
uint64_t
g_time3(void)
{
#if defined(_WIN32)
Expand All @@ -3564,7 +3564,7 @@ g_time3(void)
struct timeval tp;

gettimeofday(&tp, 0);
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
return ((uint64_t)tp.tv_sec * 1000) + ((uint64_t)tp.tv_usec / 1000);
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions common/os_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ int g_getuser_info(const char* username, int* gid, int* uid, char** shell,
int g_getgroup_info(const char* groupname, int* gid);
int g_check_user_in_group(const char* username, int gid, int* ok);
int g_time1(void);
int g_time2(void);
int g_time3(void);
uint64_t g_time2(void);
uint64_t g_time3(void);
int g_save_to_bmp(const char* filename, char* data, int stride_bytes,
int width, int height, int depth, int bits_per_pixel);
int g_text2bool(const char *s);
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ AC_CONFIG_FILES([
sesman/libscp/Makefile
sesman/Makefile
sesman/tools/Makefile
tests/Makefile
tests/common/Makefile
tests/common/os_calls/Makefile
vnc/Makefile
xrdpapi/Makefile
xrdp/Makefile
Expand Down
2 changes: 1 addition & 1 deletion libxrdp/xrdp_orders.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{ \
if (_log_level < LLOG_LEVEL) \
{ \
g_write("xrdp_orders.c [%10.10u]: ", g_time3()); \
g_write("xrdp_orders.c [%"PRIu64"]: ", g_time3()); \
g_writeln _params ; \
} \
}
Expand Down
2 changes: 1 addition & 1 deletion sesman/chansrv/chansrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int remove_struct_with_chan_id(tui32 dvc_chan_id);
{ \
if (_a < LOG_LEVEL) \
{ \
g_write("xrdp-chansrv [%10.10u]: ", g_time3()); \
g_write("xrdp-chansrv [%"PRIu64"]: ", g_time3()); \
g_writeln _params ; \
} \
}
Expand Down
8 changes: 4 additions & 4 deletions sesman/chansrv/chansrv_fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ void xfuse_devredir_cb_file_close(void *vp) {}

#define log_error(_params...) \
{ \
g_write("[%10.10u]: FUSE %s: %d : ERROR: ", \
g_write("[%"PRIu64"]: FUSE %s: %d : ERROR: ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}

#define log_always(_params...) \
{ \
g_write("[%10.10u]: FUSE %s: %d : ALWAYS: ", \
g_write("[%"PRIu64"]: FUSE %s: %d : ALWAYS: ",\
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}
Expand All @@ -148,7 +148,7 @@ void xfuse_devredir_cb_file_close(void *vp) {}
{ \
if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: FUSE %s: %d : ", \
g_write("[%"PRIu64"]: FUSE %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -158,7 +158,7 @@ void xfuse_devredir_cb_file_close(void *vp) {}
{ \
if (LOG_DEBUG <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: FUSE %s: %d : ", \
g_write("[%"PRIu64"]: FUSE %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
8 changes: 4 additions & 4 deletions sesman/chansrv/clipboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ x-special/gnome-copied-files

#define log_error(_params...) \
{ \
g_write("[%10.10u]: CLIPBOARD %s: %d : ERROR: ", \
g_write("[%"PRIu64"]: CLIPBOARD %s: %d : ERROR: ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}

#define log_always(_params...) \
{ \
g_write("[%10.10u]: CLIPBOARD %s: %d : ALWAYS: ", \
g_write("[%"PRIu64"]: CLIPBOARD %s: %d : ALWAYS: ",\
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}
Expand All @@ -202,7 +202,7 @@ x-special/gnome-copied-files
{ \
if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: CLIPBOARD %s: %d : ", \
g_write("[%"PRIu64"]: CLIPBOARD %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -212,7 +212,7 @@ x-special/gnome-copied-files
{ \
if (LOG_DEBUG <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: CLIPBOARD %s: %d : ", \
g_write("[%"PRIu64"]: CLIPBOARD %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
8 changes: 4 additions & 4 deletions sesman/chansrv/clipboard_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@

#define log_error(_params...) \
{ \
g_write("[%10.10u]: CLIPFILE %s: %d : ERROR: ", \
g_write("[%"PRIu64"]: CLIPFILE %s: %d : ERROR: ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}

#define log_always(_params...) \
{ \
g_write("[%10.10u]: CLIPFILE %s: %d : ALWAYS: ", \
g_write("[%"PRIu64"]: CLIPFILE %s: %d : ALWAYS: ",\
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}
Expand All @@ -65,7 +65,7 @@
{ \
if (LOG_INFO <= LOG_LVL) \
{ \
g_write("[%10.10u]: CLIPFILE %s: %d : ", \
g_write("[%"PRIu64"]: CLIPFILE %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -75,7 +75,7 @@
{ \
if (LOG_DEBUG <= LOG_LVL) \
{ \
g_write("[%10.10u]: CLIPFILE %s: %d : ", \
g_write("[%"PRIu64"]: CLIPFILE %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
6 changes: 3 additions & 3 deletions sesman/chansrv/devredir.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

#define log_error(_params...) \
{ \
g_write("[%10.10u]: DEV_REDIR %s: %d : ERROR: ", \
g_write("[%"PRIu64"]: DEV_REDIR %s: %d : ERROR: ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}
Expand All @@ -75,7 +75,7 @@
{ \
if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
g_write("[%"PRIu64"]: DEV_REDIR %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -85,7 +85,7 @@
{ \
if (LOG_DEBUG <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
g_write("[%"PRIu64"]: DEV_REDIR %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
6 changes: 3 additions & 3 deletions sesman/chansrv/irp.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#define log_error(_params...) \
{ \
g_write("[%10.10u]: IRP %s: %d : ERROR: ", \
g_write("[%"PRIu64"]: IRP %s: %d : ERROR: ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
}
Expand All @@ -49,7 +49,7 @@
{ \
if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: IRP %s: %d : ", \
g_write("[%"PRIu64"]: IRP %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -59,7 +59,7 @@
{ \
if (LOG_DEBUG <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: IRP %s: %d : ", \
g_write("[%"PRIu64"]: IRP %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
10 changes: 5 additions & 5 deletions sesman/chansrv/mlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define log_error(_params...) \
do \
{ \
g_write("[%10.10u]: %s %s: %d: ERROR: ", g_time3(), \
g_write("[%"PRIu64"]: %s %s: %d: ERROR: ", g_time3(), \
MODULE_NAME, __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -51,7 +51,7 @@ while(0)
#define log_always(_params...) \
do \
{ \
g_write("[%10.10u]: %s %s: %d: ALWAYS: ", g_time3(), \
g_write("[%"PRIu64"]: %s %s: %d: ALWAYS: ", g_time3(), \
MODULE_NAME, __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -67,7 +67,7 @@ do \
{ \
if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: %s %s: %d: INFO: ", g_time3(), \
g_write("[%"PRIu64"]: %s %s: %d: INFO: ", g_time3(), \
MODULE_NAME, __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -83,7 +83,7 @@ do \
{ \
if (LOG_DEBUG_LOW <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: %s %s: %d: DEBUG: ", g_time3(), \
g_write("[%"PRIu64"]: %s %s: %d: DEBUG: ", g_time3(), \
MODULE_NAME, __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -99,7 +99,7 @@ do \
{ \
if (LOG_DEBUG_HIGH <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: %s %s: %d: DEBUG: ", g_time3(), \
g_write("[%"PRIu64"]: %s %s: %d: DEBUG: ", g_time3(), \
MODULE_NAME, __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
6 changes: 3 additions & 3 deletions sesman/chansrv/smartcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#define log_error(_params...) \
do \
{ \
g_write("[%10.10u]: SMART_CARD %s: %d : ERROR: ", \
g_write("[%"PRIu64"]: SMART_CARD %s: %d : ERROR: ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} while (0)
Expand All @@ -80,7 +80,7 @@ do \
{ \
if (LOG_INFO <= LOG_LEVEL) \
{ \
g_write("[%10.10u]: SMART_CARD %s: %d : ", \
g_write("[%"PRIu64"]: SMART_CARD %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand All @@ -92,7 +92,7 @@ do \
if (LOG_DEBUG <= LOG_LEVEL) \
if (2 <= 1) \
{ \
g_write("[%10.10u]: SMART_CARD %s: %d : ", \
g_write("[%"PRIu64"]: SMART_CARD %s: %d : ", \
g_time3(), __func__, __LINE__); \
g_writeln (_params); \
} \
Expand Down
2 changes: 1 addition & 1 deletion sesman/chansrv/smartcard_pcsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{ \
if (_level < LLOG_LEVEL) \
{ \
g_write("chansrv:smartcard_pcsc [%10.10u]: ", g_time3()); \
g_write("chansrv:smartcard_pcsc [%"PRIu64"]: ", g_time3()); \
g_writeln _args ; \
} \
} \
Expand Down
4 changes: 4 additions & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
!Makefile
# ignore generated Makefiles
/Makefile
common/Makefile
common/os_calls/Makefile
16 changes: 16 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TESTS = \
test.sh

EXTRA_DIST= \
test.sh

AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common

SUBDIRS = \
common

9 changes: 9 additions & 0 deletions tests/common/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
-I$(top_srcdir)/common

SUBDIRS = \
os_calls
Loading