Merge pull request #1708 from aquesnel/unify_sesman_logging

Unify logging in sesman
This commit is contained in:
metalefty 2020-11-30 11:47:18 +09:00 committed by GitHub
commit 28c35f962d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 1750 additions and 1392 deletions

View File

@ -277,8 +277,6 @@ internal_config_read_logging(int file,
char *buf;
char *temp_buf;
char section_name[512];
int len;
struct log_logger_level* logger;
struct log_config *lc;
struct list *param_n;
struct list *param_v;
@ -370,6 +368,10 @@ internal_config_read_logging(int file,
/* try to create path if not exist */
g_create_path(lc->log_file);
#ifdef LOG_PER_LOGGER_LEVEL
int len;
struct log_logger_level *logger;
list_clear(param_v);
list_clear(param_n);
g_snprintf(section_name, 511, "%s%s", section_prefix, SESMAN_CFG_LOGGING_LOGGER);
@ -395,6 +397,7 @@ internal_config_read_logging(int file,
logger->logger_type = LOG_TYPE_FILE;
}
}
#endif
list_delete(param_v);
list_delete(param_n);
@ -405,8 +408,10 @@ void
internal_log_config_dump(struct log_config *config)
{
char str_level[20];
#ifdef LOG_PER_LOGGER_LEVEL
struct log_logger_level* logger;
int i;
#endif
g_printf("logging configuration:\r\n");
internal_log_lvl2str(config->log_level, str_level);
@ -421,6 +426,7 @@ internal_log_config_dump(struct log_config *config)
g_printf("\tEnableSyslog: %s\r\n", (config->enable_syslog ? "true" : "false"));
g_printf("\tSyslogLevel: %s\r\n", str_level);
#ifdef LOG_PER_LOGGER_LEVEL
g_printf("per logger configuration:\r\n");
for (i = 0; i < config->per_logger_level->count; i++)
{
@ -432,6 +438,7 @@ internal_log_config_dump(struct log_config *config)
{
g_printf("\tNone\r\n");
}
#endif
}
struct log_config *
@ -493,6 +500,53 @@ internal_log_config_copy(struct log_config *dest, const struct log_config *src)
}
}
bool_t
internal_log_is_enabled_for_level(const enum logLevels log_level,
const bool_t override_destination_level)
{
/* Is log initialized? */
if (g_staticLogConfig == NULL)
{
return 0;
}
/* Is there at least one log destination which will accept the message based on the log level? */
return (g_staticLogConfig->fd >= 0
&& (override_destination_level || log_level <= g_staticLogConfig->log_level))
|| (g_staticLogConfig->enable_syslog
&& (override_destination_level || log_level <= g_staticLogConfig->syslog_level))
|| (g_staticLogConfig->enable_console
&& (override_destination_level || log_level <= g_staticLogConfig->console_level));
}
bool_t
internal_log_location_overrides_level(const char *function_name,
const char *file_name,
const enum logLevels log_level)
{
struct log_logger_level *logger = NULL;
int i;
if (g_staticLogConfig == NULL)
{
return 0;
}
for (i = 0; i < g_staticLogConfig->per_logger_level->count; i++)
{
logger = (struct log_logger_level *)list_get_item(g_staticLogConfig->per_logger_level, i);
if ((logger->logger_type == LOG_TYPE_FILE
&& 0 == g_strncmp(logger->logger_name, file_name, LOGGER_NAME_SIZE))
|| (logger->logger_type == LOG_TYPE_FUNCTION
&& 0 == g_strncmp(logger->logger_name, function_name, LOGGER_NAME_SIZE)))
{
return (log_level <= logger->log_level);
}
}
return 0;
}
/*
* Here below the public functions
*/
@ -637,6 +691,161 @@ log_end(void)
return ret;
}
/*****************************************************************************/
/* produce a hex dump */
enum logReturns
log_hexdump_with_location(const char *function_name,
const char *file_name,
const int line_number,
const enum logLevels log_level,
const char *message,
const char *src,
int len)
{
unsigned char *line;
int i;
int dump_number_lines;
int dump_line_length;
int dump_length;
int dump_offset;
int thisline;
int offset;
char *dump_buffer;
enum logReturns rv;
bool_t override_destination_level = 0;
/* Start the dump on a new line so that the first line of the dump is
aligned to the first column instead of to after the log message
preamble (eg. time, log level, ...)
*/
#define HEX_DUMP_SOURCE_BYTES_PER_LINE (16)
#ifdef _WIN32
#define HEX_DUMP_HEADER ("%s Hex Dump:\r\n")
#define HEX_DUMP_NEWLINE_SIZE (2)
#else
#ifdef _MACOS
#define HEX_DUMP_HEADER ("%s Hex Dump:\r")
#define HEX_DUMP_NEWLINE_SIZE (1)
#else
#define HEX_DUMP_HEADER ("%s Hex Dump:\n")
#define HEX_DUMP_NEWLINE_SIZE (1)
#endif
#endif
#define HEX_DUMP_HEADER_SIZE (sizeof(HEX_DUMP_HEADER) - 1)
override_destination_level = internal_log_location_overrides_level(
function_name,
file_name,
log_level);
if (!internal_log_is_enabled_for_level(log_level, override_destination_level))
{
return LOG_STARTUP_OK;
}
dump_line_length = (4 + 3 /* = 4 offset + 3 space */
+ ((2 + 1) * HEX_DUMP_SOURCE_BYTES_PER_LINE) /* + (2 hex char + 1 space) per source byte */
+ 2 /* + 2 space */
+ HEX_DUMP_SOURCE_BYTES_PER_LINE
+ HEX_DUMP_NEWLINE_SIZE);
dump_number_lines = (len / HEX_DUMP_SOURCE_BYTES_PER_LINE) + 1; /* +1 to round up */
dump_length = (dump_number_lines *dump_line_length /* hex dump lines */
+ HEX_DUMP_HEADER_SIZE
+ 1); /* terminating NULL */
dump_buffer = (char *)g_malloc(dump_length, 1);
if (dump_buffer == NULL)
{
LOG_DEVEL(LOG_LEVEL_WARNING,
"Failed to allocate buffer for hex dump of size %d",
dump_length);
return LOG_ERROR_MALLOC;
}
line = (unsigned char *)src;
offset = 0;
g_memcpy(dump_buffer, HEX_DUMP_HEADER, HEX_DUMP_HEADER_SIZE);
dump_offset = HEX_DUMP_HEADER_SIZE;
while (offset < len)
{
g_sprintf(dump_buffer + dump_offset, "%04x ", offset);
dump_offset += 7;
thisline = len - offset;
if (thisline > HEX_DUMP_SOURCE_BYTES_PER_LINE)
{
thisline = HEX_DUMP_SOURCE_BYTES_PER_LINE;
}
for (i = 0; i < thisline; i++)
{
g_sprintf(dump_buffer + dump_offset, "%02x ", line[i]);
dump_offset += 3;
}
for (; i < HEX_DUMP_SOURCE_BYTES_PER_LINE; i++)
{
dump_buffer[dump_offset++] = ' ';
dump_buffer[dump_offset++] = ' ';
dump_buffer[dump_offset++] = ' ';
}
dump_buffer[dump_offset++] = ' ';
dump_buffer[dump_offset++] = ' ';
for (i = 0; i < thisline; i++)
{
dump_buffer[dump_offset++] = (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.';
}
for (; i < HEX_DUMP_SOURCE_BYTES_PER_LINE; i++)
{
dump_buffer[dump_offset++] = ' ';
}
#ifdef _WIN32
dump_buffer[dump_offset++] = '\r';
dump_buffer[dump_offset++] = '\n';
#else
#ifdef _MACOS
dump_buffer[dump_offset++] = '\r';
#else
dump_buffer[dump_offset++] = '\n';
#endif
#endif
offset += thisline;
line += thisline;
if ((dump_offset - HEX_DUMP_HEADER_SIZE) % dump_line_length != 0)
{
LOG_DEVEL(LOG_LEVEL_ERROR,
"BUG: dump_offset (%d) at the end of a line is not a "
"multiple of the line length (%d)",
dump_offset, dump_line_length);
}
}
if (dump_offset > dump_length)
{
LOG_DEVEL(LOG_LEVEL_ERROR,
"BUG: dump_offset (%d) is larger than the dump_buffer length (%d)",
dump_offset, dump_length);
g_free(dump_buffer);
return LOG_GENERAL_ERROR;
}
/* replace the last new line with the end of the string since log_message
will add a new line */
dump_buffer[dump_offset - HEX_DUMP_NEWLINE_SIZE] = '\0';
rv = log_message_with_location(function_name, file_name, line_number,
log_level, dump_buffer, message);
g_free(dump_buffer);
return rv;
}
enum logReturns
log_message_with_location(const char *function_name,
const char *file_name,
@ -648,9 +857,7 @@ log_message_with_location(const char *function_name,
va_list ap;
enum logReturns rv;
char buff[LOG_BUFFER_SIZE];
struct log_logger_level *logger;
int i;
bool_t force_log = 0;
bool_t override_destination_level = 0;
if (g_staticLogConfig == NULL)
{
@ -659,29 +866,21 @@ log_message_with_location(const char *function_name,
function_name, file_name, line_number);
return LOG_ERROR_NO_CFG;
}
for (i = 0; i < g_staticLogConfig->per_logger_level->count; i++)
{
logger = (struct log_logger_level *)list_get_item(g_staticLogConfig->per_logger_level, i);
if ((logger->logger_type == LOG_TYPE_FILE
&& 0 == g_strncmp(logger->logger_name, file_name, LOGGER_NAME_SIZE))
|| (logger->logger_type == LOG_TYPE_FUNCTION
&& 0 == g_strncmp(logger->logger_name, function_name, LOGGER_NAME_SIZE)))
{
if(logger->log_level < level)
override_destination_level = internal_log_location_overrides_level(
function_name,
file_name,
level);
if (!internal_log_is_enabled_for_level(level, override_destination_level))
{
return LOG_STARTUP_OK;
}
force_log = 1;
break;
}
}
g_snprintf(buff, LOG_BUFFER_SIZE, "[%s(%s:%d)] %s",
function_name, file_name, line_number, msg);
va_start(ap, msg);
rv = internal_log_message(level, force_log, buff, ap);
rv = internal_log_message(level, override_destination_level, buff, ap);
va_end(ap);
return rv;
}
@ -699,7 +898,10 @@ log_message(const enum logLevels lvl, const char *msg, ...)
}
enum logReturns
internal_log_message(const enum logLevels lvl, bool_t force_log, const char *msg, va_list ap)
internal_log_message(const enum logLevels lvl,
bool_t override_destination_level,
const char *msg,
va_list ap)
{
char buff[LOG_BUFFER_SIZE + 31]; /* 19 (datetime) 4 (space+cr+lf+\0) */
int len = 0;
@ -721,9 +923,7 @@ internal_log_message(const enum logLevels lvl, bool_t force_log, const char *msg
return LOG_ERROR_FILE_NOT_OPEN;
}
if (!((g_staticLogConfig->fd >= 0 && (force_log || lvl <= g_staticLogConfig->log_level))
|| (g_staticLogConfig->enable_syslog && (force_log || lvl <= g_staticLogConfig->syslog_level))
|| (g_staticLogConfig->enable_console && (force_log || lvl <= g_staticLogConfig->console_level))))
if (!internal_log_is_enabled_for_level(lvl, override_destination_level))
{
return LOG_STARTUP_OK;
}
@ -765,20 +965,20 @@ internal_log_message(const enum logLevels lvl, bool_t force_log, const char *msg
#endif
#endif
if (g_staticLogConfig->enable_syslog && (force_log || lvl <= g_staticLogConfig->syslog_level))
if (g_staticLogConfig->enable_syslog && (override_destination_level || lvl <= g_staticLogConfig->syslog_level))
{
/* log to syslog*/
/* %s fix compiler warning 'not a string literal' */
syslog(internal_log_xrdp2syslog(lvl), "%s", buff + 20);
}
if (g_staticLogConfig->enable_console && (force_log || lvl <= g_staticLogConfig->console_level))
if (g_staticLogConfig->enable_console && (override_destination_level || lvl <= g_staticLogConfig->console_level))
{
/* log to console */
g_printf("%s", buff);
}
if (force_log || lvl <= g_staticLogConfig->log_level)
if (override_destination_level || lvl <= g_staticLogConfig->log_level)
{
/* log to application logfile */
#ifdef LOG_ENABLE_THREAD

View File

@ -25,7 +25,7 @@
#include "list.h"
/* logging buffer size */
#define LOG_BUFFER_SIZE 1024
#define LOG_BUFFER_SIZE 8192
#define LOGGER_NAME_SIZE 50
/* logging levels */
@ -66,6 +66,8 @@ enum logReturns
#ifdef XRDP_DEBUG
#define LOG_PER_LOGGER_LEVEL
/**
* @brief Logging macro for messages that are for an XRDP developper to
* understand and debug XRDP code.
@ -107,9 +109,26 @@ enum logReturns
*/
#define LOG(log_level, args...) \
log_message_with_location(__func__, __FILE__, __LINE__, log_level, args);
/**
* @brief Logging macro for logging the contents of a byte array using a hex
* dump format.
*
* Note: the logging function calls are removed when XRDP_DEBUG is NOT defined.
*
* @param log_level, the log level
* @param message, a message prefix for the hex dump. Note: no printf like
* formatting is done to this message.
* @param buffer, a pointer to the byte array to log as a hex dump
* @param length, the length of the byte array to log
*/
#define LOG_DEVEL_HEXDUMP(log_level, message, buffer, length) \
log_hexdump_with_location(__func__, __FILE__, __LINE__, log_level, message, buffer, length);
#else
#define LOG_DEVEL(log_level, args...)
#define LOG(log_level, args...) log_message(log_level, args);
#define LOG_DEVEL_HEXDUMP(log_level, message, buffer, length)
#endif
enum log_logger_type
@ -205,6 +224,26 @@ internal_log_config_dump(struct log_config *config);
enum logReturns
internal_log_message(const enum logLevels lvl, bool_t force_log, const char *msg, va_list args);
/**
* @param log_level, the log level
* @param override_destination_level, if true then the destinatino log level is ignored.
* @return true if at least one log destination will accept a message logged at the given level.
*/
bool_t
internal_log_is_enabled_for_level(const enum logLevels log_level,
const bool_t override_destination_level);
/**
* @param function_name, the function name (typicaly the __func__ macro)
* @param file_name, the file name (typicaly the __FILE__ macro)
* @param log_level, the log level
* @return true if the logger location overrides the destination log levels
*/
bool_t
internal_log_location_overrides_level(const char *function_name,
const char *file_name,
const enum logLevels log_level);
/*End of internal functions*/
#endif
@ -290,6 +329,15 @@ log_message_with_location(const char *function_name,
const char *msg,
...) printflike(5, 6);
enum logReturns
log_hexdump_with_location(const char *function_name,
const char *file_name,
const int line_number,
const enum logLevels log_level,
const char *msg,
const char *p,
int len);
/**
* This function returns the configured file name for the logfile
* @param replybuf the buffer where the reply is stored

View File

@ -41,32 +41,32 @@ access_login_allowed(const char *user)
if ((0 == g_strncmp(user, "root", 5)) && (0 == g_cfg->sec.allow_root))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"ROOT login attempted, but root login is disabled");
return 0;
}
if ((0 == g_cfg->sec.ts_users_enable) && (0 == g_cfg->sec.ts_always_group_check))
{
log_message(LOG_LEVEL_INFO, "Terminal Server Users group is disabled, allowing authentication");
LOG(LOG_LEVEL_INFO, "Terminal Server Users group is disabled, allowing authentication");
return 1;
}
if (0 != g_getuser_info(user, &gid, 0, 0, 0, 0))
{
log_message(LOG_LEVEL_ERROR, "Cannot read user info! - login denied");
LOG(LOG_LEVEL_ERROR, "Cannot read user info! - login denied");
return 0;
}
if (g_cfg->sec.ts_users == gid)
{
log_message(LOG_LEVEL_DEBUG,"ts_users is user's primary group");
LOG(LOG_LEVEL_DEBUG, "ts_users is user's primary group");
return 1;
}
if (0 != g_check_user_in_group(user, g_cfg->sec.ts_users, &ok))
{
log_message(LOG_LEVEL_ERROR, "Cannot read group info! - login denied");
LOG(LOG_LEVEL_ERROR, "Cannot read group info! - login denied");
return 0;
}
@ -75,7 +75,7 @@ access_login_allowed(const char *user)
return 1;
}
log_message(LOG_LEVEL_INFO, "login denied for user %s", user);
LOG(LOG_LEVEL_INFO, "login denied for user %s", user);
return 0;
}
@ -89,21 +89,21 @@ access_login_mng_allowed(const char *user)
if ((0 == g_strncmp(user, "root", 5)) && (0 == g_cfg->sec.allow_root))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[MNG] ROOT login attempted, but root login is disabled");
return 0;
}
if (0 == g_cfg->sec.ts_admins_enable)
{
log_message(LOG_LEVEL_INFO, "[MNG] Terminal Server Admin group is disabled, "
LOG(LOG_LEVEL_INFO, "[MNG] Terminal Server Admin group is disabled, "
"allowing authentication");
return 1;
}
if (0 != g_getuser_info(user, &gid, 0, 0, 0, 0))
{
log_message(LOG_LEVEL_ERROR, "[MNG] Cannot read user info! - login denied");
LOG(LOG_LEVEL_ERROR, "[MNG] Cannot read user info! - login denied");
return 0;
}
@ -115,7 +115,7 @@ access_login_mng_allowed(const char *user)
if (0 != g_check_user_in_group(user, g_cfg->sec.ts_admins, &ok))
{
log_message(LOG_LEVEL_ERROR, "[MNG] Cannot read group info! - login denied");
LOG(LOG_LEVEL_ERROR, "[MNG] Cannot read group info! - login denied");
return 0;
}
@ -124,7 +124,7 @@ access_login_mng_allowed(const char *user)
return 1;
}
log_message(LOG_LEVEL_INFO, "[MNG] login denied for user %s", user);
LOG(LOG_LEVEL_INFO, "[MNG] login denied for user %s", user);
return 0;
}

View File

@ -444,8 +444,7 @@ audin_data(int chan_id, char *data, int bytes)
{
struct stream ls;
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_data:");
//g_hexdump(data, bytes);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "audin_data:", data, bytes);
if (g_in_s == NULL)
{
g_memset(&ls, 0, sizeof(ls));

View File

@ -41,18 +41,44 @@ char g_fuse_clipboard_path[256] = ""; /* for clipboard use */
#include "chansrv_xfs.h"
/* dummy calls when XRDP_FUSE is not defined */
int xfuse_init(void) { return 0; }
int xfuse_deinit(void) { return 0; }
int xfuse_check_wait_objs(void) { return 0; }
int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout) { return 0; }
int xfuse_create_share(tui32 device_id, const char *dirname) { return 0; }
int xfuse_init(void)
{
return 0;
}
int xfuse_deinit(void)
{
return 0;
}
int xfuse_check_wait_objs(void)
{
return 0;
}
int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout)
{
return 0;
}
int xfuse_create_share(tui32 device_id, const char *dirname)
{
return 0;
}
void xfuse_delete_share(tui32 share_id) {}
int xfuse_clear_clip_dir(void) { return 0; }
int xfuse_file_contents_range(int stream_id, const char *data, int data_bytes) { return 0; }
int xfuse_clear_clip_dir(void)
{
return 0;
}
int xfuse_file_contents_range(int stream_id, const char *data, int data_bytes)
{
return 0;
}
int xfuse_file_contents_size(int stream_id, int file_size)
{ return 0; }
{
return 0;
}
int xfuse_add_clip_dir_item(const char *filename,
int flags, int size, int lindex) { return 0; }
int flags, int size, int lindex)
{
return 0;
}
void xfuse_devredir_cb_enum_dir_add_entry(
struct state_dirscan *fip,
@ -460,7 +486,9 @@ xfuse_init(void)
/* setup xrdp file system */
if (xfuse_init_xrdp_fs())
{
return -1;
}
/* setup FUSE callbacks */
g_memset(&g_xfuse_ops, 0, sizeof(g_xfuse_ops));
@ -547,7 +575,9 @@ int xfuse_check_wait_objs(void)
int rval;
if (g_ch == 0)
{
return 0;
}
if (g_tcp_select(g_fd, 0) & 1)
{
@ -555,13 +585,19 @@ int xfuse_check_wait_objs(void)
rval = fuse_chan_recv(&tmpch, g_buffer, g_bufsize);
if (rval == -EINTR)
{
return -1;
}
if (rval == -ENODEV)
{
return -1;
}
if (rval <= 0)
{
return -1;
}
fuse_session_process(g_se, g_buffer, rval, tmpch);
}
@ -580,7 +616,9 @@ int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout)
int lcount;
if (g_ch == 0)
{
return 0;
}
lcount = *count;
objs[lcount] = g_fd;

View File

@ -734,7 +734,7 @@ clipboard_send_format_announce(int xrdp_clip_type)
out_uint32_le(s, 0);
s_mark_end(s);
size = (int)(s->end - s->data);
//g_hexdump(s->data, size);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "clipboard data:", s->data, size);
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_send_format_announce: data out, sending "
"CLIPRDR_FORMAT_ANNOUNCE (clip_msg_id = 2)");
rv = send_channel_data(g_cliprdr_chan_id, s->data, size);
@ -777,7 +777,7 @@ clipboard_send_data_response_for_text(const char *data, int data_size)
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_send_data_response_for_text: data_size %d",
data_size);
//g_hexdump(data, data_size);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "clipboard send data response:", data, data_size);
num_chars = g_mbstowcs(0, data, 0);
if (num_chars < 0)
{
@ -1310,7 +1310,7 @@ clipboard_process_clip_caps(struct stream *s, int clip_msg_status,
char *holdp;
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_process_clip_caps:");
//g_hexdump(s->p, s->end - s->p);
//LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", s->p, s->end - s->p);
in_uint16_le(s, cCapabilitiesSets);
in_uint8s(s, 2); /* pad */
for (index = 0; index < cCapabilitiesSets; index++)
@ -1850,7 +1850,7 @@ clipboard_event_selection_notify(XEvent *xevent)
"clipboard_get_window_property failed error %d", rv);
return 0;
}
//g_hexdump(data, data_size);
//LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", data, data_size);
XDeleteProperty(g_display, lxevent->requestor, lxevent->property);
if (type == g_incr_atom)
{
@ -1866,7 +1866,7 @@ clipboard_event_selection_notify(XEvent *xevent)
g_clip_s2c.total_bytes = 0;
g_free(g_clip_s2c.data);
g_clip_s2c.data = 0;
//g_hexdump(data, sizeof(long));
//LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", data, sizeof(long));
g_free(data);
return 0;
}
@ -2352,7 +2352,7 @@ clipboard_event_property_notify(XEvent *xevent)
if (g_clip_s2c.type == g_image_bmp_atom)
{
g_clip_s2c.xrdp_clip_type = XRDP_CB_BITMAP;
//g_hexdump(g_last_clip_data, 64);
//LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", g_last_clip_data, 64);
/* skip header */
clipboard_send_data_response(g_clip_s2c.xrdp_clip_type,
g_clip_s2c.data + 14,

View File

@ -254,7 +254,7 @@ clipboard_send_data_response_for_file(const char *data, int data_size)
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_send_data_response_for_file: data_size %d",
data_size);
//g_hexdump(data, data_size);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", data, data_size);
if (g_files_list == 0)
{
g_files_list = list_create();
@ -500,7 +500,7 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status,
//int clipDataId;
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_process_file_request:");
//g_hexdump(s->p, clip_msg_len);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", s->p, clip_msg_len);
in_uint32_le(s, streamId);
in_uint32_le(s, lindex);
in_uint32_le(s, dwFlags);

View File

@ -227,10 +227,16 @@ WindowsToLinuxFilePerm(tui32 wperm)
else
{
result = S_IFREG | 0444; /* files are always readable */
if (wperm & W_FILE_ATTRIBUTE_SYSTEM) result |= 0111; /* Executable */
if (wperm & W_FILE_ATTRIBUTE_SYSTEM)
{
result |= 0111; /* Executable */
}
}
if ((wperm & W_FILE_ATTRIBUTE_READONLY) == 0) result |= 0222;
if ((wperm & W_FILE_ATTRIBUTE_READONLY) == 0)
{
result |= 0222;
}
return result;
}
@ -298,13 +304,17 @@ devredir_data_in(struct stream *s, int chan_id, int chan_flags, int length,
{
/* is this is the first packet? */
if (chan_flags & 1)
{
xstream_new(g_input_stream, total_length);
}
xstream_copyin(g_input_stream, s->p, length);
/* in last packet, chan_flags & 0x02 will be true */
if ((chan_flags & 2) == 0)
{
return 0;
}
g_input_stream->p = g_input_stream->data;
ls = g_input_stream;
@ -632,7 +642,9 @@ devredir_send_drive_close_request(tui16 Component, tui16 PacketId,
MajorFunction, MinorFunc);
if (pad_len)
{
xstream_seek(s, pad_len);
}
/* send to client */
bytes = xstream_len(s);
@ -905,8 +917,7 @@ devredir_proc_device_iocompletion(struct stream *s)
{
LOG_DEVEL(LOG_LEVEL_ERROR, "IRP with completion ID %d not found", CompletionId);
}
else
if (irp->callback)
else if (irp->callback)
{
/* Callback has been set - call it */
(*irp->callback)(s, irp, DeviceId, CompletionId, IoStatus);
@ -1424,7 +1435,9 @@ int devredir_file_close(struct state_close *fusep, tui32 device_id,
#if 0
if ((irp = devredir_irp_new()) == NULL)
{
return -1;
}
irp->CompletionId = g_completion_id++;
#else
@ -1705,7 +1718,9 @@ devredir_cvt_slash(char *path)
while (*cptr != 0)
{
if (*cptr == '/')
{
*cptr = '\\';
}
cptr++;
}
}

View File

@ -51,7 +51,9 @@ fifo_init(FIFO* fp, int num_entries)
}
if (num_entries < 1)
{
num_entries = 10;
}
fp->rd_ptr = 0;
fp->wr_ptr = 0;
@ -149,7 +151,9 @@ fifo_insert(FIFO* fp, void* data)
next_val = fp->wr_ptr + 1;
if (next_val >= fp->entries)
{
next_val = 0;
}
if (next_val == fp->rd_ptr)
{
@ -168,8 +172,10 @@ fifo_insert(FIFO* fp, void* data)
{
lp[i] = fp->user_data[fp->rd_ptr++];
if (fp->rd_ptr >= fp->entries)
{
fp->rd_ptr = 0;
}
}
/* update pointers */
fp->rd_ptr = 0;

View File

@ -144,7 +144,9 @@ int devredir_irp_delete(IRP *irp)
IRP *lirp = g_irp_head;
if ((irp == NULL) || (lirp == NULL))
{
return -1;
}
LOG_DEVEL(LOG_LEVEL_DEBUG, "irp=%p completion_id=%d type=%d",
irp, irp->CompletionId, irp->completion_type);
@ -154,13 +156,17 @@ int devredir_irp_delete(IRP *irp)
while (lirp)
{
if (lirp == irp)
{
break;
}
lirp = lirp->next;
}
if (lirp == NULL)
{
return -1; /* did not find specified irp */
}
if (lirp->prev == NULL)
{
@ -250,7 +256,9 @@ IRP * devredir_irp_get_last(void)
while (irp)
{
if (irp->next == NULL)
{
break;
}
irp = irp->next;
}

View File

@ -369,7 +369,7 @@ rail_startup(void)
if (rail_is_another_wm_running())
{
log_message(LOG_LEVEL_ERROR, "rail_init: another window manager "
LOG(LOG_LEVEL_ERROR, "rail_init: another window manager "
"is running");
}
@ -382,7 +382,7 @@ rail_startup(void)
if (!XRRQueryExtension(g_display, &g_xrr_event_base, &dummy))
{
g_xrr_event_base = 0;
log_message(LOG_LEVEL_ERROR, "rail_init: RandR extension not found");
LOG(LOG_LEVEL_ERROR, "rail_init: RandR extension not found");
}
if (g_xrr_event_base > 0)
@ -615,7 +615,9 @@ rail_process_activate(struct stream *s, int size)
XRaiseWindow(g_display, window_id);
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_activate: calling XSetInputFocus 0x%8.8x", window_id);
XSetInputFocus(g_display, window_id, RevertToParent, CurrentTime);
} else {
}
else
{
LOG_DEVEL(LOG_LEVEL_DEBUG, " window attributes: override_redirect %d",
window_attributes.override_redirect);
add_timeout(200, my_timeout, (void *)(long)g_focus_counter);
@ -823,7 +825,9 @@ rail_minmax_window(int window_id, int max)
if (max)
{
} else {
}
else
{
XUnmapWindow(g_display, window_id);
/* change window state to IconicState (3) */
rail_win_set_state(window_id, 0x3);
@ -1920,7 +1924,9 @@ rail_xevent(void *xevent)
// remove popups
rail_destroy_window(lxevent->xunmap.window);
list_remove_item(g_window_list, index);
} else {
}
else
{
rail_show_window(lxevent->xunmap.window, 0x0);
}

View File

@ -1180,10 +1180,7 @@ scard_send_ListReaders(IRP *irp, char *context, int context_bytes,
/* send to client */
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
#if 0
g_writeln("scard_send_ListReaders:");
g_hexdump(s->data, bytes);
#endif
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "scard_send_ListReaders:", s->data, bytes);
free_stream(s);
}
@ -1328,10 +1325,7 @@ scard_send_GetStatusChange(IRP* irp, char *context, int context_bytes,
/* send to client */
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
#if 0
g_writeln("scard_send_GetStatusChange:");
g_hexdump(s->data, bytes);
#endif
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "scard_send_GetStatusChange:", s->data, bytes);
free_stream(s);
}
@ -1719,7 +1713,7 @@ scard_send_Status(IRP *irp, int wide, char *context, int context_bytes,
bytes = (int) (s->end - s->data);
//g_hexdump(s->data, bytes);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", s->data, bytes);
/* send to client */
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
@ -1978,10 +1972,7 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes,
/* send to client */
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
#if 0
g_writeln("scard_send_Transmit:");
g_hexdump(s->data, bytes);
#endif
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "scard_send_Transmit:", s->data, bytes);
free_stream(s);
return 0;
@ -2054,7 +2045,7 @@ scard_send_Control(IRP *irp, char *context, int context_bytes,
bytes = (int) (s->end - s->data);
//g_hexdump(s->data, bytes);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", s->data, bytes);
/* send to client */
send_channel_data(g_rdpdr_chan_id, s->data, bytes);

File diff suppressed because it is too large Load Diff

View File

@ -378,7 +378,7 @@ sound_process_output_format(int aindex, int wFormatTag, int nChannels,
LOG_DEVEL(LOG_LEVEL_INFO, " wBitsPerSample %d", wBitsPerSample);
LOG_DEVEL(LOG_LEVEL_INFO, " cbSize %d", cbSize);
g_hexdump(data, cbSize);
LOG_DEVEL_HEXDUMP(LOG_LEVEL_TRACE, "", data, cbSize);
/* select CD quality audio */
if (wFormatTag == g_pcm_44100.wFormatTag &&
@ -451,7 +451,9 @@ sound_process_output_formats(struct stream *s, int size)
char *data;
if (size < 16)
{
return 1;
}
in_uint8s(s, 14);
in_uint16_le(s, num_formats);
@ -1115,10 +1117,14 @@ sound_sndsrvr_sink_data_in(struct trans *trans)
int error;
if (trans == 0)
{
return 0;
}
if (trans != g_audio_c_trans_out)
{
return 1;
}
s = trans_get_in_s(trans);
in_uint32_le(s, id);
@ -1153,16 +1159,24 @@ sound_sndsrvr_sink_conn_in(struct trans *trans, struct trans *new_trans)
LOG_DEVEL(LOG_LEVEL_INFO, "sound_sndsrvr_sink_conn_in:");
if (trans == 0)
{
return 1;
}
if (trans != g_audio_l_trans_out)
{
return 1;
}
if (g_audio_c_trans_out != 0) /* if already set, error */
{
return 1;
}
if (new_trans == 0)
{
return 1;
}
g_audio_c_trans_out = new_trans;
g_audio_c_trans_out->trans_data_in = sound_sndsrvr_sink_data_in;
@ -1183,16 +1197,24 @@ sound_sndsrvr_source_conn_in(struct trans *trans, struct trans *new_trans)
LOG_DEVEL(LOG_LEVEL_INFO, "sound_sndsrvr_source_conn_in: client connected");
if (trans == 0)
{
return 1;
}
if (trans != g_audio_l_trans_in)
{
return 1;
}
if (g_audio_c_trans_in != 0) /* if already set, error */
{
return 1;
}
if (new_trans == 0)
{
return 1;
}
g_audio_c_trans_in = new_trans;
g_audio_c_trans_in->trans_data_in = sound_sndsrvr_source_data_in;
@ -1712,14 +1734,20 @@ sound_sndsrvr_source_data_in(struct trans *trans)
int i;
if (trans == 0)
{
return 0;
}
if (trans != g_audio_c_trans_in)
{
return 1;
}
ts = trans_get_in_s(trans);
if (trans_force_read(trans, 3))
log_message(LOG_LEVEL_ERROR, "sound.c: error reading from transport");
{
LOG(LOG_LEVEL_ERROR, "sound.c: error reading from transport");
}
ts->p = ts->data + 8;
in_uint8(ts, cmd);
@ -1753,7 +1781,9 @@ sound_sndsrvr_source_data_in(struct trans *trans)
else
{
if (g_bytes_in_stream == 0)
{
g_bytes_in_stream = g_stream_inp->size;
}
i = bytes_req - bytes_read;
@ -1825,7 +1855,9 @@ sound_start_source_listener(void)
g_snprintf(port, 255, CHANSRV_PORT_IN_STR, g_display_num);
g_audio_l_trans_in->trans_conn_in = sound_sndsrvr_source_conn_in;
if (trans_listen(g_audio_l_trans_in, port) != 0)
{
LOG_DEVEL(LOG_LEVEL_ERROR, "trans_listen failed");
}
return 0;
}
@ -1842,7 +1874,9 @@ sound_start_sink_listener(void)
g_snprintf(port, 255, CHANSRV_PORT_OUT_STR, g_display_num);
g_audio_l_trans_out->trans_conn_in = sound_sndsrvr_sink_conn_in;
if (trans_listen(g_audio_l_trans_out, port) != 0)
{
LOG_DEVEL(LOG_LEVEL_ERROR, "trans_listen failed");
}
return 0;
}

View File

@ -76,7 +76,7 @@ env_check_password_file(const char *filename, const char *passwd)
fd = g_file_open_ex(filename, 0, 1, 1, 1);
if (fd == -1)
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"Cannot write VNC password hash to file %s: %s",
filename, g_get_strerror());
return 1;
@ -172,7 +172,7 @@ env_set_user(const char *username, char **passwd_file, int display,
{
if (g_mkdir(".vnc") < 0)
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"Error creating .vnc directory: %s",
g_get_strerror());
}
@ -189,7 +189,7 @@ env_set_user(const char *username, char **passwd_file, int display,
pw_dir, username, display);
if (g_file_exist(*passwd_file))
{
log_message(LOG_LEVEL_WARNING, "Removing old "
LOG(LOG_LEVEL_WARNING, "Removing old "
"password file %s", *passwd_file);
g_file_delete(*passwd_file);
}
@ -197,7 +197,7 @@ env_set_user(const char *username, char **passwd_file, int display,
pw_dir, username);
if (g_file_exist(*passwd_file))
{
log_message(LOG_LEVEL_WARNING, "Removing insecure "
LOG(LOG_LEVEL_WARNING, "Removing insecure "
"password file %s", *passwd_file);
g_file_delete(*passwd_file);
}
@ -229,7 +229,7 @@ env_set_user(const char *username, char **passwd_file, int display,
}
else
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"error getting user info for user %s",
username);
}

View File

@ -41,7 +41,7 @@ scp_connection_create(int sck)
if (0 == conn)
{
log_message(LOG_LEVEL_ERROR, "[connection:%d] connection create: malloc error", __LINE__);
LOG(LOG_LEVEL_ERROR, "[connection:%d] connection create: malloc error", __LINE__);
return 0;
}

View File

@ -47,7 +47,7 @@ scp_init(void)
scp_lock_init();
log_message(LOG_LEVEL_DEBUG, "libscp initialized");
LOG(LOG_LEVEL_DEBUG, "libscp initialized");
return 0;
}

View File

@ -46,7 +46,7 @@ scp_session_create(void)
if (0 == s)
{
log_message(LOG_LEVEL_ERROR, "[session:%d] session create: malloc error", __LINE__);
LOG(LOG_LEVEL_ERROR, "[session:%d] session create: malloc error", __LINE__);
return 0;
}
@ -81,14 +81,14 @@ scp_session_set_type(struct SCP_SESSION *s, tui8 type)
if (NULL == s->mng)
{
log_message(LOG_LEVEL_ERROR, "[session:%d] set_type: internal error", __LINE__);
LOG(LOG_LEVEL_ERROR, "[session:%d] set_type: internal error", __LINE__);
return 1;
}
break;
default:
log_message(LOG_LEVEL_WARNING, "[session:%d] set_type: unknown type", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_type: unknown type", __LINE__);
return 1;
}
@ -108,7 +108,7 @@ scp_session_set_version(struct SCP_SESSION *s, tui32 version)
s->version = 1;
break;
default:
log_message(LOG_LEVEL_WARNING, "[session:%d] set_version: unknown version", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_version: unknown version", __LINE__);
return 1;
}
@ -172,7 +172,7 @@ scp_session_set_locale(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_locale: null locale", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_locale: null locale", __LINE__);
s->locale[0] = '\0';
return 1;
}
@ -188,7 +188,7 @@ scp_session_set_username(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_username: null username", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_username: null username", __LINE__);
return 1;
}
@ -201,7 +201,7 @@ scp_session_set_username(struct SCP_SESSION *s, const char *str)
if (0 == s->username)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_username: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_username: strdup error", __LINE__);
return 1;
}
@ -214,7 +214,7 @@ scp_session_set_password(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_password: null password", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_password: null password", __LINE__);
return 1;
}
@ -227,7 +227,7 @@ scp_session_set_password(struct SCP_SESSION *s, const char *str)
if (0 == s->password)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_password: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_password: strdup error", __LINE__);
return 1;
}
@ -240,7 +240,7 @@ scp_session_set_domain(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_domain: null domain", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_domain: null domain", __LINE__);
return 1;
}
@ -253,7 +253,7 @@ scp_session_set_domain(struct SCP_SESSION *s, const char *str)
if (0 == s->domain)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_domain: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_domain: strdup error", __LINE__);
return 1;
}
@ -266,7 +266,7 @@ scp_session_set_program(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_program: null program", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_program: null program", __LINE__);
return 1;
}
@ -279,7 +279,7 @@ scp_session_set_program(struct SCP_SESSION *s, const char *str)
if (0 == s->program)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_program: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_program: strdup error", __LINE__);
return 1;
}
@ -292,7 +292,7 @@ scp_session_set_directory(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_directory: null directory", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_directory: null directory", __LINE__);
return 1;
}
@ -305,7 +305,7 @@ scp_session_set_directory(struct SCP_SESSION *s, const char *str)
if (0 == s->directory)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_directory: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_directory: strdup error", __LINE__);
return 1;
}
@ -318,7 +318,7 @@ scp_session_set_client_ip(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_client_ip: null ip", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_client_ip: null ip", __LINE__);
return 1;
}
@ -331,7 +331,7 @@ scp_session_set_client_ip(struct SCP_SESSION *s, const char *str)
if (0 == s->client_ip)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_client_ip: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_client_ip: strdup error", __LINE__);
return 1;
}
@ -344,7 +344,7 @@ scp_session_set_hostname(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_hostname: null hostname", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_hostname: null hostname", __LINE__);
return 1;
}
@ -357,7 +357,7 @@ scp_session_set_hostname(struct SCP_SESSION *s, const char *str)
if (0 == s->hostname)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_hostname: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_hostname: strdup error", __LINE__);
return 1;
}
@ -370,7 +370,7 @@ scp_session_set_errstr(struct SCP_SESSION *s, const char *str)
{
if (0 == str)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_errstr: null string", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_errstr: null string", __LINE__);
return 1;
}
@ -383,7 +383,7 @@ scp_session_set_errstr(struct SCP_SESSION *s, const char *str)
if (0 == s->errstr)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_errstr: strdup error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_errstr: strdup error", __LINE__);
return 1;
}
@ -425,7 +425,7 @@ scp_session_set_guid(struct SCP_SESSION *s, const tui8 *guid)
{
if (0 == guid)
{
log_message(LOG_LEVEL_WARNING, "[session:%d] set_guid: null guid", __LINE__);
LOG(LOG_LEVEL_WARNING, "[session:%d] set_guid: null guid", __LINE__);
return 1;
}

View File

@ -47,8 +47,8 @@ scp_v1c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
init_stream(c->out_s, c->out_s->size);
init_stream(c->in_s, c->in_s->size);
size = 19 + 17 + 4 + g_strlen(s->hostname) + g_strlen(s->username) +
g_strlen(s->password);
size = (19 + 17 + 4 + g_strlen(s->hostname) + g_strlen(s->username) +
g_strlen(s->password));
if (s->addr_type == SCP_ADDRESS_TYPE_IPV4)
{

View File

@ -49,8 +49,8 @@ scp_v1c_mng_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
init_stream(c->out_s, c->out_s->size);
init_stream(c->in_s, c->in_s->size);
size = 12 + 4 + g_strlen(s->hostname) + g_strlen(s->username) +
g_strlen(s->password);
size = (12 + 4 + g_strlen(s->hostname) + g_strlen(s->username) +
g_strlen(s->password));
if (s->addr_type == SCP_ADDRESS_TYPE_IPV4)
{
@ -96,7 +96,7 @@ scp_v1c_mng_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, size))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@ -132,7 +132,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, size))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@ -143,7 +143,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@ -152,7 +152,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: version error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_VERSION_ERR;
}
@ -161,7 +161,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (size < 12)
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: size error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: size error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_SIZE_ERR;
}
@ -170,7 +170,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@ -179,7 +179,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != SCP_COMMAND_SET_MANAGE)
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR;
}
@ -188,7 +188,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (cmd != SCP_CMD_MNG_LIST) /* session list */
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
g_free(ds);
return SCP_CLIENT_STATE_SEQUENCE_ERR;
}
@ -213,7 +213,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
if (ds == 0)
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: internal error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: internal error", __LINE__);
return SCP_CLIENT_STATE_INTERNAL_ERR;
}
}
@ -373,7 +373,7 @@ _scp_v1c_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@ -381,7 +381,7 @@ _scp_v1c_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: version error", __LINE__);
return SCP_CLIENT_STATE_VERSION_ERR;
}
@ -392,7 +392,7 @@ _scp_v1c_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
/* read the rest of the packet */
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: network error", __LINE__);
return SCP_CLIENT_STATE_NETWORK_ERR;
}
@ -400,7 +400,7 @@ _scp_v1c_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (cmd != SCP_COMMAND_SET_MANAGE)
{
log_message(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c_mng:%d] connection aborted: sequence error", __LINE__);
return SCP_CLIENT_STATE_SEQUENCE_ERR;
}
@ -408,7 +408,7 @@ _scp_v1c_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (cmd == SCP_CMD_MNG_LOGIN_ALLOW) /* connection ok */
{
log_message(LOG_LEVEL_INFO, "[v1c_mng:%d] connection ok", __LINE__);
LOG(LOG_LEVEL_INFO, "[v1c_mng:%d] connection ok", __LINE__);
return SCP_CLIENT_STATE_OK;
}
else if (cmd == SCP_CMD_MNG_LOGIN_DENY) /* connection denied */
@ -418,10 +418,10 @@ _scp_v1c_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
in_uint8a(c->in_s, buf, dim);
scp_session_set_errstr(s, buf);
log_message(LOG_LEVEL_INFO, "[v1c_mng:%d] connection denied: %s", __LINE__ , s->errstr);
LOG(LOG_LEVEL_INFO, "[v1c_mng:%d] connection denied: %s", __LINE__, s->errstr);
return SCP_CLIENT_STATE_CONNECTION_DENIED;
}
log_message(LOG_LEVEL_WARNING, "[v1c-mng:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1c-mng:%d] connection aborted: sequence error", __LINE__);
return SCP_CLIENT_STATE_SEQUENCE_ERR;
}

