summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--common/os_calls.c15
-rw-r--r--libxrdp/xrdp_mcs.c7
-rw-r--r--xrdp/xrdp_cache.c3
-rw-r--r--xrdp/xrdp_font.c17
-rw-r--r--xrdp/xrdp_listen.c14
-rw-r--r--xrdp/xrdp_mm.c46
-rw-r--r--xrdp/xrdp_wm.c10
8 files changed, 71 insertions, 44 deletions
diff --git a/.gitignore b/.gitignore
index 0dc0f236..5f4393fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,4 +35,5 @@ xrdp-sesrun
xrdp-sessvc
xrdp-sestest
xrdp-dis
-xrdp/xrdp \ No newline at end of file
+xrdp/xrdp
+/build/ \ No newline at end of file
diff --git a/common/os_calls.c b/common/os_calls.c
index 07f378e5..a3daaa3a 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -60,6 +60,7 @@
#include "os_calls.h"
#include "arch.h"
+#include "log.h"
/* for clearenv() */
#if defined(_WIN32)
@@ -493,6 +494,7 @@ g_tcp_local_socket(void)
void APP_CC
g_tcp_close(int sck)
{
+ char ip[256] ;
if (sck == 0)
{
return;
@@ -501,6 +503,8 @@ g_tcp_close(int sck)
#if defined(_WIN32)
closesocket(sck);
#else
+ g_write_ip_address(sck,ip,256);
+ log_message(LOG_LEVEL_INFO,"An established connection closed to endpoint: %s", ip);
close(sck);
#endif
}
@@ -636,6 +640,8 @@ g_tcp_listen(int sck)
int APP_CC
g_tcp_accept(int sck)
{
+ int ret ;
+ char ipAddr[256] ;
struct sockaddr_in s;
#if defined(_WIN32)
signed int i;
@@ -645,7 +651,14 @@ g_tcp_accept(int sck)
i = sizeof(struct sockaddr_in);
memset(&s, 0, i);
- return accept(sck, (struct sockaddr *)&s, &i);
+ ret = accept(sck, (struct sockaddr *)&s, &i);
+ if(ret>0)
+ {
+ snprintf(ipAddr,256,"A connection received from: %s port %d"
+ ,inet_ntoa(s.sin_addr),ntohs(s.sin_port));
+ log_message(LOG_LEVEL_INFO,ipAddr);
+ }
+ return ret ;
}
/*****************************************************************************/
diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c
index 77c0d10d..435595e5 100644
--- a/libxrdp/xrdp_mcs.c
+++ b/libxrdp/xrdp_mcs.c
@@ -19,6 +19,7 @@
*/
#include "libxrdp.h"
+#include "log.h"
/*****************************************************************************/
struct xrdp_mcs *APP_CC
@@ -146,12 +147,12 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
{
in_uint16_be(s, userid);
in_uint16_be(s, chanid);
- g_writeln("channel join request received %d:%d", userid, chanid);
+ log_message(LOG_LEVEL_DEBUG,"MCS_CJRQ - channel join request received");
DEBUG(("xrdp_mcs_recv adding channel %4.4x", chanid));
if (xrdp_mcs_send_cjcf(self, userid, chanid) != 0)
{
- g_writeln("Non handled error from xrdp_mcs_send_cjcf") ;
+ log_message(LOG_LEVEL_ERROR,"Non handled error from xrdp_mcs_send_cjcf") ;
}
continue;
@@ -163,7 +164,7 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
}
else
{
- g_writeln("Recieved an unhandled appid:%d", appid);
+ log_message(LOG_LEVEL_DEBUG,"Recieved an unhandled appid:%d",appid);
}
break;
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index dfc7e60b..2c6f901a 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -19,6 +19,7 @@
*/
#include "xrdp.h"
+#include "log.h"
/*****************************************************************************/
struct xrdp_cache *APP_CC
@@ -224,7 +225,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
}
else
{
- g_writeln("error in xrdp_cache_add_bitmap, too big(%d)", bmp_size);
+ log_message(LOG_LEVEL_ERROR,"error in xrdp_cache_add_bitmap, too big(%d)", bmp_size);
}
/* look for oldest */
diff --git a/xrdp/xrdp_font.c b/xrdp/xrdp_font.c
index 91734807..18e6c21f 100644
--- a/xrdp/xrdp_font.c
+++ b/xrdp/xrdp_font.c
@@ -37,6 +37,7 @@
*/
#include "xrdp.h"
+#include "log.h"
#if 0 /* not used */
static char w_char[] =
@@ -80,8 +81,8 @@ xrdp_font_create(struct xrdp_wm *wm)
if (!g_file_exist(file_path))
{
- g_writeln("xrdp_font_create: error font file [%s] does not exist",
- file_path);
+ log_message(LOG_LEVEL_ERROR,"xrdp_font_create: error font file [%s] does not exist",
+ file_path);
return 0;
}
@@ -89,8 +90,8 @@ xrdp_font_create(struct xrdp_wm *wm)
if (file_size < 1)
{
- g_writeln("xrdp_font_create: error reading font from file [%s]",
- file_path);
+ log_message(LOG_LEVEL_ERROR,"xrdp_font_create: error reading font from file [%s]",
+ file_path);
return 0;
}
@@ -134,9 +135,9 @@ xrdp_font_create(struct xrdp_wm *wm)
if (datasize < 0 || datasize > 512)
{
/* shouldn't happen */
- g_writeln("error in xrdp_font_create, datasize wrong");
- g_writeln("width %d height %d datasize %d index %d",
- f->width, f->height, datasize, index);
+ log_message(LOG_LEVEL_ERROR,"error in xrdp_font_create, datasize wrong");
+ log_message(LOG_LEVEL_DEBUG,"width %d height %d datasize %d index %d",
+ f->width, f->height, datasize, index);
break;
}
@@ -147,7 +148,7 @@ xrdp_font_create(struct xrdp_wm *wm)
}
else
{
- g_writeln("error in xrdp_font_create");
+ log_message(LOG_LEVEL_ERROR,"error in xrdp_font_create");
}
index++;
diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c
index e31c5405..6a4e44e2 100644
--- a/xrdp/xrdp_listen.c
+++ b/xrdp/xrdp_listen.c
@@ -39,7 +39,7 @@ xrdp_listen_create_pro_done(struct xrdp_listen *self)
if (self->pro_done_event == 0)
{
- g_writeln("Failure creating pro_done_event");
+ log_message(LOG_LEVEL_ERROR,"Failure creating pro_done_event");
}
return 0;
@@ -64,7 +64,7 @@ xrdp_listen_create(void)
if (self->listen_trans == 0)
{
- g_writeln("xrdp_listen_create: trans_create failed");
+ log_message(LOG_LEVEL_ERROR,"xrdp_listen_create: trans_create failed");
}
return self;
@@ -326,7 +326,7 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
&tcp_nodelay, &tcp_keepalive,
self->startup_params) != 0)
{
- g_writeln("xrdp_listen_main_loop: xrdp_listen_get_port failed");
+ log_message(LOG_LEVEL_ERROR,"xrdp_listen_main_loop: xrdp_listen_get_port failed");
self->status = -1;
return 1;
}
@@ -340,7 +340,7 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
{
if (g_tcp_set_no_delay(self->listen_trans->sck))
{
- g_writeln("Error setting tcp_nodelay");
+ log_message(LOG_LEVEL_ERROR,"Error setting tcp_nodelay");
}
}
@@ -348,7 +348,7 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
{
if (g_tcp_set_keepalive(self->listen_trans->sck))
{
- g_writeln("Error setting tcp_keepalive");
+ log_message(LOG_LEVEL_ERROR,"Error setting tcp_keepalive");
}
}
@@ -373,7 +373,7 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
if (trans_get_wait_objs(self->listen_trans, robjs,
&robjs_count) != 0)
{
- g_writeln("Listening socket is in wrong state we "
+ log_message(LOG_LEVEL_ERROR,"Listening socket is in wrong state we "
"terminate listener");
break;
}
@@ -454,7 +454,7 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
}
else
{
- g_writeln("xrdp_listen_main_loop: listen error, possible port "
+ log_message(LOG_LEVEL_ERROR,"xrdp_listen_main_loop: listen error, possible port "
"already in use");
}
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index 52751b72..86bfa128 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -62,7 +62,7 @@ xrdp_mm_sync_load(long param1, long param2)
static void APP_CC
xrdp_mm_module_cleanup(struct xrdp_mm *self)
{
- g_writeln("xrdp_mm_module_cleanup");
+ log_message(LOG_LEVEL_DEBUG,"xrdp_mm_module_cleanup");
if (self->mod != 0)
{
@@ -315,6 +315,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
g_snprintf(text, 255, "error finding proc mod_init in %s, not a valid "
"xrdp backend", lib);
xrdp_wm_log_msg(self->wm, text);
+ log_message(LOG_LEVEL_ERROR,text);
}
self->mod_init = (struct xrdp_mod * ( *)(void))func;
@@ -330,6 +331,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
g_snprintf(text, 255, "error finding proc mod_exit in %s, not a valid "
"xrdp backend", lib);
xrdp_wm_log_msg(self->wm, text);
+ log_message(LOG_LEVEL_ERROR,text);
}
self->mod_exit = (int ( *)(struct xrdp_mod *))func;
@@ -346,7 +348,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
}
else
{
- g_writeln("no mod_init or mod_exit address found");
+ log_message(LOG_LEVEL_ERROR,"no mod_init or mod_exit address found");
}
}
else
@@ -354,6 +356,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
g_snprintf(text, 255, "error loading %s specified in xrdp.ini, please "
"add a valid entry like lib=libxrdp-vnc.so or similar", lib);
xrdp_wm_log_msg(self->wm, text);
+ log_message(LOG_LEVEL_ERROR,text);
return 1;
}
@@ -693,7 +696,7 @@ xrdp_mm_chan_process_msg(struct xrdp_mm *self, struct trans *trans,
rv = xrdp_mm_trans_process_channel_data(self, trans);
break;
default:
- g_writeln("xrdp_mm_chan_process_msg: unknown id %d", id);
+ log_message(LOG_LEVEL_ERROR,"xrdp_mm_chan_process_msg: unknown id %d", id);
break;
}
@@ -802,26 +805,27 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port)
}
g_sleep(1000);
- g_writeln("xrdp_mm_connect_chansrv: connect failed "
+ log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: connect failed "
"trying again...");
}
if (!(self->chan_trans_up))
{
- g_writeln("xrdp_mm_connect_chansrv: error in trans_connect "
- "chan");
+ log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: error in"
+ "trans_connect chan");
}
if (self->chan_trans_up)
{
if (xrdp_mm_chan_send_init(self) != 0)
{
- g_writeln("xrdp_mm_connect_chansrv: error in "
+ log_message(LOG_LEVEL_ERROR,"xrdp_mm_connect_chansrv: error in "
"xrdp_mm_chan_send_init");
}
else
{
- g_writeln("xrdp_mm_connect_chansrv: chansrv connect successful");
+ log_message(LOG_LEVEL_DEBUG,"xrdp_mm_connect_chansrv: chansrv"
+ "connect successful");
}
}
@@ -888,6 +892,8 @@ xrdp_mm_process_login_response(struct xrdp_mm *self, struct stream *s)
{
xrdp_wm_log_msg(self->wm, "xrdp_mm_process_login_response: "
"login failed");
+ log_message(LOG_LEVEL_INFO,"xrdp_mm_process_login_response: "
+ "login failed");
}
cleanup_sesman_connection(self);
@@ -983,7 +989,7 @@ xrdp_mm_process_channel_data(struct xrdp_mm *self, tbus param1, tbus param2,
if (total_length < length)
{
- g_writeln("WARNING in xrdp_mm_process_channel_data(): total_len < length");
+ log_message(LOG_LEVEL_DEBUG,"WARNING in xrdp_mm_process_channel_data(): total_len < length");
total_length = length;
}
@@ -1045,7 +1051,7 @@ xrdp_mm_sesman_data_in(struct trans *trans)
break;
default:
xrdp_wm_log_msg(self->wm, "An undefined reply code was received from sesman");
- g_writeln("Fatal xrdp_mm_sesman_data_in: unknown cmd code %d", code);
+ log_message(LOG_LEVEL_ERROR,"Fatal xrdp_mm_sesman_data_in: unknown cmd code %d", code);
cleanup_sesman_connection(self);
break;
}
@@ -1362,6 +1368,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
g_snprintf(errstr, 255, "Failure to connect to sesman: %s port: %s",
ip, port);
xrdp_wm_log_msg(self->wm, errstr);
+ log_message(LOG_LEVEL_ERROR,errstr);
trans_delete(self->sesman_trans);
self->sesman_trans = 0;
self->sesman_trans_up = 0;
@@ -1381,13 +1388,14 @@ xrdp_mm_connect(struct xrdp_mm *self)
{
/* connect error */
g_snprintf(errstr, 255, "Failure to connect to: %s", ip);
+ log_message(LOG_LEVEL_ERROR,errstr);
xrdp_wm_log_msg(self->wm, errstr);
rv = 1; /* failure */
}
}
else
{
- g_writeln("Failure setting up module");
+ log_message(LOG_LEVEL_ERROR,"Failure setting up module");
}
if (self->wm->login_mode != 10)
@@ -1405,7 +1413,7 @@ xrdp_mm_connect(struct xrdp_mm *self)
xrdp_mm_connect_chansrv(self, "", chansrvport);
}
- g_writeln("returnvalue from xrdp_mm_connect %d", rv);
+ log_message(LOG_LEVEL_DEBUG,"returnvalue from xrdp_mm_connect %d", rv);
return rv;
}
@@ -1957,7 +1965,7 @@ int read_allowed_channel_names(struct list *names, struct list *values)
}
else
{
- g_writeln("Failure reading channel section of configuration");
+ log_message(LOG_LEVEL_ERROR,"Failure reading channel section of configuration");
}
g_file_close(fd);
@@ -2037,7 +2045,7 @@ is_channel_enabled(char *inName, struct list *names, struct list *values)
reply = text2bool(val);
if (reply == 0)
{
- g_writeln("This channel is disabled: %s", name);
+ log_message(LOG_LEVEL_INFO,"This channel is disabled: %s", name);
}
}
@@ -2091,7 +2099,7 @@ void init_channel_allowed(struct xrdp_wm *wm)
}
else
{
- g_writeln("The following channel is not allowed: %s (%d)", channelname, index);
+ log_message(LOG_LEVEL_INFO,"The following channel is not allowed: %s (%d)", channelname, index);
}
index++;
@@ -2101,7 +2109,7 @@ void init_channel_allowed(struct xrdp_wm *wm)
}
else
{
- g_writeln("Error reading channel section in inifile");
+ log_message(LOG_LEVEL_ERROR,"Error reading channel section in inifile");
}
list_delete(names);
@@ -2226,7 +2234,7 @@ server_create_os_surface(struct xrdp_mod *mod, int rdpindex,
if (error != 0)
{
- g_writeln("server_create_os_surface: xrdp_cache_add_os_bitmap failed");
+ log_message(LOG_LEVEL_ERROR,"server_create_os_surface: xrdp_cache_add_os_bitmap failed");
return 1;
}
@@ -2277,7 +2285,7 @@ server_switch_os_surface(struct xrdp_mod *mod, int rdpindex)
}
else
{
- g_writeln("server_switch_os_surface: error finding id %d", rdpindex);
+ log_message(LOG_LEVEL_ERROR,"server_switch_os_surface: error finding id %d", rdpindex);
}
return 0;
@@ -2340,7 +2348,7 @@ server_paint_rect_os(struct xrdp_mod *mod, int x, int y, int cx, int cy,
}
else
{
- g_writeln("server_paint_rect_os: error finding id %d", rdpindex);
+ log_message(LOG_LEVEL_ERROR,"server_paint_rect_os: error finding id %d", rdpindex);
}
return 0;
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index 0a2600f2..76780f69 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -19,6 +19,7 @@
*/
#include "xrdp.h"
+#include "log.h"
/*****************************************************************************/
struct xrdp_wm *APP_CC
@@ -44,6 +45,7 @@ xrdp_wm_create(struct xrdp_process *owner,
pid = g_getpid();
g_snprintf(event_name, 255, "xrdp_%8.8x_wm_login_mode_event_%8.8x",
pid, owner->session_id);
+ log_message(LOG_LEVEL_DEBUG,event_name);
self->login_mode_event = g_create_wait_obj(event_name);
self->painter = xrdp_painter_create(self, self->session);
self->cache = xrdp_cache_create(self, self->session, self->client_info);
@@ -209,7 +211,7 @@ xrdp_wm_load_pointer(struct xrdp_wm *self, char *file_name, char *data,
if (!g_file_exist(file_name))
{
- g_writeln("xrdp_wm_load_pointer: error pointer file [%s] does not exist",
+ log_message(LOG_LEVEL_ERROR,"xrdp_wm_load_pointer: error pointer file [%s] does not exist",
file_name);
return 1;
}
@@ -220,7 +222,7 @@ xrdp_wm_load_pointer(struct xrdp_wm *self, char *file_name, char *data,
if (fd < 1)
{
- g_writeln("xrdp_wm_load_pointer: error loading pointer from file [%s]",
+ log_message(LOG_LEVEL_ERROR,"xrdp_wm_load_pointer: error loading pointer from file [%s]",
file_name);
return 1;
}
@@ -456,7 +458,7 @@ xrdp_wm_load_static_colors_plus(struct xrdp_wm *self, char *autorun_name)
}
else
{
- g_writeln("xrdp_wm_load_static_colors: Could not read xrdp.ini file %s", cfg_file);
+ log_message(LOG_LEVEL_ERROR,"xrdp_wm_load_static_colors: Could not read xrdp.ini file %s", cfg_file);
}
if (self->screen->bpp == 8)
@@ -607,7 +609,7 @@ xrdp_wm_init(struct xrdp_wm *self)
}
else
{
- g_writeln("xrdp_wm_init: Could not read xrdp.ini file %s", cfg_file);
+ log_message(LOG_LEVEL_ERROR,"xrdp_wm_init: Could not read xrdp.ini file %s", cfg_file);
}
}
else