diff --git a/xrdp/lang.c b/xrdp/lang.c index 0f8f77b9..e4c18077 100644 --- a/xrdp/lang.c +++ b/xrdp/lang.c @@ -244,7 +244,7 @@ get_keymaps(int keylayout, struct xrdp_keymap *keymap) /* if the file does not exist, use only lower 16 bits instead */ if (!g_file_exist(filename)) { - log_message(LOG_LEVEL_INFO, "Cannot find keymap file %s", filename); + LOG(LOG_LEVEL_WARNING, "Cannot find keymap file %s", filename); /* e.g. km-00000411.ini */ g_snprintf(filename, 255, "%s/km-%08x.ini", XRDP_CFG_PATH, basic_key_layout); } @@ -252,14 +252,14 @@ get_keymaps(int keylayout, struct xrdp_keymap *keymap) /* finally, use 'en-us' */ if (!g_file_exist(filename)) { - log_message(LOG_LEVEL_INFO, "Cannot find keymap file %s", filename); + LOG(LOG_LEVEL_WARNING, "Cannot find keymap file %s", filename); g_snprintf(filename, 255, "%s/km-00000409.ini", XRDP_CFG_PATH); } if (g_file_exist(filename)) { fd = g_file_open(filename); - log_message(LOG_LEVEL_INFO, "Loading keymap file %s", filename); + LOG(LOG_LEVEL_INFO, "Loading keymap file %s", filename); if (fd != -1) { @@ -280,9 +280,9 @@ get_keymaps(int keylayout, struct xrdp_keymap *keymap) if (g_memcmp(lkeymap, keymap, sizeof(struct xrdp_keymap)) != 0) { - log_message(LOG_LEVEL_WARNING, - "local keymap file for 0x%08x found and doesn't match " - "built in keymap, using local keymap file", keylayout); + LOG(LOG_LEVEL_WARNING, + "local keymap file for 0x%08x found and doesn't match " + "built in keymap, using local keymap file", keylayout); } g_free(lkeymap); @@ -291,7 +291,7 @@ get_keymaps(int keylayout, struct xrdp_keymap *keymap) } else { - log_message(LOG_LEVEL_WARNING, "File does not exist: %s", filename); + LOG(LOG_LEVEL_WARNING, "File does not exist: %s", filename); } g_free(filename); diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c index 96320354..99daffae 100644 --- a/xrdp/xrdp.c +++ b/xrdp/xrdp.c @@ -102,7 +102,7 @@ g_xrdp_sync(long (*sync_func)(long param1, long param2), long sync_param1, /* this is the main thread, call the function directly */ /* in fork mode, this always happens too */ sync_result = sync_func(sync_param1, sync_param2); - /*g_writeln("g_xrdp_sync processed IN main thread -> continue");*/ + LOG_DEVEL(LOG_LEVEL_DEBUG, "g_xrdp_sync processed IN main thread -> continue"); } else { @@ -133,10 +133,9 @@ g_xrdp_sync(long (*sync_func)(long param1, long param2), long sync_param1, tc_mutex_unlock(g_sync_mutex); } while (sync_command != 0); /* loop until g_process_waiting_function() - * has processed the request */ tc_mutex_unlock(g_sync1_mutex); - /*g_writeln("g_xrdp_sync processed BY main thread -> continue");*/ + LOG_DEVEL(LOG_LEVEL_DEBUG, "g_xrdp_sync processed BY main thread -> continue"); } return sync_result; @@ -149,8 +148,8 @@ xrdp_shutdown(int sig) tbus threadid; threadid = tc_get_threadid(); - g_writeln("shutting down"); - g_writeln("signal %d threadid %lld", sig, (long long)threadid); + LOG(LOG_LEVEL_INFO, "shutting down"); + LOG(LOG_LEVEL_INFO, "signal %d threadid %lld", sig, (long long)threadid); if (!g_is_wait_obj_set(g_term_event)) { @@ -173,7 +172,7 @@ xrdp_child(int sig) static void xrdp_hang_up(int sig) { - log_message(LOG_LEVEL_INFO, "caught SIGHUP, noop..."); + LOG(LOG_LEVEL_INFO, "caught SIGHUP, noop..."); } /*****************************************************************************/ @@ -235,7 +234,7 @@ static void pipe_sig(int sig_num) { /* do nothing */ - g_writeln("got XRDP SIGPIPE(%d)", sig_num); + LOG(LOG_LEVEL_INFO, "got XRDP SIGPIPE(%d)", sig_num); } /*****************************************************************************/ @@ -613,8 +612,8 @@ main(int argc, char **argv) /* if can't listen, exit with failure status */ if (xrdp_listen_test(&startup_params) != 0) { - log_message(LOG_LEVEL_ERROR, "Failed to start xrdp daemon, " - "possibly address already in use."); + LOG(LOG_LEVEL_ERROR, "Failed to start xrdp daemon, " + "possibly address already in use."); g_deinit(); /* must exit with failure status, or systemd cannot detect xrdp daemon couldn't start properly */ @@ -686,13 +685,13 @@ main(int argc, char **argv) g_sync_mutex = tc_mutex_create(); g_sync1_mutex = tc_mutex_create(); pid = g_getpid(); - log_message(LOG_LEVEL_INFO, "starting xrdp with pid %d", pid); + LOG(LOG_LEVEL_INFO, "starting xrdp with pid %d", pid); g_snprintf(text, 255, "xrdp_%8.8x_main_term", pid); g_term_event = g_create_wait_obj(text); if (g_term_event == 0) { - g_writeln("error creating g_term_event"); + LOG(LOG_LEVEL_WARNING, "error creating g_term_event"); } g_snprintf(text, 255, "xrdp_%8.8x_main_sync", pid); @@ -700,7 +699,7 @@ main(int argc, char **argv) if (g_sync_event == 0) { - g_writeln("error creating g_sync_event"); + LOG(LOG_LEVEL_WARNING, "error creating g_sync_event"); } g_listen->startup_params = &startup_params; diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index f0036d91..6369aebd 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -31,17 +31,7 @@ #include "log.h" #include "string_calls.h" -#define LLOG_LEVEL 1 -#define LLOGLN(_level, _args) \ - do \ - { \ - if (_level < LLOG_LEVEL) \ - { \ - g_write("xrdp:xrdp_bitmap [%10.10u]: ", g_time3()); \ - g_writeln _args ; \ - } \ - } \ - while (0) + static const unsigned int g_crc_table[256] = @@ -153,8 +143,8 @@ xrdp_bitmap_create(int width, int height, int bpp, self->data = alloc_bitmap_data(width, height, Bpp); if (self->data == NULL) { - LLOGLN(0, ("xrdp_bitmap_create: size overflow %dx%dx%d", - width, height, Bpp)); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_create: size overflow %dx%dx%d", + width, height, Bpp); g_free(self); return NULL; } @@ -163,12 +153,12 @@ xrdp_bitmap_create(int width, int height, int bpp, #if defined(XRDP_PAINTER) if (self->type == WND_TYPE_SCREEN) /* noorders */ { - LLOGLN(0, ("xrdp_bitmap_create: noorders")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_bitmap_create: noorders"); self->data = alloc_bitmap_data(width, height, Bpp); if (self->data == NULL) { - LLOGLN(0, ("xrdp_bitmap_create: size overflow %dx%dx%d", - width, height, Bpp)); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_create: size overflow %dx%dx%d", + width, height, Bpp); g_free(self); return NULL; } @@ -492,8 +482,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) if (!g_file_exist(filename)) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " - "does not exist", filename); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " + "does not exist", filename); return 1; } @@ -504,16 +494,16 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read file type */ if (g_file_read(fd, type1, 2) != 2) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " - "read error", filename); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " + "read error", filename); g_file_close(fd); return 1; } if ((type1[0] != 'B') || (type1[1] != 'M')) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " - "not BMP file", filename); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " + "not BMP file", filename); g_file_close(fd); return 1; } @@ -526,8 +516,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read bmp header */ if (g_file_seek(fd, 14) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", - filename); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", + filename); free_stream(s); g_file_close(fd); return 1; @@ -549,8 +539,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) if ((header.bit_count != 4) && (header.bit_count != 8) && (header.bit_count != 24)) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " - "bad bpp %d", filename, header.bit_count); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap file [%s] " + "bad bpp %d", filename, header.bit_count); free_stream(s); g_file_close(fd); return 1; @@ -560,8 +550,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) { if (g_file_seek(fd, 14 + header.size) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", - filename); + LOG(LOG_LEVEL_WARNING, "xrdp_bitmap_load: seek error in file %s", + filename); } xrdp_bitmap_resize(self, header.image_width, header.image_height); size = header.image_width * header.image_height * 3; @@ -575,8 +565,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) if (k != size) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap " - "file [%s] read", filename); + LOG(LOG_LEVEL_WARNING, "xrdp_bitmap_load: error bitmap " + "file [%s] read", filename); } } @@ -617,8 +607,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read palette */ if (g_file_seek(fd, 14 + header.size) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", - filename); + LOG(LOG_LEVEL_WARNING, "xrdp_bitmap_load: seek error in file %s", + filename); } init_stream(s, 8192); g_file_read(fd, s->data, header.clr_used * sizeof(int)); @@ -640,8 +630,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) if (k != size) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap " - "file [%s] read", filename); + LOG(LOG_LEVEL_WARNING, "xrdp_bitmap_load: error bitmap " + "file [%s] read", filename); } } @@ -678,8 +668,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) /* read palette */ if (g_file_seek(fd, 14 + header.size) < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s", - filename); + LOG(LOG_LEVEL_WARNING, "xrdp_bitmap_load: seek error in file %s", + filename); } init_stream(s, 8192); g_file_read(fd, s->data, header.clr_used * sizeof(int)); @@ -701,8 +691,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) if (k != size) { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error bitmap " - "file [%s] read", filename); + LOG(LOG_LEVEL_WARNING, "xrdp_bitmap_load: error bitmap " + "file [%s] read", filename); } } @@ -749,8 +739,8 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette) } else { - log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error loading bitmap " - "from file [%s]", filename); + LOG(LOG_LEVEL_ERROR, "xrdp_bitmap_load: error loading bitmap " + "from file [%s]", filename); return 1; } @@ -1242,10 +1232,10 @@ xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap *self, dest->crc32 = crc; dest->crc16 = dest->crc32 & 0xffff; - LLOGLN(10, ("xrdp_bitmap_copy_box_with_crc: crc16 0x%4.4x", - dest->crc16)); - LLOGLN(10, ("xrdp_bitmap_copy_box_with_crc: width %d height %d", - dest->width, dest->height)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_bitmap_copy_box_with_crc: crc16 0x%4.4x", + dest->crc16); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_bitmap_copy_box_with_crc: width %d height %d", + dest->width, dest->height); return 0; } @@ -1256,7 +1246,7 @@ int xrdp_bitmap_compare(struct xrdp_bitmap *self, struct xrdp_bitmap *b) { - LLOGLN(10, ("xrdp_bitmap_compare:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_bitmap_compare:"); if (self == 0) { diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c index 99b69105..ad242253 100644 --- a/xrdp/xrdp_cache.c +++ b/xrdp/xrdp_cache.c @@ -25,17 +25,7 @@ #include "xrdp.h" #include "log.h" -#define LLOG_LEVEL 1 -#define LLOGLN(_level, _args) \ - do \ - { \ - if (_level < LLOG_LEVEL) \ - { \ - g_write("xrdp:xrdp_cache [%10.10u]: ", g_time3()); \ - g_writeln _args ; \ - } \ - } \ - while (0) + /*****************************************************************************/ static int @@ -124,8 +114,8 @@ xrdp_cache_create(struct xrdp_wm *owner, self->xrdp_os_del_list = list_create(); xrdp_cache_reset_lru(self); xrdp_cache_reset_crc(self); - LLOGLN(10, ("xrdp_cache_create: 0 %d 1 %d 2 %d", - self->cache1_entries, self->cache2_entries, self->cache3_entries)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_create: 0 %d 1 %d 2 %d", + self->cache1_entries, self->cache2_entries, self->cache3_entries); return self; } @@ -245,10 +235,10 @@ xrdp_cache_update_lru(struct xrdp_cache *self, int cache_id, int lru_index) struct xrdp_lru_item *thislru; struct xrdp_lru_item *taillru; - LLOGLN(10, ("xrdp_cache_update_lru: lru_index %d", lru_index)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_update_lru: lru_index %d", lru_index); if ((lru_index < 0) || (lru_index >= XRDP_MAX_BITMAP_CACHE_IDX)) { - LLOGLN(0, ("xrdp_cache_update_lru: error")); + LOG(LOG_LEVEL_ERROR, "xrdp_cache_update_lru: error"); return 1; } if (self->lru_tail[cache_id] == lru_index) @@ -327,9 +317,9 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, struct xrdp_bitmap *lbm; struct xrdp_lru_item *llru; - LLOGLN(10, ("xrdp_cache_add_bitmap:")); - LLOGLN(10, ("xrdp_cache_add_bitmap: crc16 0x%4.4x", - bitmap->crc16)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_add_bitmap:"); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_add_bitmap: crc16 0x%4.4x", + bitmap->crc16); e = (4 - (bitmap->width % 4)) & 3; found = 0; @@ -358,8 +348,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, } else { - log_message(LOG_LEVEL_ERROR, "error in xrdp_cache_add_bitmap, " - "too big(%d) bpp %d", bmp_size, bitmap->bpp); + LOG(LOG_LEVEL_ERROR, "error in xrdp_cache_add_bitmap, " + "too big(%d) bpp %d", bmp_size, bitmap->bpp); return 0; } @@ -371,7 +361,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, lbm = self->bitmap_items[cache_id][cache_idx].bitmap; if ((lbm != NULL) && COMPARE_WITH_CRC32(lbm, bitmap)) { - LLOGLN(10, ("found bitmap at %d %d", index, jndex)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "found bitmap at %d %d", cache_idx, jndex); found = 1; break; } @@ -394,8 +384,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, if (self->lru_reset[cache_id]) { self->lru_reset[cache_id] = 0; - LLOGLN(0, ("xrdp_cache_add_bitmap: reset detected cache_id %d", - cache_id)); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_cache_add_bitmap: reset detected cache_id %d", + cache_id); self->lru_tail[cache_id] = cache_entries - 1; index = self->lru_tail[cache_id]; llru = &(self->bitmap_lrus[cache_id][index]); @@ -409,12 +399,12 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, /* update lru to end */ xrdp_cache_update_lru(self, cache_id, lru_index); - LLOGLN(10, ("xrdp_cache_add_bitmap: oldest %d %d", cache_id, cache_idx)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_add_bitmap: oldest %d %d", cache_id, cache_idx); - LLOGLN(10, ("adding bitmap at %d %d old ptr %p new ptr %p", - cache_id, cache_idx, - self->bitmap_items[cache_id][cache_idx].bitmap, - bitmap)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "adding bitmap at %d %d old ptr %p new ptr %p", + cache_id, cache_idx, + self->bitmap_items[cache_id][cache_idx].bitmap, + bitmap); /* remove old, about to be deleted, from crc16 list */ lbm = self->bitmap_items[cache_id][cache_idx].bitmap; @@ -425,10 +415,10 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, iig = list16_index_of(ll, cache_idx); if (iig == -1) { - LLOGLN(0, ("xrdp_cache_add_bitmap: error removing cache_idx")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_cache_add_bitmap: error removing cache_idx"); } - LLOGLN(10, ("xrdp_cache_add_bitmap: removing index %d from crc16 %d", - iig, crc16)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_add_bitmap: removing index %d from crc16 %d", + iig, crc16); list16_remove_item(ll, iig); xrdp_bitmap_delete(lbm); } @@ -445,7 +435,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap, list16_add_item(ll, cache_idx); if (ll->count > 1) { - LLOGLN(10, ("xrdp_cache_add_bitmap: count %d", ll->count)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_cache_add_bitmap: count %d", ll->count); } if (self->use_bitmap_comp) @@ -575,7 +565,7 @@ xrdp_cache_add_char(struct xrdp_cache *self, if (xrdp_font_item_compare(&self->char_items[i][j].font_item, font_item)) { self->char_items[i][j].stamp = self->char_stamp; - DEBUG(("found font at %d %d", i, j)); + LOG_DEVEL(LOG_LEVEL_TRACE, "found font at %d %d", i, j); return MAKELONG(j, i); } } @@ -599,7 +589,7 @@ xrdp_cache_add_char(struct xrdp_cache *self, } } - DEBUG(("adding char at %d %d", f, c)); + LOG_DEVEL(LOG_LEVEL_TRACE, "adding char at %d %d", f, c); /* set, send char and return */ fi = &self->char_items[f][c].font_item; g_free(fi->data); @@ -649,7 +639,7 @@ xrdp_cache_add_pointer(struct xrdp_cache *self, self->pointer_items[i].stamp = self->pointer_stamp; xrdp_wm_set_pointer(self->wm, i); self->wm->current_pointer = i; - DEBUG(("found pointer at %d", i)); + LOG_DEVEL(LOG_LEVEL_TRACE, "found pointer at %d", i); return i; } } @@ -682,7 +672,7 @@ xrdp_cache_add_pointer(struct xrdp_cache *self, self->pointer_items[index].y, self->pointer_items[index].bpp); self->wm->current_pointer = index; - DEBUG(("adding pointer at %d", index)); + LOG_DEVEL(LOG_LEVEL_TRACE, "adding pointer at %d", index); return index; } @@ -714,7 +704,7 @@ xrdp_cache_add_pointer_static(struct xrdp_cache *self, self->pointer_items[index].y, self->pointer_items[index].bpp); self->wm->current_pointer = index; - DEBUG(("adding pointer at %d", index)); + LOG_DEVEL(LOG_LEVEL_TRACE, "adding pointer at %d", index); return index; } @@ -742,7 +732,7 @@ xrdp_cache_add_brush(struct xrdp_cache *self, brush_item_data, 8) == 0) { self->brush_items[i].stamp = self->brush_stamp; - DEBUG(("found brush at %d", i)); + LOG_DEVEL(LOG_LEVEL_TRACE, "found brush at %d", i); return i; } } @@ -765,7 +755,7 @@ xrdp_cache_add_brush(struct xrdp_cache *self, self->brush_items[index].stamp = self->brush_stamp; libxrdp_orders_send_brush(self->session, 8, 8, 1, 0x81, 8, self->brush_items[index].pattern, index); - DEBUG(("adding brush at %d", index)); + LOG_DEVEL(LOG_LEVEL_TRACE, "adding brush at %d", index); return index; } diff --git a/xrdp/xrdp_encoder.c b/xrdp/xrdp_encoder.c index 3d9c8ab8..5aa11f3b 100644 --- a/xrdp/xrdp_encoder.c +++ b/xrdp/xrdp_encoder.c @@ -32,17 +32,7 @@ #include "rfxcodec_encode.h" #endif -#define LLOG_LEVEL 1 -#define LLOGLN(_level, _args) \ - do \ - { \ - if (_level < LLOG_LEVEL) \ - { \ - g_write("xrdp:xrdp_encoder [%10.10u]: ", g_time3()); \ - g_writeln _args ; \ - } \ - } \ - while (0) + #define XRDP_SURCMD_PREFIX_BYTES 256 @@ -81,7 +71,7 @@ xrdp_encoder_create(struct xrdp_mm *mm) if (client_info->jpeg_codec_id != 0) { - LLOGLN(0, ("xrdp_encoder_create: starting jpeg codec session")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_create: starting jpeg codec session"); self->codec_id = client_info->jpeg_codec_id; self->in_codec_mode = 1; self->codec_quality = client_info->jpeg_prop[0]; @@ -94,7 +84,7 @@ xrdp_encoder_create(struct xrdp_mm *mm) #ifdef XRDP_RFXCODEC else if (client_info->rfx_codec_id != 0) { - LLOGLN(0, ("xrdp_encoder_create: starting rfx codec session")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_create: starting rfx codec session"); self->codec_id = client_info->rfx_codec_id; self->in_codec_mode = 1; client_info->capture_code = 2; @@ -106,7 +96,7 @@ xrdp_encoder_create(struct xrdp_mm *mm) #endif else if (client_info->h264_codec_id != 0) { - LLOGLN(0, ("xrdp_encoder_create: starting h264 codec session")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_create: starting h264 codec session"); self->codec_id = client_info->h264_codec_id; self->in_codec_mode = 1; client_info->capture_code = 3; @@ -121,7 +111,7 @@ xrdp_encoder_create(struct xrdp_mm *mm) return 0; } - LLOGLN(0, ("init_xrdp_encoder: initializing encoder codec_id %d", self->codec_id)); + LOG_DEVEL(LOG_LEVEL_INFO, "init_xrdp_encoder: initializing encoder codec_id %d", self->codec_id); /* setup required FIFOs */ self->fifo_to_proc = fifo_create(); @@ -155,7 +145,7 @@ xrdp_encoder_delete(struct xrdp_encoder *self) XRDP_ENC_DATA_DONE *enc_done; FIFO *fifo; - LLOGLN(0, ("xrdp_encoder_delete:")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_delete:"); if (self == 0) { return; @@ -243,7 +233,7 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) tbus mutex; tbus event_processed; - LLOGLN(10, ("process_enc_jpg:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "process_enc_jpg:"); quality = self->codec_quality; fifo_processed = self->fifo_processed; mutex = self->mutex; @@ -257,22 +247,22 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) cy = enc->crects[index * 4 + 3]; if (cx < 1 || cy < 1) { - LLOGLN(0, ("process_enc_jpg: error 1")); + LOG_DEVEL(LOG_LEVEL_WARNING, "process_enc_jpg: error 1"); continue; } - LLOGLN(10, ("process_enc_jpg: x %d y %d cx %d cy %d", x, y, cx, cy)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "process_enc_jpg: x %d y %d cx %d cy %d", x, y, cx, cy); out_data_bytes = MAX((cx + 4) * cy * 4, 8192); if ((out_data_bytes < 1) || (out_data_bytes > 16 * 1024 * 1024)) { - LLOGLN(0, ("process_enc_jpg: error 2")); + LOG_DEVEL(LOG_LEVEL_ERROR, "process_enc_jpg: error 2"); return 1; } out_data = (char *) g_malloc(out_data_bytes + 256 + 2, 0); if (out_data == 0) { - LLOGLN(0, ("process_enc_jpg: error 3")); + LOG_DEVEL(LOG_LEVEL_ERROR, "process_enc_jpg: error 3"); return 1; } @@ -285,12 +275,12 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) out_data + 256 + 2, &out_data_bytes); if (error < 0) { - LLOGLN(0, ("process_enc_jpg: jpeg error %d bytes %d", - error, out_data_bytes)); + LOG_DEVEL(LOG_LEVEL_ERROR, "process_enc_jpg: jpeg error %d bytes %d", + error, out_data_bytes); g_free(out_data); return 1; } - LLOGLN(10, ("jpeg error %d bytes %d", error, out_data_bytes)); + LOG_DEVEL(LOG_LEVEL_WARNING, "jpeg error %d bytes %d", error, out_data_bytes); enc_done = (XRDP_ENC_DATA_DONE *) g_malloc(sizeof(XRDP_ENC_DATA_DONE), 1); enc_done->comp_bytes = out_data_bytes + 2; @@ -336,9 +326,9 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) struct rfx_rect *rfxrects; int alloc_bytes; - LLOGLN(10, ("process_enc_rfx:")); - LLOGLN(10, ("process_enc_rfx: num_crects %d num_drects %d", - enc->num_crects, enc->num_drects)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "process_enc_rfx:"); + LOG_DEVEL(LOG_LEVEL_DEBUG, "process_enc_rfx: num_crects %d num_drects %d", + enc->num_crects, enc->num_drects); fifo_processed = self->fifo_processed; mutex = self->mutex; event_processed = self->xrdp_encoder_event_processed; @@ -400,7 +390,7 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) } } - LLOGLN(10, ("process_enc_rfx: rfxcodec_encode rv %d", error)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "process_enc_rfx: rfxcodec_encode rv %d", error); /* only if enc_done->comp_bytes is not zero is something sent to the client but you must always send something back even on error so Xorg can get ack */ @@ -434,7 +424,7 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) static int process_enc_h264(struct xrdp_encoder *self, XRDP_ENC_DATA *enc) { - LLOGLN(0, ("process_enc_x264:")); + LOG_DEVEL(LOG_LEVEL_INFO, "process_enc_x264:"); return 0; } @@ -458,12 +448,12 @@ proc_enc_msg(void *arg) tbus wobjs[32]; struct xrdp_encoder *self; - LLOGLN(0, ("proc_enc_msg: thread is running")); + LOG_DEVEL(LOG_LEVEL_INFO, "proc_enc_msg: thread is running"); self = (struct xrdp_encoder *) arg; if (self == 0) { - LLOGLN(0, ("proc_enc_msg: self nil")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "proc_enc_msg: self nil"); return 0; } @@ -492,13 +482,13 @@ proc_enc_msg(void *arg) if (g_is_wait_obj_set(term_obj)) /* global term */ { - LLOGLN(0, ("proc_enc_msg: global term")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "proc_enc_msg: global term"); break; } if (g_is_wait_obj_set(lterm_obj)) /* xrdp_mm term */ { - LLOGLN(0, ("proc_enc_msg: xrdp_mm term")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "proc_enc_msg: xrdp_mm term"); break; } @@ -522,6 +512,6 @@ proc_enc_msg(void *arg) } } /* end while (cont) */ - LLOGLN(0, ("proc_enc_msg: thread exit")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "proc_enc_msg: thread exit"); return 0; } diff --git a/xrdp/xrdp_font.c b/xrdp/xrdp_font.c index 9f39429e..c089db00 100644 --- a/xrdp/xrdp_font.c +++ b/xrdp/xrdp_font.c @@ -80,13 +80,13 @@ xrdp_font_create(struct xrdp_wm *wm) struct xrdp_font_char *f; char file_path[256]; - DEBUG(("in xrdp_font_create")); + LOG_DEVEL(LOG_LEVEL_TRACE, "in xrdp_font_create"); g_snprintf(file_path, 255, "%s/%s", XRDP_SHARE_PATH, DEFAULT_FONT_NAME); if (!g_file_exist(file_path)) { - log_message(LOG_LEVEL_ERROR, "xrdp_font_create: error font file [%s] does not exist", - file_path); + LOG(LOG_LEVEL_ERROR, "xrdp_font_create: error font file [%s] does not exist", + file_path); return 0; } @@ -94,8 +94,8 @@ xrdp_font_create(struct xrdp_wm *wm) if (file_size < 1) { - log_message(LOG_LEVEL_ERROR, "xrdp_font_create: error reading font from file [%s]", - file_path); + LOG(LOG_LEVEL_ERROR, "xrdp_font_create: error reading font from file [%s]", + file_path); return 0; } @@ -139,9 +139,9 @@ xrdp_font_create(struct xrdp_wm *wm) if (datasize < 0 || datasize > 512) { /* shouldn't happen */ - 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); + LOG(LOG_LEVEL_ERROR, "error in xrdp_font_create, datasize wrong " + "width %d, height %d, datasize %d, index %d", + f->width, f->height, datasize, index); break; } @@ -152,7 +152,7 @@ xrdp_font_create(struct xrdp_wm *wm) } else { - log_message(LOG_LEVEL_ERROR, "error in xrdp_font_create"); + LOG(LOG_LEVEL_ERROR, "error in xrdp_font_create"); } index++; @@ -169,7 +169,7 @@ xrdp_font_create(struct xrdp_wm *wm) self->font_items[0].data = g_malloc(3 * 16, 0); g_memcpy(self->font_items[0].data, w_char, 3 * 16); */ - DEBUG(("out xrdp_font_create")); + LOG_DEVEL(LOG_LEVEL_TRACE, "out xrdp_font_create"); return self; } diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c index 202f4f8e..752a36d8 100644 --- a/xrdp/xrdp_listen.c +++ b/xrdp/xrdp_listen.c @@ -47,7 +47,7 @@ xrdp_listen_create_pro_done(struct xrdp_listen *self) if (self->pro_done_event == 0) { - log_message(LOG_LEVEL_ERROR, "Failure creating pro_done_event"); + LOG(LOG_LEVEL_WARNING, "Failure creating pro_done_event"); } return 0; @@ -145,12 +145,12 @@ xrdp_process_run(void *in_val) { struct xrdp_process *process; - DEBUG(("process started")); + LOG_DEVEL(LOG_LEVEL_TRACE, "process started"); process = g_process; g_process = 0; tc_sem_inc(g_process_sem); xrdp_process_main_loop(process); - DEBUG(("process done")); + LOG_DEVEL(LOG_LEVEL_TRACE, "process done"); return 0; } @@ -671,25 +671,25 @@ xrdp_listen_process_startup_params(struct xrdp_listen *self) { if (xrdp_listen_pp(self, &index, address, port, &mode) != 0) { - log_message(LOG_LEVEL_INFO, "xrdp_listen_pp done"); + LOG(LOG_LEVEL_INFO, "xrdp_listen_pp done"); cont = 0; break; } - log_message(LOG_LEVEL_INFO, "address [%s] port [%s] mode %d", - address, port, mode); + LOG(LOG_LEVEL_INFO, "address [%s] port [%s] mode %d", + address, port, mode); ltrans = trans_create(mode, 16, 16); if (ltrans == NULL) { - log_message(LOG_LEVEL_ERROR, "trans_create failed"); + LOG(LOG_LEVEL_ERROR, "trans_create failed"); xrdp_listen_stop_all_listen(self); return 1; } - log_message(LOG_LEVEL_INFO, "listening to port %s on %s", - port, address); + LOG(LOG_LEVEL_INFO, "listening to port %s on %s", + port, address); error = trans_listen_address(ltrans, port, address); if (error != 0) { - log_message(LOG_LEVEL_ERROR, "trans_listen_address failed"); + LOG(LOG_LEVEL_ERROR, "trans_listen_address failed"); trans_delete(ltrans); xrdp_listen_stop_all_listen(self); return 1; @@ -702,60 +702,60 @@ xrdp_listen_process_startup_params(struct xrdp_listen *self) { if (g_tcp_set_no_delay(ltrans->sck)) { - log_message(LOG_LEVEL_ERROR, "Error setting tcp_nodelay"); + LOG(LOG_LEVEL_ERROR, "Error setting tcp_nodelay"); } } if (startup_params->tcp_keepalive) { if (g_tcp_set_keepalive(ltrans->sck)) { - log_message(LOG_LEVEL_ERROR, "Error setting " - "tcp_keepalive"); + LOG(LOG_LEVEL_ERROR, "Error setting " + "tcp_keepalive"); } } if (startup_params->tcp_send_buffer_bytes > 0) { bytes = startup_params->tcp_send_buffer_bytes; - log_message(LOG_LEVEL_INFO, "setting send buffer to %d bytes", - bytes); + LOG(LOG_LEVEL_INFO, "setting send buffer to %d bytes", + bytes); if (g_sck_set_send_buffer_bytes(ltrans->sck, bytes) != 0) { - log_message(LOG_LEVEL_ERROR, "error setting send buffer"); + LOG(LOG_LEVEL_WARNING, "error setting send buffer"); } else { if (g_sck_get_send_buffer_bytes(ltrans->sck, &bytes) != 0) { - log_message(LOG_LEVEL_ERROR, "error getting send " - "buffer"); + LOG(LOG_LEVEL_WARNING, "error getting send " + "buffer"); } else { - log_message(LOG_LEVEL_INFO, "send buffer set to %d " - "bytes", bytes); + LOG(LOG_LEVEL_INFO, "send buffer set to %d " + "bytes", bytes); } } } if (startup_params->tcp_recv_buffer_bytes > 0) { bytes = startup_params->tcp_recv_buffer_bytes; - log_message(LOG_LEVEL_INFO, "setting recv buffer to %d bytes", - bytes); + LOG(LOG_LEVEL_INFO, "setting recv buffer to %d bytes", + bytes); if (g_sck_set_recv_buffer_bytes(ltrans->sck, bytes) != 0) { - log_message(LOG_LEVEL_ERROR, "error setting recv buffer"); + LOG(LOG_LEVEL_WARNING, "error setting recv buffer"); } else { if (g_sck_get_recv_buffer_bytes(ltrans->sck, &bytes) != 0) { - log_message(LOG_LEVEL_ERROR, "error getting recv " - "buffer"); + LOG(LOG_LEVEL_WARNING, "error getting recv " + "buffer"); } else { - log_message(LOG_LEVEL_INFO, "recv buffer set to %d " - "bytes", bytes); + LOG(LOG_LEVEL_INFO, "recv buffer set to %d " + "bytes", bytes); } } } @@ -865,13 +865,13 @@ xrdp_listen_main_loop(struct xrdp_listen *self) self->status = 1; if (xrdp_listen_get_startup_params(self) != 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_listen_main_loop: xrdp_listen_get_port failed"); + LOG(LOG_LEVEL_ERROR, "xrdp_listen_main_loop: xrdp_listen_get_port failed"); self->status = -1; return 1; } if (xrdp_listen_process_startup_params(self) != 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_listen_main_loop: xrdp_listen_get_port failed"); + LOG(LOG_LEVEL_ERROR, "xrdp_listen_main_loop: xrdp_listen_get_port failed"); self->status = -1; return 1; } diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index 59d6d938..4dbc5914 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -246,7 +246,7 @@ xrdp_wm_ok_clicked(struct xrdp_bitmap *wnd) } else { - log_message(LOG_LEVEL_ERROR, "Combo is 0 - potential programming error"); + LOG(LOG_LEVEL_WARNING, "Combo is NULL - potential programming error"); } return 0; @@ -293,7 +293,6 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax, { /* we try to locate a number indicating what combobox index the user * prefer the information is loaded from domain field, from the client - * log_message(LOG_LEVEL_DEBUG, "domain contains _"); * We must use valid chars in the domain name. * Underscore is a valid name in the domain. * Invalid chars are ignored in microsoft client therefore we use '_' @@ -301,22 +300,22 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax, pos = g_pos(&originalDomainInfo[1], "__"); if (pos > 0) { - /* an index is found we try to use it - log_message(LOG_LEVEL_DEBUG, "domain contains index char __");*/ + /* an index is found we try to use it */ + LOG(LOG_LEVEL_DEBUG, "domain contains index char __"); if (decode) { g_memset(index, 0, 2); /* we just accept values 0-9 (one figure) */ g_strncpy(index, &originalDomainInfo[pos + 3], 1); comboxindex = g_htoi(index); - log_message(LOG_LEVEL_DEBUG, - "index value as string: %s, as int: %d, max: %d", - index, comboxindex, comboMax - 1); + LOG(LOG_LEVEL_DEBUG, + "index value as string: %s, as int: %d, max: %d", + index, comboxindex, comboMax - 1); /* limit to max number of items in combo box */ if ((comboxindex > 0) && (comboxindex < comboMax)) { - log_message(LOG_LEVEL_DEBUG, "domain contains a valid " - "index number"); + LOG(LOG_LEVEL_DEBUG, "domain contains a valid " + "index number"); ret = comboxindex; /* preferred index for combo box. */ } } @@ -325,7 +324,7 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax, } else { - /* log_message(LOG_LEVEL_DEBUG, "domain does not contain _"); */ + LOG(LOG_LEVEL_DEBUG, "domain does not contain _"); g_strncpy(resultBuffer, &originalDomainInfo[1], 255); } } @@ -573,8 +572,8 @@ xrdp_wm_login_fill_in_combo(struct xrdp_wm *self, struct xrdp_bitmap *b) if (fd < 0) { - log_message(LOG_LEVEL_ERROR, "Could not read xrdp ini file %s", - xrdp_ini); + LOG(LOG_LEVEL_ERROR, "Could not read xrdp ini file %s", + xrdp_ini); list_delete(sections); list_delete(section_names); list_delete(section_values); @@ -740,7 +739,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self) g_snprintf(fileName, 255, "%s/%s", XRDP_SHARE_PATH, globals->ls_background_image); } - log_message(LOG_LEVEL_DEBUG, "We try to load the following background file: %s", fileName); + LOG(LOG_LEVEL_DEBUG, "We try to load the following background file: %s", fileName); xrdp_bitmap_load(but, fileName, self->palette); but->parent = self->screen; but->owner = self->screen; @@ -886,8 +885,8 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) /* open xrdp.ini file */ if ((fd = g_file_open(xrdp_ini)) < 0) { - log_message(LOG_LEVEL_ERROR, "load_config: Could not read " - "xrdp.ini file %s", xrdp_ini); + LOG(LOG_LEVEL_ERROR, "load_config: Could not read " + "xrdp.ini file %s", xrdp_ini); return -1; } @@ -902,8 +901,8 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) list_delete(names); list_delete(values); g_file_close(fd); - log_message(LOG_LEVEL_ERROR, "load_config: Could not read globals " - "section from xrdp.ini file %s", xrdp_ini); + LOG(LOG_LEVEL_ERROR, "load_config: Could not read globals " + "section from xrdp.ini file %s", xrdp_ini); return -1; } @@ -1073,7 +1072,7 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) else if (g_strncmp(n, "enable_token_login", 64) == 0) { - log_message(LOG_LEVEL_DEBUG, "Token login detection enabled x"); + LOG(LOG_LEVEL_DEBUG, "Token login detection enabled x"); globals->enable_token_login = g_text2bool(v); } @@ -1190,63 +1189,61 @@ load_xrdp_config(struct xrdp_config *config, const char *xrdp_ini, int bpp) } } -#if 0 - g_writeln("ini_version: %d", globals->ini_version); - g_writeln("use_bitmap_cache: %d", globals->use_bitmap_cache); - g_writeln("use_bitmap_compression: %d", globals->use_bitmap_compression); - g_writeln("port: %d", globals->port); - g_writeln("crypt_level: %d", globals->crypt_level); - g_writeln("allow_channels: %d", globals->allow_channels); - g_writeln("max_bpp: %d", globals->max_bpp); - g_writeln("fork: %d", globals->fork); - g_writeln("tcp_nodelay: %d", globals->tcp_nodelay); - g_writeln("tcp_keepalive: %d", globals->tcp_keepalive); - g_writeln("tcp_send_buffer_bytes: %d", globals->tcp_send_buffer_bytes); - g_writeln("tcp_recv_buffer_bytes: %d", globals->tcp_recv_buffer_bytes); - g_writeln("new_cursors: %d", globals->new_cursors); - g_writeln("allow_multimon: %d", globals->allow_multimon); + LOG(LOG_LEVEL_DEBUG, "ini_version: %d", globals->ini_version); + LOG(LOG_LEVEL_DEBUG, "use_bitmap_cache: %d", globals->use_bitmap_cache); + LOG(LOG_LEVEL_DEBUG, "use_bitmap_compression: %d", globals->use_bitmap_compression); + LOG(LOG_LEVEL_DEBUG, "port: %d", globals->port); + LOG(LOG_LEVEL_DEBUG, "crypt_level: %d", globals->crypt_level); + LOG(LOG_LEVEL_DEBUG, "allow_channels: %d", globals->allow_channels); + LOG(LOG_LEVEL_DEBUG, "max_bpp: %d", globals->max_bpp); + LOG(LOG_LEVEL_DEBUG, "fork: %d", globals->fork); + LOG(LOG_LEVEL_DEBUG, "tcp_nodelay: %d", globals->tcp_nodelay); + LOG(LOG_LEVEL_DEBUG, "tcp_keepalive: %d", globals->tcp_keepalive); + LOG(LOG_LEVEL_DEBUG, "tcp_send_buffer_bytes: %d", globals->tcp_send_buffer_bytes); + LOG(LOG_LEVEL_DEBUG, "tcp_recv_buffer_bytes: %d", globals->tcp_recv_buffer_bytes); + LOG(LOG_LEVEL_DEBUG, "new_cursors: %d", globals->new_cursors); + LOG(LOG_LEVEL_DEBUG, "allow_multimon: %d", globals->allow_multimon); - g_writeln("grey: %d", globals->grey); - g_writeln("black: %d", globals->black); - g_writeln("dark_grey: %d", globals->dark_grey); - g_writeln("blue: %d", globals->blue); - g_writeln("dark_blue: %d", globals->dark_blue); - g_writeln("white: %d", globals->white); - g_writeln("red: %d", globals->red); - g_writeln("green: %d", globals->green); - g_writeln("background: %d", globals->background); + LOG(LOG_LEVEL_DEBUG, "grey: %d", globals->grey); + LOG(LOG_LEVEL_DEBUG, "black: %d", globals->black); + LOG(LOG_LEVEL_DEBUG, "dark_grey: %d", globals->dark_grey); + LOG(LOG_LEVEL_DEBUG, "blue: %d", globals->blue); + LOG(LOG_LEVEL_DEBUG, "dark_blue: %d", globals->dark_blue); + LOG(LOG_LEVEL_DEBUG, "white: %d", globals->white); + LOG(LOG_LEVEL_DEBUG, "red: %d", globals->red); + LOG(LOG_LEVEL_DEBUG, "green: %d", globals->green); + LOG(LOG_LEVEL_DEBUG, "background: %d", globals->background); - g_writeln("autorun: %s", globals->autorun); - g_writeln("hidelogwindow: %d", globals->hidelogwindow); - g_writeln("require_credentials: %d", globals->require_credentials); - g_writeln("bulk_compression: %d", globals->bulk_compression); - g_writeln("new_cursors: %d", globals->new_cursors); - g_writeln("nego_sec_layer: %d", globals->nego_sec_layer); - g_writeln("allow_multimon: %d", globals->allow_multimon); - g_writeln("enable_token_login: %d", globals->enable_token_login) + LOG(LOG_LEVEL_DEBUG, "autorun: %s", globals->autorun); + LOG(LOG_LEVEL_DEBUG, "hidelogwindow: %d", globals->hidelogwindow); + LOG(LOG_LEVEL_DEBUG, "require_credentials: %d", globals->require_credentials); + LOG(LOG_LEVEL_DEBUG, "bulk_compression: %d", globals->bulk_compression); + LOG(LOG_LEVEL_DEBUG, "new_cursors: %d", globals->new_cursors); + LOG(LOG_LEVEL_DEBUG, "nego_sec_layer: %d", globals->nego_sec_layer); + LOG(LOG_LEVEL_DEBUG, "allow_multimon: %d", globals->allow_multimon); + LOG(LOG_LEVEL_DEBUG, "enable_token_login: %d", globals->enable_token_login) - g_writeln("ls_top_window_bg_color: %x", globals->ls_top_window_bg_color); - g_writeln("ls_width: %d", globals->ls_width); - g_writeln("ls_height: %d", globals->ls_height); - g_writeln("ls_bg_color: %x", globals->ls_bg_color); - g_writeln("ls_title: %s", globals->ls_title); - g_writeln("ls_logo_filename: %s", globals->ls_logo_filename); - g_writeln("ls_logo_x_pos: %d", globals->ls_logo_x_pos); - g_writeln("ls_logo_y_pos: %d", globals->ls_logo_y_pos); - g_writeln("ls_label_x_pos: %d", globals->ls_label_x_pos); - g_writeln("ls_label_width: %d", globals->ls_label_width); - g_writeln("ls_input_x_pos: %d", globals->ls_input_x_pos); - g_writeln("ls_input_width: %d", globals->ls_input_width); - g_writeln("ls_input_y_pos: %d", globals->ls_input_y_pos); - g_writeln("ls_btn_ok_x_pos: %d", globals->ls_btn_ok_x_pos); - g_writeln("ls_btn_ok_y_pos: %d", globals->ls_btn_ok_y_pos); - g_writeln("ls_btn_ok_width: %d", globals->ls_btn_ok_width); - g_writeln("ls_btn_ok_height: %d", globals->ls_btn_ok_height); - g_writeln("ls_btn_cancel_x_pos: %d", globals->ls_btn_cancel_x_pos); - g_writeln("ls_btn_cancel_y_pos: %d", globals->ls_btn_cancel_y_pos); - g_writeln("ls_btn_cancel_width: %d", globals->ls_btn_cancel_width); - g_writeln("ls_btn_cancel_height: %d", globals->ls_btn_cancel_height); -#endif + LOG(LOG_LEVEL_DEBUG, "ls_top_window_bg_color: %x", globals->ls_top_window_bg_color); + LOG(LOG_LEVEL_DEBUG, "ls_width: %d", globals->ls_width); + LOG(LOG_LEVEL_DEBUG, "ls_height: %d", globals->ls_height); + LOG(LOG_LEVEL_DEBUG, "ls_bg_color: %x", globals->ls_bg_color); + LOG(LOG_LEVEL_DEBUG, "ls_title: %s", globals->ls_title); + LOG(LOG_LEVEL_DEBUG, "ls_logo_filename: %s", globals->ls_logo_filename); + LOG(LOG_LEVEL_DEBUG, "ls_logo_x_pos: %d", globals->ls_logo_x_pos); + LOG(LOG_LEVEL_DEBUG, "ls_logo_y_pos: %d", globals->ls_logo_y_pos); + LOG(LOG_LEVEL_DEBUG, "ls_label_x_pos: %d", globals->ls_label_x_pos); + LOG(LOG_LEVEL_DEBUG, "ls_label_width: %d", globals->ls_label_width); + LOG(LOG_LEVEL_DEBUG, "ls_input_x_pos: %d", globals->ls_input_x_pos); + LOG(LOG_LEVEL_DEBUG, "ls_input_width: %d", globals->ls_input_width); + LOG(LOG_LEVEL_DEBUG, "ls_input_y_pos: %d", globals->ls_input_y_pos); + LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_x_pos: %d", globals->ls_btn_ok_x_pos); + LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_y_pos: %d", globals->ls_btn_ok_y_pos); + LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_width: %d", globals->ls_btn_ok_width); + LOG(LOG_LEVEL_DEBUG, "ls_btn_ok_height: %d", globals->ls_btn_ok_height); + LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_x_pos: %d", globals->ls_btn_cancel_x_pos); + LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_y_pos: %d", globals->ls_btn_cancel_y_pos); + LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_width: %d", globals->ls_btn_cancel_width); + LOG(LOG_LEVEL_DEBUG, "ls_btn_cancel_height: %d", globals->ls_btn_cancel_height); list_delete(names); list_delete(values); diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index ee8e32f8..4679bd6b 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -38,17 +38,7 @@ #include "xrdp_encoder.h" #include "xrdp_sockets.h" -#define LLOG_LEVEL 1 -#define LLOGLN(_level, _args) \ - do \ - { \ - if (_level < LLOG_LEVEL) \ - { \ - g_write("xrdp:xrdp_mm [%10.10u]: ", g_time3()); \ - g_writeln _args ; \ - } \ - } \ - while (0) + /*****************************************************************************/ struct xrdp_mm * @@ -63,15 +53,15 @@ xrdp_mm_create(struct xrdp_wm *owner) self->login_values = list_create(); self->login_values->auto_free = 1; - LLOGLN(0, ("xrdp_mm_create: bpp %d mcs_connection_type %d " - "jpeg_codec_id %d v3_codec_id %d rfx_codec_id %d " - "h264_codec_id %d", - self->wm->client_info->bpp, - self->wm->client_info->mcs_connection_type, - self->wm->client_info->jpeg_codec_id, - self->wm->client_info->v3_codec_id, - self->wm->client_info->rfx_codec_id, - self->wm->client_info->h264_codec_id)); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_mm_create: bpp %d mcs_connection_type %d " + "jpeg_codec_id %d v3_codec_id %d rfx_codec_id %d " + "h264_codec_id %d", + self->wm->client_info->bpp, + self->wm->client_info->mcs_connection_type, + self->wm->client_info->jpeg_codec_id, + self->wm->client_info->v3_codec_id, + self->wm->client_info->rfx_codec_id, + self->wm->client_info->h264_codec_id); self->encoder = xrdp_encoder_create(self); @@ -103,7 +93,7 @@ xrdp_mm_sync_load(long param1, long param2) static void xrdp_mm_module_cleanup(struct xrdp_mm *self) { - log_message(LOG_LEVEL_DEBUG, "xrdp_mm_module_cleanup"); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_module_cleanup"); if (self->mod != 0) { @@ -410,13 +400,13 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) if (self->mod != 0) { - g_writeln("loaded module '%s' ok, interface size %d, version %d", lib, - self->mod->size, self->mod->version); + LOG(LOG_LEVEL_INFO, "loaded module '%s' ok, interface size %d, version %d", lib, + self->mod->size, self->mod->version); } } else { - log_message(LOG_LEVEL_ERROR, "no mod_init or mod_exit address found"); + LOG(LOG_LEVEL_ERROR, "no mod_init or mod_exit address found"); } } else @@ -482,7 +472,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self) /* id self->mod is null, there must be a problem */ if (self->mod == 0) { - DEBUG(("problem loading lib in xrdp_mm_setup_mod1")); + LOG(LOG_LEVEL_ERROR, "problem loading lib in xrdp_mm_setup_mod1"); return 1; } @@ -733,7 +723,7 @@ xrdp_mm_process_rail_create_window(struct xrdp_mm *self, struct stream *s) g_memset(&rwso, 0, sizeof(rwso)); in_uint32_le(s, window_id); - g_writeln("xrdp_mm_process_rail_create_window: 0x%8.8x", window_id); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_process_rail_create_window: 0x%8.8x", window_id); in_uint32_le(s, rwso.owner_window_id); in_uint32_le(s, rwso.style); @@ -819,7 +809,7 @@ xrdp_mm_process_rail_configure_window(struct xrdp_mm *self, struct stream *s) g_memset(&rwso, 0, sizeof(rwso)); in_uint32_le(s, window_id); - g_writeln("xrdp_mm_process_rail_configure_window: 0x%8.8x", window_id); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_process_rail_configure_window: 0x%8.8x", window_id); in_uint32_le(s, rwso.client_offset_x); in_uint32_le(s, rwso.client_offset_y); @@ -887,7 +877,7 @@ xrdp_mm_process_rail_destroy_window(struct xrdp_mm *self, struct stream *s) int rv; in_uint32_le(s, window_id); - g_writeln("xrdp_mm_process_rail_destroy_window 0x%8.8x", window_id); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_process_rail_destroy_window 0x%8.8x", window_id); rv = libxrdp_orders_init(self->wm->session); if (rv == 0) { @@ -915,8 +905,8 @@ xrdp_mm_process_rail_show_window(struct xrdp_mm *self, struct stream *s) in_uint32_le(s, window_id); in_uint32_le(s, flags); in_uint32_le(s, rwso.show_state); - g_writeln("xrdp_mm_process_rail_show_window 0x%8.8x %x", window_id, - rwso.show_state); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_process_rail_show_window 0x%8.8x %x", window_id, + rwso.show_state); rv = libxrdp_orders_init(self->wm->session); if (rv == 0) { @@ -941,17 +931,17 @@ xrdp_mm_process_rail_update_window_text(struct xrdp_mm *self, struct stream *s) int window_id; struct rail_window_state_order rwso; - g_writeln("xrdp_mm_process_rail_update_window_text:"); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_process_rail_update_window_text:"); in_uint32_le(s, window_id); in_uint32_le(s, flags); - g_writeln(" update window title info: 0x%8.8x", window_id); + LOG(LOG_LEVEL_DEBUG, " update window title info: 0x%8.8x", window_id); g_memset(&rwso, 0, sizeof(rwso)); in_uint32_le(s, size); /* title size */ rwso.title_info = g_new(char, size + 1); in_uint8a(s, rwso.title_info, size); rwso.title_info[size] = 0; - g_writeln(" set window title %s size %d 0x%8.8x", rwso.title_info, size, flags); + LOG(LOG_LEVEL_DEBUG, " set window title %s size %d 0x%8.8x", rwso.title_info, size, flags); rv = libxrdp_orders_init(self->wm->session); if (rv == 0) { @@ -961,7 +951,7 @@ xrdp_mm_process_rail_update_window_text(struct xrdp_mm *self, struct stream *s) { rv = libxrdp_orders_send(self->wm->session); } - g_writeln(" set window title %s %d", rwso.title_info, rv); + LOG(LOG_LEVEL_DEBUG, " set window title %s %d", rwso.title_info, rv); g_free(rwso.title_info); @@ -1005,7 +995,7 @@ xrdp_mm_process_rail_drawing_orders(struct xrdp_mm *self, struct stream *s) int xrdp_mm_drdynvc_up(struct xrdp_mm *self) { - LLOGLN(0, ("xrdp_mm_drdynvc_up:")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_mm_drdynvc_up:"); return 0; } @@ -1014,9 +1004,9 @@ int xrdp_mm_suppress_output(struct xrdp_mm *self, int suppress, int left, int top, int right, int bottom) { - LLOGLN(0, ("xrdp_mm_suppress_output: suppress %d " - "left %d top %d right %d bottom %d", - suppress, left, top, right, bottom)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_suppress_output: suppress %d " + "left %d top %d right %d bottom %d", + suppress, left, top, right, bottom); if (self->mod != NULL) { if (self->mod->mod_suppress_output != NULL) @@ -1039,8 +1029,8 @@ xrdp_mm_drdynvc_open_response(intptr_t id, int chan_id, int creation_status) struct xrdp_process *pro; int chansrv_chan_id; - LLOGLN(10, ("xrdp_mm_drdynvc_open_response: chan_id %d creation_status %d", - chan_id, creation_status)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_drdynvc_open_response: chan_id %d creation_status %d", + chan_id, creation_status); pro = (struct xrdp_process *) id; wm = pro->wm; trans = wm->mm->chan_trans; @@ -1347,7 +1337,7 @@ xrdp_mm_chan_process_msg(struct xrdp_mm *self, struct trans *trans, next_msg += size; s_end = s->end; s->end = next_msg; - LLOGLN(10, ("xrdp_mm_chan_process_msg: got msg id %d", id)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_chan_process_msg: got msg id %d", id); switch (id) { case 8: /* channel data */ @@ -1369,13 +1359,13 @@ xrdp_mm_chan_process_msg(struct xrdp_mm *self, struct trans *trans, rv = xrdp_mm_trans_process_drdynvc_data(self, s); break; default: - log_message(LOG_LEVEL_ERROR, "xrdp_mm_chan_process_msg: unknown id %d", id); + LOG(LOG_LEVEL_ERROR, "xrdp_mm_chan_process_msg: unknown id %d", id); break; } s->end = s_end; if (rv != 0) { - LLOGLN(0, ("xrdp_mm_chan_process_msg: error rv %d id %d", rv, id)); + LOG(LOG_LEVEL_ERROR, "xrdp_mm_chan_process_msg: error rv %d id %d", rv, id); rv = 0; } @@ -1413,7 +1403,7 @@ xrdp_mm_chan_data_in(struct trans *trans) { in_uint8s(s, 4); /* id */ in_uint32_le(s, size); - LLOGLN(10, ("xrdp_mm_chan_data_in: got header, size %d", size)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_chan_data_in: got header, size %d", size); if (size > 8) { self->chan_trans->header_size = size; @@ -1426,8 +1416,8 @@ xrdp_mm_chan_data_in(struct trans *trans) self->chan_trans->header_size = 8; trans->extra_flags = 0; init_stream(s, 0); - LLOGLN(10, ("xrdp_mm_chan_data_in: got whole message, reset for " - "next header")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_chan_data_in: got whole message, reset for " + "next header"); return error; } @@ -1442,9 +1432,9 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port) if (self->wm->client_info->channels_allowed == 0) { - log_message(LOG_LEVEL_DEBUG, "%s: " - "skip connecting to chansrv because all channels are disabled", - __func__); + LOG(LOG_LEVEL_DEBUG, "%s: " + "skip connecting to chansrv because all channels are disabled", + __func__); return 0; } @@ -1482,27 +1472,27 @@ xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port) break; } g_sleep(1000); - log_message(LOG_LEVEL_ERROR, "xrdp_mm_connect_chansrv: connect failed " - "trying again..."); + LOG(LOG_LEVEL_WARNING, "xrdp_mm_connect_chansrv: connect failed " + "trying again..."); } if (!(self->chan_trans_up)) { - log_message(LOG_LEVEL_ERROR, "xrdp_mm_connect_chansrv: error in " - "trans_connect chan"); + LOG(LOG_LEVEL_ERROR, "xrdp_mm_connect_chansrv: error in " + "trans_connect chan"); } if (self->chan_trans_up) { if (xrdp_mm_trans_send_channel_setup(self, self->chan_trans) != 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_mm_connect_chansrv: error in " - "xrdp_mm_trans_send_channel_setup"); + LOG(LOG_LEVEL_ERROR, "xrdp_mm_connect_chansrv: error in " + "xrdp_mm_trans_send_channel_setup"); } else { - log_message(LOG_LEVEL_DEBUG, "xrdp_mm_connect_chansrv: chansrv " - "connect successful"); + LOG(LOG_LEVEL_DEBUG, "xrdp_mm_connect_chansrv: chansrv " + "connect successful"); } } @@ -1549,13 +1539,13 @@ xrdp_mm_update_allowed_channels(struct xrdp_mm *self) libxrdp_disable_channel(session, chan_id, disabled); if (disabled) { - g_writeln("xrdp_mm_update_allowed_channels: channel %s " - "channel id %d is disabled", chan_name, chan_id); + LOG(LOG_LEVEL_INFO, "xrdp_mm_update_allowed_channels: channel %s " + "channel id %d is disabled", chan_name, chan_id); } else { - g_writeln("xrdp_mm_update_allowed_channels: channel %s " - "channel id %d is allowed", chan_name, chan_id); + LOG(LOG_LEVEL_INFO, "xrdp_mm_update_allowed_channels: channel %s " + "channel id %d is allowed", chan_name, chan_id); } } } @@ -1717,7 +1707,7 @@ xrdp_mm_process_channel_data(struct xrdp_mm *self, tbus param1, tbus param2, if (total_length < length) { - log_message(LOG_LEVEL_DEBUG, "WARNING in xrdp_mm_process_channel_data(): total_len < length"); + LOG(LOG_LEVEL_WARNING, "WARNING in xrdp_mm_process_channel_data(): total_len < length"); total_length = length; } @@ -1834,7 +1824,7 @@ access_control(char *username, char *password, char *srv) out_uint32_be(out_s, 0); /* version */ index = (int)(out_s->end - out_s->data); out_uint32_be(out_s, index); /* size */ - /* g_writeln("Number of data to send : %d",index); */ + LOG(LOG_LEVEL_DEBUG, "Number of data to send : %d", index); reply = g_tcp_send(socket, out_s->data, index, 0); free_stream(out_s); @@ -1849,7 +1839,7 @@ access_control(char *username, char *password, char *srv) { in_s->end = in_s->end + reply; in_uint32_be(in_s, version); - /*g_writeln("Version number in reply from sesman: %d",version) ; */ + LOG(LOG_LEVEL_INFO, "Version number in reply from sesman: %lu", version); in_uint32_be(in_s, size); if ((size == 14) && (version == 0)) @@ -1860,8 +1850,8 @@ access_control(char *username, char *password, char *srv) if (code != 4) /*0x04 means SCP_GW_AUTHENTICATION*/ { - log_message(LOG_LEVEL_ERROR, "Returned cmd code from " - "sesman is corrupt"); + LOG(LOG_LEVEL_ERROR, "Returned cmd code from " + "sesman is corrupt"); } else { @@ -1870,23 +1860,23 @@ access_control(char *username, char *password, char *srv) } else { - log_message(LOG_LEVEL_ERROR, "Corrupt reply size or " - "version from sesman: %ld", size); + LOG(LOG_LEVEL_ERROR, "Corrupt reply size or " + "version from sesman: %ld", size); } } else { - log_message(LOG_LEVEL_ERROR, "No data received from sesman"); + LOG(LOG_LEVEL_ERROR, "No data received from sesman"); } } else { - log_message(LOG_LEVEL_ERROR, "Timeout when waiting for sesman"); + LOG(LOG_LEVEL_ERROR, "Timeout when waiting for sesman"); } } else { - log_message(LOG_LEVEL_ERROR, "No success sending to sesman"); + LOG(LOG_LEVEL_ERROR, "No success sending to sesman"); } free_stream(in_s); @@ -1894,12 +1884,12 @@ access_control(char *username, char *password, char *srv) } else { - log_message(LOG_LEVEL_ERROR, "Failure connecting to socket sesman"); + LOG(LOG_LEVEL_ERROR, "Failure connecting to socket sesman"); } } else { - log_message(LOG_LEVEL_ERROR, "Failure creating socket - for access control"); + LOG(LOG_LEVEL_ERROR, "Failure creating socket - for access control"); } if (socket != -1) @@ -2262,16 +2252,16 @@ xrdp_mm_connect(struct xrdp_mm *self) xrdp_wm_log_msg(self->wm, LOG_LEVEL_DEBUG, "Please wait, we now perform access control..."); - /* g_writeln("we use pam modules to check if we can approve this user"); */ + LOG(LOG_LEVEL_DEBUG, "we use pam modules to check if we can approve this user"); if (!g_strncmp(pam_auth_username, "same", 255)) { - log_message(LOG_LEVEL_DEBUG, "pamusername copied from username - same: %s", username); + LOG(LOG_LEVEL_DEBUG, "pamusername copied from username - same: %s", username); g_strncpy(pam_auth_username, username, 255); } if (!g_strncmp(pam_auth_password, "same", 255)) { - log_message(LOG_LEVEL_DEBUG, "pam_auth_password copied from username - same: %s", password); + LOG(LOG_LEVEL_DEBUG, "pam_auth_password copied from username - same: %s", password); g_strncpy(pam_auth_password, password, 255); } @@ -2324,8 +2314,8 @@ xrdp_mm_connect(struct xrdp_mm *self) break; } g_sleep(1000); - g_writeln("xrdp_mm_connect: connect failed " - "trying again..."); + LOG(LOG_LEVEL_INFO, "xrdp_mm_connect: connect failed " + "trying again..."); } if (ok) @@ -2365,7 +2355,7 @@ xrdp_mm_connect(struct xrdp_mm *self) } else { - log_message(LOG_LEVEL_ERROR, "Failure setting up module"); + LOG(LOG_LEVEL_ERROR, "Failure setting up module"); } if (self->wm->login_state != WMLS_CLEANUP) @@ -2383,7 +2373,7 @@ xrdp_mm_connect(struct xrdp_mm *self) xrdp_mm_connect_chansrv(self, "", chansrvport); } - log_message(LOG_LEVEL_DEBUG, "return value from xrdp_mm_connect %d", rv); + LOG(LOG_LEVEL_DEBUG, "return value from xrdp_mm_connect %d", rv); return rv; } @@ -2479,7 +2469,7 @@ xrdp_mm_dump_jpeg(struct xrdp_mm *self, XRDP_ENC_DATA_DONE *enc_done) enc_done->pad_bytes + 2 + pheader_bytes[0], enc_done->comp_bytes - (2 + pheader_bytes[0])); jj++; - g_writeln("dumping jpeg index %d", jj); + LOG(LOG_LEVEL_INFO, "dumping jpeg index %d", jj); } return 0; } @@ -2490,7 +2480,7 @@ xrdp_mm_dump_jpeg(struct xrdp_mm *self, XRDP_ENC_DATA_DONE *enc_done) int xrdp_mm_check_chan(struct xrdp_mm *self) { - //g_writeln("xrdp_mm_check_chan:"); + LOG(LOG_LEVEL_TRACE, "xrdp_mm_check_chan:"); if ((self->chan_trans != 0) && self->chan_trans_up) { if (trans_check_wait_objs(self->chan_trans) != 0) @@ -2521,8 +2511,8 @@ xrdp_mm_update_module_frame_ack(struct xrdp_mm *self) { if (encoder->frame_id_server > encoder->frame_id_server_sent) { - LLOGLN(10, ("xrdp_mm_update_module_ack: frame_id_server %d", - encoder->frame_id_server)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_update_module_ack: frame_id_server %d", + encoder->frame_id_server); encoder->frame_id_server_sent = encoder->frame_id_server; self->mod->mod_frame_ack(self->mod, 0, encoder->frame_id_server); } @@ -2551,8 +2541,8 @@ xrdp_mm_process_enc_done(struct xrdp_mm *self) break; } /* do something with msg */ - LLOGLN(10, ("xrdp_mm_process_enc_done: message back bytes %d", - enc_done->comp_bytes)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_process_enc_done: message back bytes %d", + enc_done->comp_bytes); x = enc_done->x; y = enc_done->y; cx = enc_done->cx; @@ -2574,7 +2564,7 @@ xrdp_mm_process_enc_done(struct xrdp_mm *self) /* free enc_done */ if (enc_done->last) { - LLOGLN(10, ("xrdp_mm_process_enc_done: last set")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_process_enc_done: last set"); if (self->wm->client_info->use_frame_acks == 0) { self->mod->mod_frame_ack(self->mod, @@ -2672,14 +2662,14 @@ xrdp_mm_frame_ack(struct xrdp_mm *self, int frame_id) { struct xrdp_encoder *encoder; - LLOGLN(10, ("xrdp_mm_frame_ack:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_frame_ack:"); if (self->wm->client_info->use_frame_acks == 0) { return 1; } encoder = self->encoder; - LLOGLN(10, ("xrdp_mm_frame_ack: incoming %d, client %d, server %d", - frame_id, encoder->frame_id_client, encoder->frame_id_server)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_mm_frame_ack: incoming %d, client %d, server %d", + frame_id, encoder->frame_id_client, encoder->frame_id_server); if ((frame_id < 0) || (frame_id > encoder->frame_id_server)) { /* if frame_id is negative or bigger then what server last sent @@ -2895,7 +2885,7 @@ server_composite(struct xrdp_mod *mod, int srcidx, int srcformat, } else { - g_writeln("server_composite: error finding id %d or %d", srcidx, mskidx); + LOG(LOG_LEVEL_WARNING, "server_composite: error finding id %d or %d", srcidx, mskidx); } return 0; } @@ -2917,8 +2907,7 @@ server_paint_rects(struct xrdp_mod *mod, int num_drects, short *drects, wm = (struct xrdp_wm *)(mod->wm); mm = wm->mm; - LLOGLN(10, ("server_paint_rects:")); - LLOGLN(10, ("server_paint_rects: %p", mm->encoder)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "server_paint_rects: %p", mm->encoder); if (mm->encoder != 0) { @@ -2959,7 +2948,7 @@ server_paint_rects(struct xrdp_mod *mod, int num_drects, short *drects, enc_data->frame_id = frame_id; if (width == 0 || height == 0) { - LLOGLN(10, ("server_paint_rects: error")); + LOG_DEVEL(LOG_LEVEL_WARNING, "server_paint_rects: error"); } /* insert into fifo for encoder thread to process */ @@ -2973,7 +2962,7 @@ server_paint_rects(struct xrdp_mod *mod, int num_drects, short *drects, return 0; } - //g_writeln("server_paint_rects:"); + LOG(LOG_LEVEL_TRACE, "server_paint_rects:"); p = (struct xrdp_painter *)(mod->painter); if (p == 0) @@ -3000,7 +2989,7 @@ server_session_info(struct xrdp_mod *mod, const char *data, int data_bytes) { struct xrdp_wm *wm; - LLOGLN(10, ("server_session_info:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "server_session_info:"); wm = (struct xrdp_wm *)(mod->wm); return libxrdp_send_session_info(wm->session, data, data_bytes); } @@ -3054,7 +3043,7 @@ server_msg(struct xrdp_mod *mod, char *msg, int code) if (code == 1) { - g_writeln("%s", msg); + LOG(LOG_LEVEL_INFO, "%s", msg); return 0; } @@ -3398,7 +3387,7 @@ server_create_os_surface(struct xrdp_mod *mod, int rdpindex, if (error != 0) { - log_message(LOG_LEVEL_ERROR, "server_create_os_surface: xrdp_cache_add_os_bitmap failed"); + LOG(LOG_LEVEL_ERROR, "server_create_os_surface: xrdp_cache_add_os_bitmap failed"); return 1; } @@ -3422,7 +3411,7 @@ server_create_os_surface_bpp(struct xrdp_mod *mod, int rdpindex, error = xrdp_cache_add_os_bitmap(wm->cache, bitmap, rdpindex); if (error != 0) { - g_writeln("server_create_os_surface_bpp: xrdp_cache_add_os_bitmap failed"); + LOG(LOG_LEVEL_ERROR, "server_create_os_surface_bpp: xrdp_cache_add_os_bitmap failed"); return 1; } bitmap->item_index = rdpindex; @@ -3438,18 +3427,18 @@ server_switch_os_surface(struct xrdp_mod *mod, int rdpindex) struct xrdp_os_bitmap_item *bi; struct xrdp_painter *p; - //g_writeln("server_switch_os_surface: id 0x%x", id); + LOG(LOG_LEVEL_DEBUG, "server_switch_os_surface: id 0x%x", rdpindex); wm = (struct xrdp_wm *)(mod->wm); if (rdpindex == -1) { - //g_writeln("server_switch_os_surface: setting target_surface to screen"); + LOG(LOG_LEVEL_DEBUG, "server_switch_os_surface: setting target_surface to screen"); wm->target_surface = wm->screen; p = (struct xrdp_painter *)(mod->painter); if (p != 0) { - //g_writeln("setting target"); + LOG(LOG_LEVEL_DEBUG, "setting target"); wm_painter_set_target(p); } @@ -3460,19 +3449,19 @@ server_switch_os_surface(struct xrdp_mod *mod, int rdpindex) if ((bi != 0) && (bi->bitmap != 0)) { - //g_writeln("server_switch_os_surface: setting target_surface to rdpid %d", id); + LOG(LOG_LEVEL_DEBUG, "server_switch_os_surface: setting target_surface to rdpid %d", rdpindex); wm->target_surface = bi->bitmap; p = (struct xrdp_painter *)(mod->painter); if (p != 0) { - //g_writeln("setting target"); + LOG(LOG_LEVEL_DEBUG, "setting target"); wm_painter_set_target(p); } } else { - log_message(LOG_LEVEL_ERROR, "server_switch_os_surface: error finding id %d", rdpindex); + LOG(LOG_LEVEL_WARNING, "server_switch_os_surface: error finding id %d", rdpindex); } return 0; @@ -3485,20 +3474,20 @@ server_delete_os_surface(struct xrdp_mod *mod, int rdpindex) struct xrdp_wm *wm; struct xrdp_painter *p; - //g_writeln("server_delete_os_surface: id 0x%x", id); + LOG(LOG_LEVEL_DEBUG, "server_delete_os_surface: id 0x%x", rdpindex); wm = (struct xrdp_wm *)(mod->wm); if (wm->target_surface->type == WND_TYPE_OFFSCREEN) { if (wm->target_surface->id == rdpindex) { - g_writeln("server_delete_os_surface: setting target_surface to screen"); + LOG(LOG_LEVEL_DEBUG, "server_delete_os_surface: setting target_surface to screen"); wm->target_surface = wm->screen; p = (struct xrdp_painter *)(mod->painter); if (p != 0) { - //g_writeln("setting target"); + LOG(LOG_LEVEL_DEBUG, "setting target"); wm_painter_set_target(p); } } @@ -3535,7 +3524,7 @@ server_paint_rect_os(struct xrdp_mod *mod, int x, int y, int cx, int cy, } else { - log_message(LOG_LEVEL_ERROR, "server_paint_rect_os: error finding id %d", rdpindex); + LOG(LOG_LEVEL_ERROR, "server_paint_rect_os: error finding id %d", rdpindex); } return 0; diff --git a/xrdp/xrdp_painter.c b/xrdp/xrdp_painter.c index cd0af840..b02c9072 100644 --- a/xrdp/xrdp_painter.c +++ b/xrdp/xrdp_painter.c @@ -29,17 +29,7 @@ #include /* libpainter */ #endif -#define LLOG_LEVEL 1 -#define LLOGLN(_level, _args) \ - do \ - { \ - if (_level < LLOG_LEVEL) \ - { \ - g_write("xrdp:xrdp_painter [%10.10u]: ", g_time3()); \ - g_writeln _args ; \ - } \ - } \ - while (0) + #if defined(XRDP_PAINTER) @@ -72,8 +62,8 @@ xrdp_painter_add_dirty_rect(struct xrdp_painter *self, int x, int y, rect.right = x + cx; rect.bottom = y + cy; xrdp_region_add_rect(self->dirty_region, &rect); - LLOGLN(10, ("xrdp_painter_add_dirty_rect: x %d y %d cx %d cy %d", - x, y, cx, cy)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_add_dirty_rect: x %d y %d cx %d cy %d", + x, y, cx, cy); return 0; } @@ -93,7 +83,7 @@ xrdp_painter_send_dirty(struct xrdp_painter *self) char *dst; struct xrdp_rect rect; - LLOGLN(10, ("xrdp_painter_send_dirty:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_send_dirty:"); bpp = self->wm->screen->bpp; Bpp = (bpp + 7) / 8; @@ -123,8 +113,8 @@ xrdp_painter_send_dirty(struct xrdp_painter *self) src += self->wm->screen->line_size; dst += cx * Bpp; } - LLOGLN(10, ("xrdp_painter_send_dirty: x %d y %d cx %d cy %d", - rect.left, rect.top, cx, cy)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_send_dirty: x %d y %d cx %d cy %d", + rect.left, rect.top, cx, cy); libxrdp_send_bitmap(self->session, cx, cy, bpp, ldata, rect.left, rect.top, cx, cy); g_free(ldata); @@ -147,7 +137,7 @@ xrdp_painter_create(struct xrdp_wm *wm, struct xrdp_session *session) { struct xrdp_painter *self; - LLOGLN(10, ("xrdp_painter_create:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_create:"); self = (struct xrdp_painter *)g_malloc(sizeof(struct xrdp_painter), 1); self->wm = wm; self->session = session; @@ -161,11 +151,11 @@ xrdp_painter_create(struct xrdp_wm *wm, struct xrdp_session *session) if (painter_create(&(self->painter)) != PT_ERROR_NONE) { self->painter = 0; - LLOGLN(0, ("xrdp_painter_create: painter_create failed")); + LOG_DEVEL(LOG_LEVEL_WARNING, "xrdp_painter_create: painter_create failed"); } else { - LLOGLN(10, ("xrdp_painter_create: painter_create success")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_create: painter_create success"); } self->dirty_region = xrdp_region_create(wm); #endif @@ -178,7 +168,7 @@ xrdp_painter_create(struct xrdp_wm *wm, struct xrdp_session *session) void xrdp_painter_delete(struct xrdp_painter *self) { - LLOGLN(10, ("xrdp_painter_delete:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_delete:"); if (self == 0) { return; @@ -200,7 +190,7 @@ wm_painter_set_target(struct xrdp_painter *self) int index; struct list *del_list; - LLOGLN(10, ("wm_painter_set_target:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "wm_painter_set_target:"); if (self->painter != 0) { @@ -240,7 +230,7 @@ wm_painter_set_target(struct xrdp_painter *self) } else { - g_writeln("xrdp_painter_begin_update: bad target_surface"); + LOG(LOG_LEVEL_WARNING, "xrdp_painter_begin_update: bad target_surface"); } return 0; @@ -250,7 +240,7 @@ wm_painter_set_target(struct xrdp_painter *self) int xrdp_painter_begin_update(struct xrdp_painter *self) { - LLOGLN(10, ("xrdp_painter_begin_update:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_begin_update:"); if (self == 0) { return 0; @@ -272,7 +262,7 @@ xrdp_painter_begin_update(struct xrdp_painter *self) int xrdp_painter_end_update(struct xrdp_painter *self) { - LLOGLN(10, ("xrdp_painter_end_update:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_end_update:"); if (self == 0) { return 0; @@ -445,7 +435,7 @@ xrdp_painter_text_width(struct xrdp_painter *self, const char *text) struct xrdp_font_char *font_item; twchar *wstr; - LLOGLN(10, ("xrdp_painter_text_width:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_text_width:"); xrdp_painter_font_needed(self); if (self->font == 0) @@ -483,7 +473,7 @@ xrdp_painter_text_height(struct xrdp_painter *self, const char *text) struct xrdp_font_char *font_item; twchar *wstr; - LLOGLN(10, ("xrdp_painter_text_height:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_text_height:"); xrdp_painter_font_needed(self); if (self->font == 0) @@ -519,7 +509,7 @@ xrdp_painter_setup_brush(struct xrdp_painter *self, { int cache_id; - LLOGLN(10, ("xrdp_painter_setup_brush:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_setup_brush:"); if (self->painter != 0) { @@ -591,7 +581,7 @@ xrdp_painter_fill_rect(struct xrdp_painter *self, int dy; int rop; - LLOGLN(10, ("xrdp_painter_fill_rect:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_fill_rect:"); if (self == 0) { @@ -608,10 +598,10 @@ xrdp_painter_fill_rect(struct xrdp_painter *self, struct xrdp_bitmap *ldst; struct painter_bitmap pat; - LLOGLN(10, ("xrdp_painter_fill_rect: dst->type %d", dst->type)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_fill_rect: dst->type %d", dst->type); if (dst->type != WND_TYPE_OFFSCREEN) { - LLOGLN(10, ("xrdp_painter_fill_rect: using painter")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_fill_rect: using painter"); ldst = self->wm->screen; @@ -622,9 +612,9 @@ xrdp_painter_fill_rect(struct xrdp_painter *self, dst_pb.height = ldst->height; dst_pb.data = ldst->data; - LLOGLN(10, ("xrdp_painter_fill_rect: ldst->width %d ldst->height %d " - "dst->data %p self->fg_color %d", - ldst->width, ldst->height, ldst->data, self->fg_color)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_fill_rect: ldst->width %d ldst->height %d " + "dst->data %p self->fg_color %d", + ldst->width, ldst->height, ldst->data, self->fg_color); xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy); region = xrdp_region_create(self->wm); @@ -833,7 +823,7 @@ xrdp_painter_draw_text(struct xrdp_painter *self, struct xrdp_font_char *font_item; twchar *wstr; - LLOGLN(10, ("xrdp_painter_draw_text:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_draw_text:"); if (self == 0) { @@ -1026,7 +1016,7 @@ xrdp_painter_draw_text2(struct xrdp_painter *self, int dx; int dy; - LLOGLN(0, ("xrdp_painter_draw_text2:")); + LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_painter_draw_text2:"); if (self == 0) { @@ -1128,7 +1118,7 @@ xrdp_painter_copy(struct xrdp_painter *self, int index; struct list *del_list; - LLOGLN(10, ("xrdp_painter_copy:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_copy:"); if (self == 0 || src == 0 || dst == 0) { @@ -1142,12 +1132,12 @@ xrdp_painter_copy(struct xrdp_painter *self, struct painter_bitmap dst_pb; struct xrdp_bitmap *ldst; - LLOGLN(10, ("xrdp_painter_copy: src->type %d dst->type %d", src->type, dst->type)); - LLOGLN(10, ("xrdp_painter_copy: self->rop 0x%2.2x", self->rop)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_copy: src->type %d dst->type %d", src->type, dst->type); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_copy: self->rop 0x%2.2x", self->rop); if (dst->type != WND_TYPE_OFFSCREEN) { - LLOGLN(10, ("xrdp_painter_copy: using painter")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_copy: using painter"); ldst = self->wm->screen; g_memset(&dst_pb, 0, sizeof(dst_pb)); @@ -1181,8 +1171,8 @@ xrdp_painter_copy(struct xrdp_painter *self, draw_rect.left, draw_rect.top, draw_rect.right - draw_rect.left, draw_rect.bottom - draw_rect.top); - LLOGLN(10, (" x %d y %d cx %d cy %d srcx %d srcy %d", - x, y, cx, cy, srcx, srcy)); + LOG_DEVEL(LOG_LEVEL_DEBUG, " x %d y %d cx %d cy %d srcx %d srcy %d", + x, y, cx, cy, srcx, srcy); painter_copy(self->painter, &dst_pb, x, y, cx, cy, &src_pb, srcx, srcy); xrdp_painter_add_dirty_rect(self, x, y, cx, cy, @@ -1241,20 +1231,20 @@ xrdp_painter_copy(struct xrdp_painter *self, } else if (src->type == WND_TYPE_OFFSCREEN) { - //g_writeln("xrdp_painter_copy: todo"); + LOG(LOG_LEVEL_DEBUG, "xrdp_painter_copy: todo"); xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy); region = xrdp_region_create(self->wm); if (dst->type != WND_TYPE_OFFSCREEN) { - //g_writeln("off screen to screen"); + LOG(LOG_LEVEL_DEBUG, "off screen to screen"); xrdp_wm_get_vis_region(self->wm, dst, x, y, cx, cy, region, self->clip_children); } else { - //g_writeln("off screen to off screen"); + LOG(LOG_LEVEL_DEBUG, "off screen to off screen"); xrdp_region_add_rect(region, &clip_rect); } @@ -1267,7 +1257,7 @@ xrdp_painter_copy(struct xrdp_painter *self, if (src->tab_stop == 0) { - g_writeln("xrdp_painter_copy: warning src not created"); + LOG(LOG_LEVEL_WARNING, "xrdp_painter_copy: warning src not created"); del_list = self->wm->cache->xrdp_os_del_list; index = list_index_of(del_list, cache_idx); list_remove_item(del_list, index); @@ -1400,7 +1390,7 @@ xrdp_painter_composite(struct xrdp_painter *self, int cache_srcidx; int cache_mskidx; - LLOGLN(0, ("xrdp_painter_composite:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_composite:"); if (self == 0 || src == 0 || dst == 0) { @@ -1474,7 +1464,7 @@ xrdp_painter_line(struct xrdp_painter *self, int dy; int rop; - LLOGLN(10, ("xrdp_painter_line:")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_line:"); if (self == 0) { return 0; @@ -1489,12 +1479,12 @@ xrdp_painter_line(struct xrdp_painter *self, struct painter_bitmap dst_pb; struct xrdp_bitmap *ldst; - LLOGLN(10, ("xrdp_painter_line: dst->type %d", dst->type)); - LLOGLN(10, ("xrdp_painter_line: self->rop 0x%2.2x", self->rop)); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_line: dst->type %d", dst->type); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_line: self->rop 0x%2.2x", self->rop); if (dst->type != WND_TYPE_OFFSCREEN) { - LLOGLN(10, ("xrdp_painter_line: using painter")); + LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_line: using painter"); ldst = self->wm->screen; g_memset(&dst_pb, 0, sizeof(dst_pb)); diff --git a/xrdp/xrdp_process.c b/xrdp/xrdp_process.c index 8f392bc1..00868ab2 100644 --- a/xrdp/xrdp_process.c +++ b/xrdp/xrdp_process.c @@ -77,7 +77,7 @@ xrdp_process_loop(struct xrdp_process *self, struct stream *s) if ((self->wm == 0) && (self->session->up_and_running) && (rv == 0)) { - DEBUG(("calling xrdp_wm_init and creating wm")); + LOG_DEVEL(LOG_LEVEL_TRACE, "calling xrdp_wm_init and creating wm"); self->wm = xrdp_wm_create(self, self->session->client_info); /* at this point the wm(window manager) is created and wm::login_state is WMLS_RESET and wm::login_state_event is set @@ -127,7 +127,7 @@ xrdp_process_data_in(struct trans *self) struct stream *s; int len; - DEBUG(("xrdp_process_data_in")); + LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_process_data_in"); pro = (struct xrdp_process *)(self->callback_data); s = pro->server_trans->in_s; @@ -137,8 +137,8 @@ xrdp_process_data_in(struct trans *self) /* early in connection sequence, we're in this mode */ if (xrdp_process_loop(pro, 0) != 0) { - g_writeln("xrdp_process_data_in: " - "xrdp_process_loop failed"); + LOG(LOG_LEVEL_ERROR, "xrdp_process_data_in: " + "xrdp_process_loop failed"); return 1; } if (pro->session->up_and_running) @@ -184,8 +184,8 @@ xrdp_process_data_in(struct trans *self) len = libxrdp_get_pdu_bytes(s->p); if (len == -1) { - g_writeln("xrdp_process_data_in: " - "xrdp_process_get_packet_bytes failed"); + LOG(LOG_LEVEL_ERROR, "xrdp_process_data_in: " + "xrdp_process_get_packet_bytes failed"); return 1; } pro->server_trans->header_size = len; @@ -204,8 +204,8 @@ xrdp_process_data_in(struct trans *self) s->p = s->data; if (xrdp_process_loop(pro, s) != 0) { - g_writeln("xrdp_process_data_in: " - "xrdp_process_loop failed"); + LOG(LOG_LEVEL_ERROR, "xrdp_process_data_in: " + "xrdp_process_loop failed"); return 1; } init_stream(s, 0); @@ -228,7 +228,7 @@ xrdp_process_main_loop(struct xrdp_process *self) tbus wobjs[32]; tbus term_obj; - DEBUG(("xrdp_process_main_loop")); + LOG_DEVEL(LOG_LEVEL_TRACE, "xrdp_process_main_loop"); self->status = 1; self->server_trans->extra_flags = 0; self->server_trans->header_size = 0; @@ -296,7 +296,7 @@ xrdp_process_main_loop(struct xrdp_process *self) } else { - g_writeln("xrdp_process_main_loop: libxrdp_process_incoming failed"); + LOG(LOG_LEVEL_ERROR, "xrdp_process_main_loop: libxrdp_process_incoming failed"); /* this will try to send a disconnect, maybe should check that connection got far enough */ libxrdp_disconnect(self->session); diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index a93419b4..72beff02 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -29,17 +29,7 @@ #include "log.h" #include "string_calls.h" -#define LLOG_LEVEL 1 -#define LLOGLN(_level, _args) \ - do \ - { \ - if (_level < LLOG_LEVEL) \ - { \ - g_write("xrdp:xrdp_wm [%10.10u]: ", g_time3()); \ - g_writeln _args ; \ - } \ - } \ - while (0) + /*****************************************************************************/ struct xrdp_wm * @@ -65,7 +55,7 @@ xrdp_wm_create(struct xrdp_process *owner, pid = g_getpid(); g_snprintf(event_name, 255, "xrdp_%8.8x_wm_login_state_event_%8.8x", pid, owner->session_id); - log_message(LOG_LEVEL_DEBUG, "%s", event_name); + LOG(LOG_LEVEL_DEBUG, "%s", event_name); self->login_state_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); @@ -249,8 +239,8 @@ xrdp_wm_load_pointer(struct xrdp_wm *self, char *file_name, char *data, if (!g_file_exist(file_name)) { - log_message(LOG_LEVEL_ERROR, "xrdp_wm_load_pointer: error pointer file [%s] does not exist", - file_name); + LOG(LOG_LEVEL_ERROR, "xrdp_wm_load_pointer: error pointer file [%s] does not exist", + file_name); return 1; } @@ -260,8 +250,8 @@ xrdp_wm_load_pointer(struct xrdp_wm *self, char *file_name, char *data, if (fd < 0) { - log_message(LOG_LEVEL_ERROR, "xrdp_wm_load_pointer: error loading pointer from file [%s]", - file_name); + LOG(LOG_LEVEL_ERROR, "xrdp_wm_load_pointer: error loading pointer from file [%s]", + file_name); xstream_free(fs); return 1; } @@ -508,7 +498,7 @@ xrdp_wm_load_static_colors_plus(struct xrdp_wm *self, char *autorun_name) } else { - log_message(LOG_LEVEL_ERROR, "xrdp_wm_load_static_colors: Could not read xrdp.ini file %s", self->session->xrdp_ini); + LOG(LOG_LEVEL_WARNING, "xrdp_wm_load_static_colors: Could not read xrdp.ini file %s", self->session->xrdp_ini); } if (self->screen->bpp == 8) @@ -542,13 +532,13 @@ xrdp_wm_load_static_pointers(struct xrdp_wm *self) struct xrdp_pointer_item pointer_item; char file_path[256]; - DEBUG(("sending cursor")); + LOG_DEVEL(LOG_LEVEL_TRACE, "sending cursor"); g_snprintf(file_path, 255, "%s/cursor1.cur", XRDP_SHARE_PATH); g_memset(&pointer_item, 0, sizeof(pointer_item)); xrdp_wm_load_pointer(self, file_path, pointer_item.data, pointer_item.mask, &pointer_item.x, &pointer_item.y); xrdp_cache_add_pointer_static(self->cache, &pointer_item, 1); - DEBUG(("sending cursor")); + LOG_DEVEL(LOG_LEVEL_TRACE, "sending cursor"); g_snprintf(file_path, 255, "%s/cursor0.cur", XRDP_SHARE_PATH); g_memset(&pointer_item, 0, sizeof(pointer_item)); xrdp_wm_load_pointer(self, file_path, pointer_item.data, @@ -572,7 +562,7 @@ xrdp_wm_init(struct xrdp_wm *self) char section_name[256]; char autorun_name[256]; - g_writeln("in xrdp_wm_init: "); + LOG(LOG_LEVEL_DEBUG, "in xrdp_wm_init: "); load_xrdp_config(self->xrdp_config, self->session->xrdp_ini, self->screen->bpp); @@ -683,14 +673,14 @@ xrdp_wm_init(struct xrdp_wm *self) * in xrdp.ini, fallback to default_section_name */ if (file_read_section(fd, section_name, names, values) != 0) { - log_message(LOG_LEVEL_INFO, - "Module \"%s\" specified by %s from %s port %s " - "is not configured. Using \"%s\" instead.", - section_name, - self->session->client_info->username, - self->session->client_info->client_addr, - self->session->client_info->client_port, - default_section_name); + LOG(LOG_LEVEL_INFO, + "Module \"%s\" specified by %s from %s port %s " + "is not configured. Using \"%s\" instead.", + section_name, + self->session->client_info->username, + self->session->client_info->client_addr, + self->session->client_info->client_port, + default_section_name); list_clear(names); list_clear(values); @@ -763,8 +753,8 @@ xrdp_wm_init(struct xrdp_wm *self) else { /* Hopefully, we never reach here. */ - log_message(LOG_LEVEL_DEBUG, - "Control should never reach %s:%d", __FILE__, __LINE__); + LOG(LOG_LEVEL_WARNING, + "Control should never reach %s:%d", __FILE__, __LINE__); } list_delete(names); @@ -773,14 +763,14 @@ xrdp_wm_init(struct xrdp_wm *self) } else { - log_message(LOG_LEVEL_ERROR, - "xrdp_wm_init: Could not read xrdp.ini file %s", - self->session->xrdp_ini); + LOG(LOG_LEVEL_WARNING, + "xrdp_wm_init: Could not read xrdp.ini file %s", + self->session->xrdp_ini); } } else { - g_writeln(" xrdp_wm_init: no autologin / auto run detected, draw login window"); + LOG(LOG_LEVEL_DEBUG, " xrdp_wm_init: no autologin / auto run detected, draw login window"); xrdp_login_wnd_create(self); /* clear screen */ xrdp_bitmap_invalidate(self->screen, 0); @@ -788,7 +778,7 @@ xrdp_wm_init(struct xrdp_wm *self) xrdp_wm_set_login_state(self, WMLS_USER_PROMPT); } - g_writeln("out xrdp_wm_init: "); + LOG(LOG_LEVEL_DEBUG, "out xrdp_wm_init: "); return 0; } @@ -1724,7 +1714,7 @@ static int xrdp_wm_process_input_mouse(struct xrdp_wm *self, int device_flags, int x, int y) { - DEBUG(("mouse event flags %4.4x x %d y %d", device_flags, x, y)); + LOG_DEVEL(LOG_LEVEL_TRACE, "mouse event flags %4.4x x %d y %d", device_flags, x, y); if (device_flags & PTRFLAGS_MOVE) { @@ -1919,7 +1909,7 @@ callback(intptr_t id, int msg, intptr_t param1, intptr_t param2, rv = xrdp_mm_check_chan(wm->mm); break; case 0x5557: - //g_writeln("callback: frame ack %d", param1); + LOG(LOG_LEVEL_DEBUG, "callback: frame ack %p", (void *) param1); xrdp_mm_frame_ack(wm->mm, param1); break; case 0x5558: @@ -1945,6 +1935,7 @@ xrdp_wm_login_state_changed(struct xrdp_wm *self) return 0; } + LOG(LOG_LEVEL_DEBUG, "xrdp_wm_login_mode_changed: login_mode is %d", self->login_state); if (self->login_state == WMLS_RESET) { /* this is the initial state of the login window */ @@ -2054,7 +2045,7 @@ add_string_to_logwindow(const char *msg, struct list *log) do { new_part_message = g_strndup(current_pointer, LOG_WINDOW_CHAR_PER_LINE); - g_writeln("%s", new_part_message); + LOG(LOG_LEVEL_INFO, "%s", new_part_message); list_add_item(log, (tintptr) new_part_message); len_done += g_strlen(new_part_message); current_pointer += g_strlen(new_part_message); @@ -2163,7 +2154,7 @@ xrdp_wm_log_msg(struct xrdp_wm *self, enum logLevels loglevel, vsnprintf(msg, sizeof(msg), fmt, ap); va_end(ap); - log_message(loglevel, "xrdp_wm_log_msg: %s", msg); + LOG(loglevel, "xrdp_wm_log_msg: %s", msg); add_string_to_logwindow(msg, self->log); return 0; } @@ -2247,7 +2238,7 @@ wm_login_state_to_str(enum wm_login_state login_state) /*****************************************************************************/ int -xrdp_wm_set_login_state(struct xrdp_wm* self, enum wm_login_state login_state) +xrdp_wm_set_login_state(struct xrdp_wm *self, enum wm_login_state login_state) { LOG(LOG_LEVEL_DEBUG, "Login state change request %s -> %s", wm_login_state_to_str(self->login_state),