View File

@ -57,7 +57,7 @@ int in_string8(struct stream *s, char str[], const char *param, int line)
if (!s_check_rem(s, 1))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: %s len missing",
line, param);
result = 0;
@ -70,7 +70,7 @@ int in_string8(struct stream *s, char str[], const char *param, int line)
result = s_check_rem(s, sz);
if (!result)
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: %s data missing",
line, param);
}
@ -109,7 +109,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
* bpp, the resource sharing indicator and the locale */
if (!s_check_rem(c->in_s, 1 + 2 + 2 + 1 + 1 + 17))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: short packet",
__LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
@ -119,7 +119,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
if ((type != SCP_SESSION_TYPE_XVNC) && (type != SCP_SESSION_TYPE_XRDP))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: unknown session type", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: unknown session type", __LINE__);
return SCP_SERVER_STATE_SESSION_TYPE_ERR;
}
@ -132,7 +132,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
in_uint8(c->in_s, bpp);
if (0 != scp_session_set_bpp(session, bpp))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: unsupported bpp: %d",
__LINE__, bpp);
return SCP_SERVER_STATE_INTERNAL_ERR;
@ -146,7 +146,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
/* Check there's enough data left for at least an IPv4 address (+len) */
if (!s_check_rem(c->in_s, 1 + 4))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: IP addr len missing",
__LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
@ -164,7 +164,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
{
if (!s_check_rem(c->in_s, 16))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: IP addr missing",
__LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
@ -181,7 +181,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
if (0 != scp_session_set_hostname(session, buf))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
return SCP_SERVER_STATE_INTERNAL_ERR;
}
@ -193,7 +193,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
if (0 != scp_session_set_username(session, buf))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
return SCP_SERVER_STATE_INTERNAL_ERR;
}
@ -205,7 +205,7 @@ scp_v1s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
if (0 != scp_session_set_password(session, buf))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
return SCP_SERVER_STATE_INTERNAL_ERR;
}
@ -233,13 +233,13 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
return SCP_SERVER_STATE_VERSION_ERR;
}
}
else
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
}
@ -250,7 +250,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
* the command (but not too big) */
if (size < (8 + 2 + 2) || size > SCP_MAX_MESSAGE_SIZE)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: size error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: size error", __LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
}
@ -258,7 +258,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, (size - 8)))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -270,7 +270,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
/* if we are starting a management session */
if (cmdset == SCP_COMMAND_SET_MANAGE)
{
log_message(LOG_LEVEL_DEBUG, "[v1s:%d] requested management connection", __LINE__);
LOG(LOG_LEVEL_DEBUG, "[v1s:%d] requested management connection", __LINE__);
/* should return SCP_SERVER_STATE_START_MANAGE */
return scp_v1s_mng_accept(c, s);
}
@ -278,7 +278,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
/* if we started with resource sharing... */
if (cmdset == SCP_COMMAND_SET_RSR)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -287,7 +287,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
if (cmd != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -295,7 +295,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
if (NULL == session)
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: internal error "
"(malloc returned NULL)", __LINE__);
result = SCP_SERVER_STATE_INTERNAL_ERR;
@ -342,7 +342,7 @@ scp_v1s_deny_connection(struct SCP_CONNECTION *c, const char *reason)
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, rlen + 14))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -385,14 +385,14 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, 14 + rlen))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
/* receive password & username */
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -400,7 +400,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
return SCP_SERVER_STATE_VERSION_ERR;
}
@ -410,7 +410,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
* the command (but not too big) */
if (size < (8 + 2 + 2) || size > SCP_MAX_MESSAGE_SIZE)
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s:%d] connection aborted: size error",
__LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
@ -420,7 +420,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, (size - 8)))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -430,7 +430,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (cmdset != SCP_COMMAND_SET_DEFAULT)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -438,7 +438,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (cmd != 4)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -450,7 +450,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (0 != scp_session_set_username(s, buf))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
return SCP_SERVER_STATE_INTERNAL_ERR;
}
@ -462,7 +462,7 @@ scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (0 != scp_session_set_password(s, buf))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error", __LINE__);
return SCP_SERVER_STATE_INTERNAL_ERR;
}
@ -503,7 +503,7 @@ scp_v1s_connect_new_session(struct SCP_CONNECTION *c, SCP_DISPLAY d)
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, 14))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -557,7 +557,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, size))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -571,7 +571,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -579,7 +579,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
return SCP_SERVER_STATE_VERSION_ERR;
}
@ -589,7 +589,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
* the command (but not too big) */
if (size < (8 + 2 + 2) || size > SCP_MAX_MESSAGE_SIZE)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: size error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: size error", __LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
}
@ -597,7 +597,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, (size - 8)))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -607,7 +607,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (cmd != SCP_COMMAND_SET_DEFAULT)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -615,7 +615,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (cmd != 41)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -703,7 +703,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, size))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
}
@ -713,7 +713,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, (8)))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -721,7 +721,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: version error", __LINE__);
return SCP_SERVER_STATE_VERSION_ERR;
}
@ -731,7 +731,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
* the command (but not too big) */
if (size < (8 + 2 + 2) || size > SCP_MAX_MESSAGE_SIZE)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: size error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: size error", __LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
}
@ -740,7 +740,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, (size - 8)))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -750,7 +750,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
if (cmd != SCP_COMMAND_SET_DEFAULT)
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -760,7 +760,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
{
if (!s_check_rem(c->in_s, 4))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: missing session", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: missing session", __LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
}
/* select session */
@ -779,7 +779,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
/* if we got here, the requested sid wasn't one from the list we sent */
/* we should kill the connection */
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error (no such session in list)", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: internal error (no such session in list)", __LINE__);
return SCP_SERVER_STATE_INTERNAL_ERR;
}
else if (cmd == 44)
@ -795,7 +795,7 @@ scp_v1s_list_sessions(struct SCP_CONNECTION *c, int sescnt, struct SCP_DISCONNEC
else
{
/* wrong response */
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -832,7 +832,7 @@ scp_v1s_reconnect_session(struct SCP_CONNECTION *c, SCP_DISPLAY d)
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, size))
{
log_message(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}

View File

@ -60,7 +60,7 @@ int in_string8(struct stream *s, char str[], const char *param, int line)
if (!s_check_rem(s, 1))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s_mng:%d] connection aborted: %s len missing",
line, param);
result = 0;
@ -73,7 +73,7 @@ int in_string8(struct stream *s, char str[], const char *param, int line)
result = s_check_rem(s, sz);
if (!result)
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s_mng:%d] connection aborted: %s data missing",
line, param);
}
@ -144,7 +144,7 @@ scp_v1s_mng_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
* Check there's enough data left for at least an IPv4 address (+len) */
if (!s_check_rem(c->in_s, 1 + 4))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s_mng:%d] connection aborted: IP addr len missing",
__LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
@ -160,7 +160,7 @@ scp_v1s_mng_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
{
if (!s_check_rem(c->in_s, 16))
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"[v1s_mng:%d] connection aborted: IP addr missing",
__LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
@ -369,7 +369,7 @@ scp_v1s_mng_list_sessions(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, size))
{
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
}
@ -390,7 +390,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -398,7 +398,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (version != 1)
{
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: version error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: version error", __LINE__);
return SCP_SERVER_STATE_VERSION_ERR;
}
@ -408,7 +408,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
* the command (but not too big) */
if (size < (8 + 2 + 2) || size > SCP_MAX_MESSAGE_SIZE)
{
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: size error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: size error", __LINE__);
return SCP_SERVER_STATE_SIZE_ERR;
}
@ -417,7 +417,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
/* read the rest of the packet */
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
{
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: network error", __LINE__);
return SCP_SERVER_STATE_NETWORK_ERR;
}
@ -427,7 +427,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (cmd != SCP_COMMAND_SET_MANAGE)
{
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}
@ -435,7 +435,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (cmd == SCP_CMD_MNG_LIST_REQ) /* request session list */
{
log_message(LOG_LEVEL_INFO, "[v1s_mng:%d] request session list", __LINE__);
LOG(LOG_LEVEL_INFO, "[v1s_mng:%d] request session list", __LINE__);
return SCP_SERVER_STATE_MNG_LISTREQ;
}
else if (cmd == SCP_CMD_MNG_ACTION) /* execute an action */
@ -445,7 +445,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
in_uint8a(c->in_s, buf, dim);
scp_session_set_errstr(s, buf);*/
log_message(LOG_LEVEL_INFO, "[v1s_mng:%d] action request", __LINE__);
LOG(LOG_LEVEL_INFO, "[v1s_mng:%d] action request", __LINE__);
return SCP_SERVER_STATE_MNG_ACTION;
}
@ -460,7 +460,7 @@ _scp_v1s_mng_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
return SCP_SERVER_STATE_SESSION_LIST;
}*/
log_message(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: sequence error", __LINE__);
LOG(LOG_LEVEL_WARNING, "[v1s_mng:%d] connection aborted: sequence error", __LINE__);
return SCP_SERVER_STATE_SEQUENCE_ERR;
}

View File

@ -71,7 +71,7 @@ scp_process_start(void *sck)
break;
case SCP_SERVER_STATE_START_MANAGE:
/* starting a management session */
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"starting a sesman management session...");
scp_v1_mng_process(&scon, sdata);
break;
@ -80,21 +80,21 @@ scp_process_start(void *sck)
/* an unknown scp version was requested, or the message sizes
are inconsistent. Shut down the connection and log the
fact */
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"protocol violation. connection refused.");
break;
case SCP_SERVER_STATE_NETWORK_ERR:
log_message(LOG_LEVEL_WARNING, "libscp network error.");
LOG(LOG_LEVEL_WARNING, "libscp network error.");
break;
case SCP_SERVER_STATE_SEQUENCE_ERR:
log_message(LOG_LEVEL_WARNING, "libscp sequence error.");
LOG(LOG_LEVEL_WARNING, "libscp sequence error.");
break;
case SCP_SERVER_STATE_INTERNAL_ERR:
/* internal error occurred (eg. malloc() error, ecc.) */
log_message(LOG_LEVEL_ERROR, "libscp internal error occurred.");
LOG(LOG_LEVEL_ERROR, "libscp internal error occurred.");
break;
default:
log_message(LOG_LEVEL_ALWAYS, "unknown return from scp_vXs_accept()");
LOG(LOG_LEVEL_ALWAYS, "unknown return from scp_vXs_accept()");
break;
}

View File

@ -54,14 +54,14 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
{
/* the user is member of the correct groups. */
scp_v0s_replyauthentication(c, errorcode);
log_message(LOG_LEVEL_INFO, "Access permitted for user: %s",
LOG(LOG_LEVEL_INFO, "Access permitted for user: %s",
s->username);
/* g_writeln("Connection allowed"); */
}
else
{
scp_v0s_replyauthentication(c, 32 + 3); /* all first 32 are reserved for PAM errors */
log_message(LOG_LEVEL_INFO, "Username okey but group problem for "
LOG(LOG_LEVEL_INFO, "Username okey but group problem for "
"user: %s", s->username);
/* g_writeln("user password ok, but group problem"); */
}
@ -69,7 +69,7 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
else
{
/* g_writeln("username or password error"); */
log_message(LOG_LEVEL_INFO, "Username or password error for user: %s",
LOG(LOG_LEVEL_INFO, "Username or password error for user: %s",
s->username);
scp_v0s_replyauthentication(c, errorcode);
}
@ -85,13 +85,13 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
g_memcpy(s->guid, s_item->guid, 16);
if (0 != s->client_ip)
{
log_message( LOG_LEVEL_INFO, "++ reconnected session: username %s, "
LOG( LOG_LEVEL_INFO, "++ reconnected session: username %s, "
"display :%d.0, session_pid %d, ip %s",
s->username, display, s_item->pid, s->client_ip);
}
else
{
log_message(LOG_LEVEL_INFO, "++ reconnected session: username %s, "
LOG(LOG_LEVEL_INFO, "++ reconnected session: username %s, "
"display :%d.0, session_pid %d", s->username, display,
s_item->pid);
}
@ -111,29 +111,29 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 != s->client_ip)
{
log_message(LOG_LEVEL_INFO, "++ created session (access granted): "
LOG(LOG_LEVEL_INFO, "++ created session (access granted): "
"username %s, ip %s", s->username, s->client_ip);
}
else
{
log_message(LOG_LEVEL_INFO, "++ created session (access granted): "
LOG(LOG_LEVEL_INFO, "++ created session (access granted): "
"username %s", s->username);
}
if (SCP_SESSION_TYPE_XVNC == s->type)
{
log_message( LOG_LEVEL_INFO, "starting Xvnc session...");
LOG( LOG_LEVEL_INFO, "starting Xvnc session...");
display = session_start(data, SESMAN_SESSION_TYPE_XVNC, c, s);
}
else if (SCP_SESSION_TYPE_XRDP == s->type)
{
log_message(LOG_LEVEL_INFO, "starting X11rdp session...");
LOG(LOG_LEVEL_INFO, "starting X11rdp session...");
display = session_start(data, SESMAN_SESSION_TYPE_XRDP, c, s);
}
else if (SCP_SESSION_TYPE_XORG == s->type)
{
/* type is SCP_SESSION_TYPE_XORG */
log_message(LOG_LEVEL_INFO, "starting Xorg session...");
LOG(LOG_LEVEL_INFO, "starting Xorg session...");
display = session_start(data, SESMAN_SESSION_TYPE_XORG, c, s);
}
/* if the session started up ok, auth_end will be called on

View File

@ -90,7 +90,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (!data)
{
scp_v1s_deny_connection(c, "Login failed");
log_message( LOG_LEVEL_INFO,
LOG( LOG_LEVEL_INFO,
"Login failed for user %s. Connection terminated", s->username);
return;
}
@ -99,7 +99,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 == access_login_allowed(s->username))
{
scp_v1s_deny_connection(c, "Access to Terminal Server not allowed.");
log_message(LOG_LEVEL_INFO,
LOG(LOG_LEVEL_INFO,
"User %s not allowed on TS. Connection terminated", s->username);
return;
}
@ -112,31 +112,31 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (scount == 0)
{
/* no disconnected sessions - start a new one */
log_message(LOG_LEVEL_DEBUG, "No disconnected sessions for this user "
LOG(LOG_LEVEL_DEBUG, "No disconnected sessions for this user "
"- we create a new one");
if (0 != s->client_ip)
{
log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s, ip %s", s->username, s->client_ip);
LOG(LOG_LEVEL_INFO, "++ created session (access granted): username %s, ip %s", s->username, s->client_ip);
}
else
{
log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s", s->username);
LOG(LOG_LEVEL_INFO, "++ created session (access granted): username %s", s->username);
}
if (SCP_SESSION_TYPE_XVNC == s->type)
{
log_message(LOG_LEVEL_INFO, "starting Xvnc session...");
LOG(LOG_LEVEL_INFO, "starting Xvnc session...");
display = session_start(data, SESMAN_SESSION_TYPE_XVNC, c, s);
}
else if (SCP_SESSION_TYPE_XRDP == s->type)
{
log_message(LOG_LEVEL_INFO, "starting X11rdp session...");
LOG(LOG_LEVEL_INFO, "starting X11rdp session...");
display = session_start(data, SESMAN_SESSION_TYPE_XRDP, c, s);
}
else if (SCP_SESSION_TYPE_XORG == s->type)
{
log_message(LOG_LEVEL_INFO, "starting Xorg session...");
LOG(LOG_LEVEL_INFO, "starting Xorg session...");
display = session_start(data, SESMAN_SESSION_TYPE_XORG, c, s);
}
/* if the session started up ok, auth_end will be called on
@ -164,7 +164,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
/*case SCP_SERVER_STATE_FORCE_NEW:*/
/* we should check for MaxSessions */
case SCP_SERVER_STATE_SELECTION_CANCEL:
log_message( LOG_LEVEL_INFO, "Connection cancelled after session listing");
LOG( LOG_LEVEL_INFO, "Connection cancelled after session listing");
break;
case SCP_SERVER_STATE_OK:
/* ok, reconnecting... */
@ -173,7 +173,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 == sitem)
{
e = scp_v1s_connection_error(c, "Internal error");
log_message(LOG_LEVEL_INFO, "Cannot find session item on the chain");
LOG(LOG_LEVEL_INFO, "Cannot find session item on the chain");
}
else
{
@ -183,11 +183,11 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 != s->client_ip)
{
log_message(LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, session_pid %d, ip %s", s->username, display, sitem->pid, s->client_ip);
LOG(LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, session_pid %d, ip %s", s->username, display, sitem->pid, s->client_ip);
}
else
{
log_message(LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, session_pid %d", s->username, display, sitem->pid);
LOG(LOG_LEVEL_INFO, "++ reconnected session: username %s, display :%d.0, session_pid %d", s->username, display, sitem->pid);
}
g_free(sitem);
@ -220,27 +220,27 @@ static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f)
switch (e)
{
case SCP_SERVER_STATE_VERSION_ERR:
log_message(LOG_LEVEL_WARNING, "version error");
LOG(LOG_LEVEL_WARNING, "version error");
case SCP_SERVER_STATE_SIZE_ERR:
/* an unknown scp version was requested, so we shut down the */
/* connection (and log the fact) */
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"protocol violation. connection closed.");
break;
case SCP_SERVER_STATE_NETWORK_ERR:
log_message(LOG_LEVEL_WARNING, "libscp network error.");
LOG(LOG_LEVEL_WARNING, "libscp network error.");
break;
case SCP_SERVER_STATE_SEQUENCE_ERR:
log_message(LOG_LEVEL_WARNING, "libscp sequence error.");
LOG(LOG_LEVEL_WARNING, "libscp sequence error.");
break;
case SCP_SERVER_STATE_INTERNAL_ERR:
/* internal error occurred (eg. malloc() error, ecc.) */
log_message(LOG_LEVEL_ERROR, "libscp internal error occurred.");
LOG(LOG_LEVEL_ERROR, "libscp internal error occurred.");
break;
default:
/* dummy: scp_v1s_request_password won't generate any other */
/* error other than the ones before */
log_message(LOG_LEVEL_ALWAYS, "unknown return from %s", f);
LOG(LOG_LEVEL_ALWAYS, "unknown return from %s", f);
break;
}
}

View File

@ -52,7 +52,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (!data)
{
scp_v1s_mng_deny_connection(c, "Login failed");
log_message(LOG_LEVEL_INFO,
LOG(LOG_LEVEL_INFO,
"[MNG] Login failed for user %s. Connection terminated", s->username);
auth_end(data);
return;
@ -62,7 +62,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
if (0 == access_login_mng_allowed(s->username))
{
scp_v1s_mng_deny_connection(c, "Access to Terminal Server not allowed.");
log_message(LOG_LEVEL_INFO,
LOG(LOG_LEVEL_INFO,
"[MNG] User %s not allowed on TS. Connection terminated", s->username);
auth_end(data);
return;
@ -77,7 +77,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
switch (e)
{
case SCP_SERVER_STATE_MNG_ACTION:
log_message(LOG_LEVEL_INFO, "Connection cancelled after session listing");
LOG(LOG_LEVEL_INFO, "Connection cancelled after session listing");
break;
case SCP_SERVER_STATE_MNG_LISTREQ:
@ -86,7 +86,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
LOG_DEVEL(LOG_LEVEL_DEBUG, "sessions on TS: %d (slist: %p)", scount, slist);
if (0 == slist)
{
log_message(LOG_LEVEL_INFO, "No sessions on Terminal Server");
LOG(LOG_LEVEL_INFO, "No sessions on Terminal Server");
}
e = scp_v1s_mng_list_sessions(c, s, scount, slist);
@ -109,27 +109,27 @@ static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f)
switch (e)
{
case SCP_SERVER_STATE_VERSION_ERR:
log_message(LOG_LEVEL_WARNING, "version error");
LOG(LOG_LEVEL_WARNING, "version error");
case SCP_SERVER_STATE_SIZE_ERR:
/* an unknown scp version was requested, so we shut down the */
/* connection (and log the fact) */
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"protocol violation. connection closed.");
break;
case SCP_SERVER_STATE_NETWORK_ERR:
log_message(LOG_LEVEL_WARNING, "libscp network error.");
LOG(LOG_LEVEL_WARNING, "libscp network error.");
break;
case SCP_SERVER_STATE_SEQUENCE_ERR:
log_message(LOG_LEVEL_WARNING, "libscp sequence error.");
LOG(LOG_LEVEL_WARNING, "libscp sequence error.");
break;
case SCP_SERVER_STATE_INTERNAL_ERR:
/* internal error occurred (eg. malloc() error, ecc.) */
log_message(LOG_LEVEL_ERROR, "libscp internal error occurred.");
LOG(LOG_LEVEL_ERROR, "libscp internal error occurred.");
break;
default:
/* dummy: scp_v1s_request_password won't generate any other */
/* error other than the ones before */
log_message(LOG_LEVEL_ALWAYS, "unknown return from %s", f);
LOG(LOG_LEVEL_ALWAYS, "unknown return from %s", f);
break;
}
}

View File

@ -50,7 +50,7 @@ int sesman_listen_test(struct config_sesman *cfg)
return 1;
}
log_message(LOG_LEVEL_DEBUG, "Testing if xrdp-sesman can listen on %s port %s.",
LOG(LOG_LEVEL_DEBUG, "Testing if xrdp-sesman can listen on %s port %s.",
cfg->listen_address, cfg->listen_port);
g_tcp_set_non_blocking(sck);
error = scp_tcp_bind(sck, cfg->listen_address, cfg->listen_port);
@ -96,7 +96,7 @@ sesman_main_loop(void)
g_sck = g_tcp_socket();
if (g_sck < 0)
{
log_message(LOG_LEVEL_ERROR, "error opening socket, g_tcp_socket() failed...");
LOG(LOG_LEVEL_ERROR, "error opening socket, g_tcp_socket() failed...");
return 1;
}
@ -109,7 +109,7 @@ sesman_main_loop(void)
if (error == 0)
{
log_message(LOG_LEVEL_INFO, "listening to port %s on %s",
LOG(LOG_LEVEL_INFO, "listening to port %s on %s",
g_cfg->listen_port, g_cfg->listen_address);
sck_obj = g_create_wait_obj_from_socket(g_sck, 0);
cont = 1;
@ -161,14 +161,14 @@ sesman_main_loop(void)
}
else
{
log_message(LOG_LEVEL_ERROR, "listen error %d (%s)",
LOG(LOG_LEVEL_ERROR, "listen error %d (%s)",
g_get_errno(), g_get_strerror());
rv = 1;
}
}
else
{
log_message(LOG_LEVEL_ERROR, "bind error on "
LOG(LOG_LEVEL_ERROR, "bind error on "
"port '%s': %d (%s)", g_cfg->listen_port,
g_get_errno(), g_get_strerror());
rv = 1;
@ -342,14 +342,14 @@ main(int argc, char **argv)
g_exit(1);
}
log_message(LOG_LEVEL_TRACE, "config loaded in %s at %s:%d", __func__, __FILE__, __LINE__);
log_message(LOG_LEVEL_TRACE, " listen_address = %s", g_cfg->listen_address);
log_message(LOG_LEVEL_TRACE, " listen_port = %s", g_cfg->listen_port);
log_message(LOG_LEVEL_TRACE, " enable_user_wm = %d", g_cfg->enable_user_wm);
log_message(LOG_LEVEL_TRACE, " default_wm = %s", g_cfg->default_wm);
log_message(LOG_LEVEL_TRACE, " user_wm = %s", g_cfg->user_wm);
log_message(LOG_LEVEL_TRACE, " reconnect_sh = %s", g_cfg->reconnect_sh);
log_message(LOG_LEVEL_TRACE, " auth_file_path = %s", g_cfg->auth_file_path);
LOG(LOG_LEVEL_TRACE, "config loaded in %s at %s:%d", __func__, __FILE__, __LINE__);
LOG(LOG_LEVEL_TRACE, " listen_address = %s", g_cfg->listen_address);
LOG(LOG_LEVEL_TRACE, " listen_port = %s", g_cfg->listen_port);
LOG(LOG_LEVEL_TRACE, " enable_user_wm = %d", g_cfg->enable_user_wm);
LOG(LOG_LEVEL_TRACE, " default_wm = %s", g_cfg->default_wm);
LOG(LOG_LEVEL_TRACE, " user_wm = %s", g_cfg->user_wm);
LOG(LOG_LEVEL_TRACE, " reconnect_sh = %s", g_cfg->reconnect_sh);
LOG(LOG_LEVEL_TRACE, " auth_file_path = %s", g_cfg->auth_file_path);
if (daemon)
{
@ -381,7 +381,7 @@ main(int argc, char **argv)
if (sesman_listen_test(g_cfg) != 0)
{
log_message(LOG_LEVEL_ERROR, "Failed to start xrdp-sesman daemon, "
LOG(LOG_LEVEL_ERROR, "Failed to start xrdp-sesman daemon, "
"possibly address already in use.");
g_deinit();
g_exit(1);
@ -419,7 +419,7 @@ main(int argc, char **argv)
if (-1 == fd)
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"error opening pid file[%s]: %s",
pid_file, g_get_strerror());
log_end();
@ -433,7 +433,7 @@ main(int argc, char **argv)
}
/* start program main loop */
log_message(LOG_LEVEL_INFO,
LOG(LOG_LEVEL_INFO,
"starting xrdp-sesman with pid %d", g_pid);
/* make sure the socket directory exists */
@ -444,7 +444,7 @@ main(int argc, char **argv)
{
if (!g_create_dir("/tmp/.X11-unix"))
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"sesman.c: error creating dir /tmp/.X11-unix");
}
g_chmod_hex("/tmp/.X11-unix", 0x1777);

View File

@ -70,7 +70,7 @@ dumpItemsToString(struct list *self, char *outstr, int len)
g_memset(outstr, 0, len);
if (self->count == 0)
{
g_writeln("List is empty");
LOG_DEVEL(LOG_LEVEL_TRACE, "List is empty");
}
for (index = 0; index < self->count; index++)
@ -116,7 +116,7 @@ session_get_bydata(const char *name, int width, int height, int bpp, int type,
}
#if 0
log_message(LOG_LEVEL_INFO,
LOG(LOG_LEVEL_INFO,
"session_get_bydata: search policy %d U %s W %d H %d bpp %d T %d IP %s",
policy, name, width, height, bpp, type, client_ip);
#endif
@ -124,7 +124,7 @@ session_get_bydata(const char *name, int width, int height, int bpp, int type,
while (tmp != 0)
{
#if 0
log_message(LOG_LEVEL_INFO,
LOG(LOG_LEVEL_INFO,
"session_get_bydata: try %p U %s W %d H %d bpp %d T %d IP %s",
tmp->item,
tmp->item->name,
@ -313,7 +313,7 @@ session_get_avail_display_from_chain(void)
display++;
}
log_message(LOG_LEVEL_ERROR, "X server -- no display in range is available");
LOG(LOG_LEVEL_ERROR, "X server -- no display in range is available");
return 0;
}
@ -333,7 +333,7 @@ wait_for_xserver(int display)
if (i > 40)
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"X server for display %d startup timeout",
display);
break;
@ -373,7 +373,7 @@ session_start_chansrv(char *username, int display)
/* executing chansrv */
g_execvp(exe_path, (char **) (chansrv_params->items));
/* should not get here */
log_message(LOG_LEVEL_ALWAYS, "error starting chansrv "
LOG(LOG_LEVEL_ALWAYS, "error starting chansrv "
"- user %s - pid %d", username, g_getpid());
list_delete(chansrv_params);
g_exit(1);
@ -420,7 +420,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
/* check to limit concurrent sessions */
if (g_session_count >= g_cfg->sess.max_sessions)
{
log_message(LOG_LEVEL_INFO, "max concurrent session limit "
LOG(LOG_LEVEL_INFO, "max concurrent session limit "
"exceeded. login for user %s denied", s->username);
return 0;
}
@ -429,7 +429,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
if (temp == 0)
{
log_message(LOG_LEVEL_ERROR, "cannot create new chain "
LOG(LOG_LEVEL_ERROR, "cannot create new chain "
"element - user %s", s->username);
return 0;
}
@ -439,7 +439,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
if (temp->item == 0)
{
g_free(temp);
log_message(LOG_LEVEL_ERROR, "cannot create new session "
LOG(LOG_LEVEL_ERROR, "cannot create new session "
"item - user %s", s->username);
return 0;
}
@ -461,7 +461,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
}
else if (pid == 0)
{
log_message(LOG_LEVEL_INFO, "calling auth_start_session from pid %d",
LOG(LOG_LEVEL_INFO, "calling auth_start_session from pid %d",
g_getpid());
auth_start_session(data, display);
g_delete_wait_obj(g_term_event);
@ -493,13 +493,13 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
*/
if (g_setsid() < 0)
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"setsid failed - pid %d", g_getpid());
}
if (g_setlogin(s->username) < 0)
{
log_message(LOG_LEVEL_ERROR,
LOG(LOG_LEVEL_ERROR,
"setlogin failed for user %s - pid %d", s->username,
g_getpid());
}
@ -543,7 +543,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
{
if (s->program[0] != 0)
{
log_message(LOG_LEVEL_DEBUG,
LOG(LOG_LEVEL_DEBUG,
"starting program with parameters: %s ",
s->program);
if (g_strchr(s->program, ' ') != 0 || g_strchr(s->program, '\t') != 0)
@ -555,7 +555,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
{
g_execlp3(s->program, s->program, 0);
}
log_message(LOG_LEVEL_ALWAYS,
LOG(LOG_LEVEL_ALWAYS,
"error starting program %s for user %s - pid %d",
s->program, s->username, g_getpid());
}
@ -567,16 +567,16 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
if (g_file_exist(text))
{
g_execlp3(text, g_cfg->user_wm, 0);
log_message(LOG_LEVEL_ALWAYS, "error starting user "
LOG(LOG_LEVEL_ALWAYS, "error starting user "
"wm for user %s - pid %d", s->username, g_getpid());
/* logging parameters */
log_message(LOG_LEVEL_DEBUG, "errno: %d, "
LOG(LOG_LEVEL_DEBUG, "errno: %d, "
"description: %s", g_get_errno(), g_get_strerror());
log_message(LOG_LEVEL_DEBUG, "execlp3 parameter "
LOG(LOG_LEVEL_DEBUG, "execlp3 parameter "
"list:");
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s",
LOG(LOG_LEVEL_DEBUG, " argv[0] = %s",
text);
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s",
LOG(LOG_LEVEL_DEBUG, " argv[1] = %s",
g_cfg->user_wm);
}
}
@ -584,34 +584,34 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
so we try running the default window manager */
g_execlp3(g_cfg->default_wm, g_cfg->default_wm, 0);
log_message(LOG_LEVEL_ALWAYS, "error starting default "
LOG(LOG_LEVEL_ALWAYS, "error starting default "
"wm for user %s - pid %d", s->username, g_getpid());
/* logging parameters */
log_message(LOG_LEVEL_DEBUG, "errno: %d, description: "
LOG(LOG_LEVEL_DEBUG, "errno: %d, description: "
"%s", g_get_errno(), g_get_strerror());
log_message(LOG_LEVEL_DEBUG, "execlp3 parameter list:");
log_message(LOG_LEVEL_DEBUG, " argv[0] = %s",
LOG(LOG_LEVEL_DEBUG, "execlp3 parameter list:");
LOG(LOG_LEVEL_DEBUG, " argv[0] = %s",
g_cfg->default_wm);
log_message(LOG_LEVEL_DEBUG, " argv[1] = %s",
LOG(LOG_LEVEL_DEBUG, " argv[1] = %s",
g_cfg->default_wm);
/* still a problem starting window manager just start xterm */
g_execlp3("xterm", "xterm", 0);
/* should not get here */
log_message(LOG_LEVEL_ALWAYS, "error starting xterm "
LOG(LOG_LEVEL_ALWAYS, "error starting xterm "
"for user %s - pid %d", s->username, g_getpid());
/* logging parameters */
log_message(LOG_LEVEL_DEBUG, "errno: %d, description: "
LOG(LOG_LEVEL_DEBUG, "errno: %d, description: "
"%s", g_get_errno(), g_get_strerror());
}
else
{
log_message(LOG_LEVEL_ERROR, "another Xserver might "
LOG(LOG_LEVEL_ERROR, "another Xserver might "
"already be active on display %d - see log", display);
}
log_message(LOG_LEVEL_DEBUG, "aborting connection...");
LOG(LOG_LEVEL_DEBUG, "aborting connection...");
g_exit(0);
}
else
@ -676,7 +676,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
*/
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0)
{
log_message(LOG_LEVEL_WARNING,
LOG(LOG_LEVEL_WARNING,
"Failed to disable setuid on X server: %s",
g_get_strerror());
}
@ -702,7 +702,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
pp1 = (char **) xserver_params->items;
log_message(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
LOG(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
/* some args are passed via env vars */
g_sprintf(geometry, "%d", s->width);
@ -747,7 +747,7 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
/* make sure it ends with a zero */
list_add_item(xserver_params, 0);
pp1 = (char **)xserver_params->items;
log_message(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
LOG(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
g_execvp(xserver, pp1);
}
else if (type == SESMAN_SESSION_TYPE_XRDP)
@ -776,29 +776,29 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
/* make sure it ends with a zero */
list_add_item(xserver_params, 0);
pp1 = (char **)xserver_params->items;
log_message(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
LOG(LOG_LEVEL_INFO, "%s", dumpItemsToString(xserver_params, execvpparams, 2048));
g_execvp(xserver, pp1);
}
else
{
log_message(LOG_LEVEL_ALWAYS, "bad session type - "
LOG(LOG_LEVEL_ALWAYS, "bad session type - "
"user %s - pid %d", s->username, g_getpid());
g_exit(1);
}
/* should not get here */
log_message(LOG_LEVEL_ALWAYS, "error starting X server "
LOG(LOG_LEVEL_ALWAYS, "error starting X server "
"- user %s - pid %d", s->username, g_getpid());
/* logging parameters */
log_message(LOG_LEVEL_DEBUG, "errno: %d, description: "
LOG(LOG_LEVEL_DEBUG, "errno: %d, description: "
"%s", g_get_errno(), g_get_strerror());
log_message(LOG_LEVEL_DEBUG, "execve parameter list size: "
LOG(LOG_LEVEL_DEBUG, "execve parameter list size: "
"%d", (xserver_params)->count);
for (i = 0; i < (xserver_params->count); i++)
{
log_message(LOG_LEVEL_DEBUG, " argv[%d] = %s",
LOG(LOG_LEVEL_DEBUG, " argv[%d] = %s",
i, (char *)list_get_item(xserver_params, i));
}
@ -809,12 +809,12 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
{
wait_for_xserver(display);
chansrv_pid = session_start_chansrv(s->username, display);
log_message(LOG_LEVEL_ALWAYS, "waiting for window manager "
LOG(LOG_LEVEL_ALWAYS, "waiting for window manager "
"(pid %d) to exit", window_manager_pid);
g_waitpid(window_manager_pid);
log_message(LOG_LEVEL_ALWAYS, "window manager (pid %d) did "
LOG(LOG_LEVEL_ALWAYS, "window manager (pid %d) did "
"exit, cleaning up session", window_manager_pid);
log_message(LOG_LEVEL_INFO, "calling auth_stop_session and "
LOG(LOG_LEVEL_INFO, "calling auth_stop_session and "
"auth_end from pid %d", g_getpid());
auth_stop_session(data);
auth_end(data);
@ -928,7 +928,7 @@ session_kill(int pid)
{
if (tmp->item == 0)
{
log_message(LOG_LEVEL_ERROR, "session descriptor for "
LOG(LOG_LEVEL_ERROR, "session descriptor for "
"pid %d is null!", pid);
if (prev == 0)
@ -948,7 +948,7 @@ session_kill(int pid)
if (tmp->item->pid == pid)
{
/* deleting the session */
log_message(LOG_LEVEL_INFO, "++ terminated session: username %s, display :%d.0, session_pid %d, ip %s", tmp->item->name, tmp->item->display, tmp->item->pid, tmp->item->client_ip);
LOG(LOG_LEVEL_INFO, "++ terminated session: username %s, display :%d.0, session_pid %d, ip %s", tmp->item->name, tmp->item->display, tmp->item->pid, tmp->item->client_ip);
g_free(tmp->item);
if (prev == 0)
@ -987,7 +987,7 @@ session_sigkill_all(void)
{
if (tmp->item == 0)
{
log_message(LOG_LEVEL_ERROR, "found null session "
LOG(LOG_LEVEL_ERROR, "found null session "
"descriptor!");
}
else
@ -1011,7 +1011,7 @@ session_get_bypid(int pid)
if (0 == dummy)
{
log_message(LOG_LEVEL_ERROR, "session_get_bypid: out of memory");
LOG(LOG_LEVEL_ERROR, "session_get_bypid: out of memory");
return 0;
}
@ -1021,7 +1021,7 @@ session_get_bypid(int pid)
{
if (tmp->item == 0)
{
log_message(LOG_LEVEL_ERROR, "session descriptor for "
LOG(LOG_LEVEL_ERROR, "session descriptor for "
"pid %d is null!", pid);
g_free(dummy);
return 0;
@ -1145,7 +1145,7 @@ session_get_byuser(const char *user, int *cnt, unsigned char flags)
int
cleanup_sockets(int display)
{
log_message(LOG_LEVEL_DEBUG, "cleanup_sockets:");
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets:");
char file[256];
int error;
@ -1154,10 +1154,10 @@ cleanup_sockets(int display)
g_snprintf(file, 255, CHANSRV_PORT_OUT_STR, display);
if (g_file_exist(file))
{
log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
if (g_file_delete(file) == 0)
{
log_message(LOG_LEVEL_DEBUG,
LOG(LOG_LEVEL_DEBUG,
"cleanup_sockets: failed to delete %s", file);
error++;
}
@ -1166,10 +1166,10 @@ cleanup_sockets(int display)
g_snprintf(file, 255, CHANSRV_PORT_IN_STR, display);
if (g_file_exist(file))
{
log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
if (g_file_delete(file) == 0)
{
log_message(LOG_LEVEL_DEBUG,
LOG(LOG_LEVEL_DEBUG,
"cleanup_sockets: failed to delete %s", file);
error++;
}
@ -1178,10 +1178,10 @@ cleanup_sockets(int display)
g_snprintf(file, 255, XRDP_CHANSRV_STR, display);
if (g_file_exist(file))
{
log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
if (g_file_delete(file) == 0)
{
log_message(LOG_LEVEL_DEBUG,
LOG(LOG_LEVEL_DEBUG,
"cleanup_sockets: failed to delete %s", file);
error++;
}
@ -1190,10 +1190,10 @@ cleanup_sockets(int display)
g_snprintf(file, 255, CHANSRV_API_STR, display);
if (g_file_exist(file))
{
log_message(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
LOG(LOG_LEVEL_DEBUG, "cleanup_sockets: deleting %s", file);
if (g_file_delete(file) == 0)
{
log_message(LOG_LEVEL_DEBUG,
LOG(LOG_LEVEL_DEBUG,
"cleanup_sockets: failed to delete %s", file);
error++;
}

View File

@ -43,7 +43,7 @@ sig_sesman_shutdown(int sig)
{
char pid_file[256];
log_message(LOG_LEVEL_INFO, "shutting down sesman %d", 1);
LOG(LOG_LEVEL_INFO, "shutting down sesman %d", 1);
if (g_getpid() != g_pid)
{
@ -69,7 +69,7 @@ sig_sesman_reload_cfg(int sig)
struct config_sesman *cfg;
char cfg_file[256];
log_message(LOG_LEVEL_WARNING, "receiving SIGHUP %d", 1);
LOG(LOG_LEVEL_WARNING, "receiving SIGHUP %d", 1);
if (g_getpid() != g_pid)
{
@ -81,13 +81,13 @@ sig_sesman_reload_cfg(int sig)
if (0 == cfg)
{
log_message(LOG_LEVEL_ERROR, "error creating new config: - keeping old cfg");
LOG(LOG_LEVEL_ERROR, "error creating new config: - keeping old cfg");
return;
}
if (config_read(cfg) != 0)
{
log_message(LOG_LEVEL_ERROR, "error reading config - keeping old cfg");
LOG(LOG_LEVEL_ERROR, "error reading config - keeping old cfg");
g_free(cfg);
return;
}
@ -121,7 +121,7 @@ sig_sesman_reload_cfg(int sig)
}
}
log_message(LOG_LEVEL_INFO, "configuration reloaded, log subsystem restarted");
LOG(LOG_LEVEL_INFO, "configuration reloaded, log subsystem restarted");
}
/******************************************************************************/

View File

@ -85,7 +85,9 @@ main(int argc, char **argv)
sck = g_tcp_socket();
if (sck < 0)
{
return 1;
}
if (g_tcp_connect(sck, argv[1], g_cfg.listen_port) == 0)
{

View File

@ -56,7 +56,9 @@ int main(int argc, char **argv)
sock = g_tcp_socket();
if (sock < 0)
{
return 1;
}
s = scp_session_create();
c = scp_connection_create(sock);

View File

@ -78,7 +78,7 @@ auth_userpass(const char *user, const char *pass, int *errorcode)
if (1 == auth_account_disabled(stp))
{
log_message(LOG_LEVEL_INFO, "account %s is disabled", user);
LOG(LOG_LEVEL_INFO, "account %s is disabled", user);
return 0;
}

View File

@ -51,14 +51,14 @@ add_xauth_cookie(int display, const char *file)
dp = popen(xauth_str, "r");
if (dp == NULL)
{
log_message(LOG_LEVEL_ERROR, "Unable to launch xauth");
LOG(LOG_LEVEL_ERROR, "Unable to launch xauth");
return 1;
}
ret = pclose(dp);
if (ret < 0)
{
log_message(LOG_LEVEL_ERROR, "An error occurred while running xauth");
LOG(LOG_LEVEL_ERROR, "An error occurred while running xauth");
return 1;
}