Unifying logging in chanserv
This commit adds: * replace multiple logging macros with LOG and LOG_DEVEL * logging configuration for chanserv * logging configuration for console output * logging configuration for per file or method log level filtering for debug builds * file, line, and method name in log message for debug builds
This commit is contained in:
parent
19504da100
commit
a9ec1ebd99
415
common/log.c
415
common/log.c
@ -164,6 +164,8 @@ internal_log_start(struct log_config *l_cfg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal_log_config_dump(l_cfg);
|
||||
|
||||
/* open file */
|
||||
l_cfg->fd = internal_log_file_open(l_cfg->log_file);
|
||||
|
||||
@ -265,37 +267,26 @@ internal_log_text2level(const char *buf)
|
||||
return LOG_LEVEL_DEBUG;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
internalReadConfiguration(const char *inFilename, const char *applicationName)
|
||||
/******************************************************************************/
|
||||
struct log_config*
|
||||
internal_config_read_logging(int file,
|
||||
const char *applicationName,
|
||||
const char *section_prefix)
|
||||
{
|
||||
int fd;
|
||||
enum logReturns ret = LOG_GENERAL_ERROR;
|
||||
int i;
|
||||
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;
|
||||
|
||||
if (inFilename == NULL)
|
||||
lc = internalInitAndAllocStruct();
|
||||
if (lc == NULL)
|
||||
{
|
||||
g_writeln("The inifile is null to readConfiguration!");
|
||||
return ret;
|
||||
}
|
||||
|
||||
fd = g_file_open_ex(inFilename, 1, 0, 0, 0);
|
||||
|
||||
if (-1 == fd)
|
||||
{
|
||||
ret = LOG_ERROR_NO_CFG;
|
||||
g_writeln("We could not open the configuration file to read log parameters");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* we initialize the memory for the configuration and set all content
|
||||
to zero. */
|
||||
ret = internalInitAndAllocStruct();
|
||||
|
||||
if (ret != LOG_STARTUP_OK)
|
||||
{
|
||||
g_file_close(fd);
|
||||
return ret;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
param_n = list_create();
|
||||
@ -303,28 +294,6 @@ internalReadConfiguration(const char *inFilename, const char *applicationName)
|
||||
param_v = list_create();
|
||||
param_v->auto_free = 1;
|
||||
|
||||
/* read logging config */
|
||||
ret = internal_config_read_logging(fd, g_staticLogConfig, param_n,
|
||||
param_v, applicationName);
|
||||
|
||||
/* cleanup */
|
||||
list_delete(param_v);
|
||||
list_delete(param_n);
|
||||
g_file_close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
enum logReturns
|
||||
internal_config_read_logging(int file, struct log_config *lc,
|
||||
struct list *param_n,
|
||||
struct list *param_v,
|
||||
const char *applicationName)
|
||||
{
|
||||
int i;
|
||||
char *buf;
|
||||
char *temp_buf;
|
||||
|
||||
list_clear(param_v);
|
||||
list_clear(param_n);
|
||||
|
||||
@ -332,11 +301,15 @@ internal_config_read_logging(int file, struct log_config *lc,
|
||||
lc->program_name = applicationName;
|
||||
lc->log_file = 0;
|
||||
lc->fd = -1;
|
||||
lc->log_level = LOG_LEVEL_DEBUG;
|
||||
lc->log_level = LOG_LEVEL_INFO;
|
||||
lc->enable_console = 0;
|
||||
lc->console_level = LOG_LEVEL_INFO;
|
||||
lc->enable_syslog = 0;
|
||||
lc->syslog_level = LOG_LEVEL_DEBUG;
|
||||
lc->syslog_level = LOG_LEVEL_INFO;
|
||||
lc->enable_pid = 0;
|
||||
|
||||
file_read_section(file, SESMAN_CFG_LOGGING, param_n, param_v);
|
||||
g_snprintf(section_name, 511, "%s%s", section_prefix, SESMAN_CFG_LOGGING);
|
||||
file_read_section(file, section_name, param_n, param_v);
|
||||
|
||||
for (i = 0; i < param_n->count; i++)
|
||||
{
|
||||
@ -372,6 +345,21 @@ internal_config_read_logging(int file, struct log_config *lc,
|
||||
{
|
||||
lc->syslog_level = internal_log_text2level((char *)list_get_item(param_v, i));
|
||||
}
|
||||
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_CONSOLE))
|
||||
{
|
||||
lc->enable_console = g_text2bool((char *)list_get_item(param_v, i));
|
||||
}
|
||||
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_CONSOLE_LEVEL))
|
||||
{
|
||||
lc->console_level = internal_log_text2level((char *)list_get_item(param_v, i));
|
||||
}
|
||||
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_PID))
|
||||
{
|
||||
lc->enable_pid = g_text2bool((char *)list_get_item(param_v, i));
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == lc->log_file)
|
||||
@ -382,41 +370,184 @@ internal_config_read_logging(int file, struct log_config *lc,
|
||||
/* try to create path if not exist */
|
||||
g_create_path(lc->log_file);
|
||||
|
||||
g_printf("logging configuration:\r\n");
|
||||
g_printf("\tLogFile: %s\r\n", lc->log_file);
|
||||
g_printf("\tLogLevel: %i\r\n", lc->log_level);
|
||||
g_printf("\tEnableSyslog: %i\r\n", lc->enable_syslog);
|
||||
g_printf("\tSyslogLevel: %i\r\n", lc->syslog_level);
|
||||
return LOG_STARTUP_OK;
|
||||
list_clear(param_v);
|
||||
list_clear(param_n);
|
||||
g_snprintf(section_name, 511, "%s%s", section_prefix, SESMAN_CFG_LOGGING_LOGGER);
|
||||
file_read_section(file, section_name, param_n, param_v);
|
||||
for (i = 0; i < param_n->count; i++)
|
||||
{
|
||||
logger = (struct log_logger_level*)g_malloc(sizeof(struct log_logger_level), 1);
|
||||
list_add_item(lc->per_logger_level, (tbus) logger);
|
||||
logger->log_level = internal_log_text2level((char *)list_get_item(param_v, i));
|
||||
|
||||
g_strncpy(logger->logger_name, (char *)list_get_item(param_n, i), LOGGER_NAME_SIZE);
|
||||
logger->logger_name[LOGGER_NAME_SIZE] = '\0';
|
||||
len = g_strlen(logger->logger_name);
|
||||
if(len >= 2
|
||||
&& logger->logger_name[len-2] == '('
|
||||
&& logger->logger_name[len-1] == ')' )
|
||||
{
|
||||
logger->logger_type = LOG_TYPE_FUNCTION;
|
||||
logger->logger_name[len-2] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
logger->logger_type = LOG_TYPE_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
list_delete(param_v);
|
||||
list_delete(param_n);
|
||||
return lc;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
void
|
||||
internal_log_config_dump(struct log_config *config)
|
||||
{
|
||||
char str_level[20];
|
||||
struct log_logger_level* logger;
|
||||
|
||||
g_printf("logging configuration:\r\n");
|
||||
internal_log_lvl2str(config->log_level, str_level);
|
||||
g_printf("\tLogFile: %s\r\n", config->log_file);
|
||||
g_printf("\tLogLevel: %s\r\n", str_level);
|
||||
|
||||
internal_log_lvl2str(config->console_level, str_level);
|
||||
g_printf("\tEnableConsole: %s\r\n", (config->enable_console ? "true" : "false"));
|
||||
g_printf("\tConsoleLevel: %s\r\n", str_level);
|
||||
|
||||
internal_log_lvl2str(config->syslog_level, str_level);
|
||||
g_printf("\tEnableSyslog: %s\r\n", (config->enable_syslog ? "true" : "false"));
|
||||
g_printf("\tSyslogLevel: %s\r\n", str_level);
|
||||
|
||||
g_printf("per logger configuration:\r\n");
|
||||
for (int i = 0; i < config->per_logger_level->count; i++)
|
||||
{
|
||||
logger = (struct log_logger_level*)list_get_item(config->per_logger_level, i);
|
||||
internal_log_lvl2str(logger->log_level, str_level);
|
||||
g_printf("\t%-*s: %s\r\n", LOGGER_NAME_SIZE, logger->logger_name, str_level);
|
||||
}
|
||||
if(config->per_logger_level->count == 0)
|
||||
{
|
||||
g_printf("\tNone\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
struct log_config*
|
||||
internalInitAndAllocStruct(void)
|
||||
{
|
||||
enum logReturns ret = LOG_GENERAL_ERROR;
|
||||
g_staticLogConfig = g_new0(struct log_config, 1);
|
||||
struct log_config *ret = g_new0(struct log_config, 1);
|
||||
|
||||
if (g_staticLogConfig != NULL)
|
||||
if (ret != NULL)
|
||||
{
|
||||
g_staticLogConfig->fd = -1;
|
||||
g_staticLogConfig->enable_syslog = 0;
|
||||
ret = LOG_STARTUP_OK;
|
||||
ret->fd = -1;
|
||||
ret->enable_syslog = 0;
|
||||
ret->per_logger_level = list_create();
|
||||
if (ret->per_logger_level != NULL)
|
||||
{
|
||||
ret->per_logger_level->auto_free = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_writeln("could not allocate memory for log struct");
|
||||
g_free(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_writeln("could not allocate memory for log struct");
|
||||
ret = LOG_ERROR_MALLOC;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
internal_log_config_copy(struct log_config *dest, const struct log_config *src)
|
||||
{
|
||||
dest->enable_syslog = src->enable_syslog;
|
||||
dest->fd = src->fd;
|
||||
dest->log_file = g_strdup(src->log_file);
|
||||
dest->log_level = src->log_level;
|
||||
dest->log_lock = src->log_lock;
|
||||
dest->log_lock_attr = src->log_lock_attr;
|
||||
dest->program_name = src->program_name;
|
||||
dest->enable_syslog = src->enable_syslog;
|
||||
dest->syslog_level = src->syslog_level;
|
||||
dest->enable_console = src->enable_console;
|
||||
dest->console_level = src->console_level;
|
||||
dest->enable_pid = src->enable_pid;
|
||||
for (int i = 0; i < src->per_logger_level->count; ++i)
|
||||
{
|
||||
struct log_logger_level *dst_logger =
|
||||
(struct log_logger_level*)g_malloc(sizeof(struct log_logger_level), 1);
|
||||
|
||||
g_memcpy(dst_logger,
|
||||
(struct log_logger_level*) list_get_item(src->per_logger_level, i),
|
||||
sizeof(struct log_logger_level));
|
||||
|
||||
list_add_item(dest->per_logger_level, (tbus) dst_logger);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Here below the public functions
|
||||
*/
|
||||
|
||||
struct log_config*
|
||||
log_config_init_from_config(const char *iniFilename,
|
||||
const char *applicationName,
|
||||
const char *section_prefix)
|
||||
{
|
||||
int fd;
|
||||
struct log_config* config;
|
||||
|
||||
if (applicationName == NULL)
|
||||
{
|
||||
g_writeln("Programming error your application name cannot be null");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (iniFilename == NULL)
|
||||
{
|
||||
g_writeln("The inifile is null to log_config_init_from_config!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fd = g_file_open_ex(iniFilename, 1, 0, 0, 0);
|
||||
|
||||
if (-1 == fd)
|
||||
{
|
||||
g_writeln("We could not open the configuration file to read log parameters");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* read logging config */
|
||||
config = internal_config_read_logging(fd, applicationName, section_prefix);
|
||||
|
||||
/* cleanup */
|
||||
g_file_close(fd);
|
||||
return config;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
log_start_from_param(const struct log_config *iniParams)
|
||||
log_config_free(struct log_config* config)
|
||||
{
|
||||
if (config != NULL)
|
||||
{
|
||||
if (config->per_logger_level != NULL)
|
||||
{
|
||||
list_delete(config->per_logger_level);
|
||||
config->per_logger_level = NULL;
|
||||
}
|
||||
g_free(config);
|
||||
}
|
||||
|
||||
return LOG_STARTUP_OK;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
log_start_from_param(const struct log_config *src_log_config)
|
||||
{
|
||||
enum logReturns ret = LOG_GENERAL_ERROR;
|
||||
|
||||
@ -426,41 +557,28 @@ log_start_from_param(const struct log_config *iniParams)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (iniParams == NULL)
|
||||
if (src_log_config == NULL)
|
||||
{
|
||||
g_writeln("inparam to log_start_from_param is NULL");
|
||||
g_writeln("src_log_config to log_start_from_param is NULL");
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*Copy the struct information*/
|
||||
ret = internalInitAndAllocStruct();
|
||||
|
||||
if (ret != LOG_STARTUP_OK)
|
||||
g_staticLogConfig = internalInitAndAllocStruct();
|
||||
if (g_staticLogConfig == NULL)
|
||||
{
|
||||
g_writeln("internalInitAndAllocStruct failed");
|
||||
return ret;
|
||||
return LOG_ERROR_MALLOC;
|
||||
}
|
||||
internal_log_config_copy(g_staticLogConfig, src_log_config);
|
||||
|
||||
g_staticLogConfig->enable_syslog = iniParams->enable_syslog;
|
||||
g_staticLogConfig->fd = iniParams->fd;
|
||||
g_staticLogConfig->log_file = g_strdup(iniParams->log_file);
|
||||
g_staticLogConfig->log_level = iniParams->log_level;
|
||||
g_staticLogConfig->log_lock = iniParams->log_lock;
|
||||
g_staticLogConfig->log_lock_attr = iniParams->log_lock_attr;
|
||||
g_staticLogConfig->program_name = iniParams->program_name;
|
||||
g_staticLogConfig->syslog_level = iniParams->syslog_level;
|
||||
ret = internal_log_start(g_staticLogConfig);
|
||||
|
||||
if (ret != LOG_STARTUP_OK)
|
||||
{
|
||||
g_writeln("Could not start log");
|
||||
|
||||
if (g_staticLogConfig != NULL)
|
||||
{
|
||||
g_free(g_staticLogConfig);
|
||||
g_staticLogConfig = NULL;
|
||||
}
|
||||
log_config_free(g_staticLogConfig);
|
||||
g_staticLogConfig = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,28 +596,18 @@ enum logReturns
|
||||
log_start(const char *iniFile, const char *applicationName)
|
||||
{
|
||||
enum logReturns ret = LOG_GENERAL_ERROR;
|
||||
struct log_config *config;
|
||||
|
||||
if (applicationName == NULL)
|
||||
config = log_config_init_from_config(iniFile, applicationName, "");
|
||||
|
||||
if (config != NULL)
|
||||
{
|
||||
g_writeln("Programming error your application name cannot be null");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = internalReadConfiguration(iniFile, applicationName);
|
||||
|
||||
if (ret == LOG_STARTUP_OK)
|
||||
{
|
||||
ret = internal_log_start(g_staticLogConfig);
|
||||
ret = log_start_from_param(config);
|
||||
log_config_free(config);
|
||||
|
||||
if (ret != LOG_STARTUP_OK)
|
||||
{
|
||||
g_writeln("Could not start log");
|
||||
|
||||
if (g_staticLogConfig != NULL)
|
||||
{
|
||||
g_free(g_staticLogConfig);
|
||||
g_staticLogConfig = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -520,21 +628,77 @@ log_end(void)
|
||||
{
|
||||
enum logReturns ret = LOG_GENERAL_ERROR;
|
||||
ret = internal_log_end(g_staticLogConfig);
|
||||
|
||||
if (g_staticLogConfig != NULL)
|
||||
{
|
||||
g_free(g_staticLogConfig);
|
||||
g_staticLogConfig = NULL;
|
||||
}
|
||||
log_config_free(g_staticLogConfig);
|
||||
g_staticLogConfig = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
log_message_with_location(const char *function_name,
|
||||
const char *file_name,
|
||||
const int line_number,
|
||||
const enum logLevels level,
|
||||
const char *msg,
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
enum logReturns rv;
|
||||
char buff[LOG_BUFFER_SIZE];
|
||||
struct log_logger_level *logger;
|
||||
int i;
|
||||
bool_t force_log = 0;
|
||||
|
||||
if (g_staticLogConfig == NULL)
|
||||
{
|
||||
g_writeln("The log reference is NULL - log not initialized properly "
|
||||
"when called from [%s(%s:%d)]",
|
||||
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)
|
||||
{
|
||||
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);
|
||||
va_end(ap);
|
||||
return rv;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
log_message(const enum logLevels lvl, const char *msg, ...)
|
||||
{
|
||||
char buff[LOG_BUFFER_SIZE + 31]; /* 19 (datetime) 4 (space+cr+lf+\0) */
|
||||
va_list ap;
|
||||
enum logReturns rv;
|
||||
|
||||
va_start(ap, msg);
|
||||
rv = internal_log_message(lvl, 0, msg, ap);
|
||||
va_end(ap);
|
||||
return rv;
|
||||
}
|
||||
|
||||
enum logReturns
|
||||
internal_log_message(const enum logLevels lvl, bool_t force_log, const char *msg, va_list ap)
|
||||
{
|
||||
char buff[LOG_BUFFER_SIZE + 31]; /* 19 (datetime) 4 (space+cr+lf+\0) */
|
||||
int len = 0;
|
||||
enum logReturns rv = LOG_STARTUP_OK;
|
||||
int writereply = 0;
|
||||
@ -547,11 +711,20 @@ log_message(const enum logLevels lvl, const char *msg, ...)
|
||||
return LOG_ERROR_NO_CFG;
|
||||
}
|
||||
|
||||
if (0 > g_staticLogConfig->fd && g_staticLogConfig->enable_syslog == 0)
|
||||
if (0 > g_staticLogConfig->fd
|
||||
&& g_staticLogConfig->enable_syslog == 0
|
||||
&& g_staticLogConfig->enable_console == 0)
|
||||
{
|
||||
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))))
|
||||
{
|
||||
return LOG_STARTUP_OK;
|
||||
}
|
||||
|
||||
now_t = time(&now_t);
|
||||
now = localtime(&now_t);
|
||||
|
||||
@ -559,9 +732,13 @@ log_message(const enum logLevels lvl, const char *msg, ...)
|
||||
|
||||
internal_log_lvl2str(lvl, buff + 20);
|
||||
|
||||
va_start(ap, msg);
|
||||
len = vsnprintf(buff + 28, LOG_BUFFER_SIZE, msg, ap);
|
||||
va_end(ap);
|
||||
if (g_staticLogConfig->enable_pid)
|
||||
{
|
||||
g_snprintf(buff + 28, LOG_BUFFER_SIZE, "[pid:%d tid:%lld] ",
|
||||
g_getpid(), (long long) tc_get_threadid());
|
||||
len = g_strlen(buff + 28);
|
||||
}
|
||||
len += vsnprintf(buff + 28 + len, LOG_BUFFER_SIZE - len, msg, ap);
|
||||
|
||||
/* checking for truncated messages */
|
||||
if (len > LOG_BUFFER_SIZE)
|
||||
@ -585,19 +762,21 @@ log_message(const enum logLevels lvl, const char *msg, ...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (g_staticLogConfig->enable_syslog && (lvl <= g_staticLogConfig->syslog_level))
|
||||
if (g_staticLogConfig->enable_syslog && (force_log || lvl <= g_staticLogConfig->syslog_level))
|
||||
{
|
||||
/* log to syslog*/
|
||||
/* %s fix compiler warning 'not a string literal' */
|
||||
syslog(internal_log_xrdp2syslog(lvl), "(%d)(%lld)%s", g_getpid(),
|
||||
(long long) tc_get_threadid(), buff + 20);
|
||||
syslog(internal_log_xrdp2syslog(lvl), "%s", buff + 20);
|
||||
}
|
||||
|
||||
if (lvl <= g_staticLogConfig->log_level)
|
||||
if (g_staticLogConfig->enable_console && (force_log || lvl <= g_staticLogConfig->console_level))
|
||||
{
|
||||
/* log to console */
|
||||
g_printf("%s", buff);
|
||||
}
|
||||
|
||||
if (force_log || lvl <= g_staticLogConfig->log_level)
|
||||
{
|
||||
/* log to application logfile */
|
||||
#ifdef LOG_ENABLE_THREAD
|
||||
pthread_mutex_lock(&(g_staticLogConfig->log_lock));
|
||||
|
166
common/log.h
166
common/log.h
@ -22,19 +22,21 @@
|
||||
#include <pthread.h>
|
||||
|
||||
#include "arch.h"
|
||||
#include "list.h"
|
||||
|
||||
/* logging buffer size */
|
||||
#define LOG_BUFFER_SIZE 1024
|
||||
#define LOGGER_NAME_SIZE 50
|
||||
|
||||
/* logging levels */
|
||||
enum logLevels
|
||||
{
|
||||
LOG_LEVEL_ALWAYS = 0,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARNING,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG,
|
||||
LOG_LEVEL_TRACE
|
||||
LOG_LEVEL_ERROR, /* for describing non-recoverable error states in a request or method */
|
||||
LOG_LEVEL_WARNING, /* for describing recoverable error states in a request or method */
|
||||
LOG_LEVEL_INFO, /* for low verbosity and high level descriptions of normal operations */
|
||||
LOG_LEVEL_DEBUG, /* for medium verbosity and low level descriptions of normal operations */
|
||||
LOG_LEVEL_TRACE /* for high verbosity and low level descriptions of normal operations (eg. method or wire tracing) */
|
||||
};
|
||||
|
||||
/* startup return values */
|
||||
@ -49,29 +51,92 @@ enum logReturns
|
||||
LOG_GENERAL_ERROR
|
||||
};
|
||||
|
||||
#define SESMAN_CFG_LOGGING "Logging"
|
||||
#define SESMAN_CFG_LOG_FILE "LogFile"
|
||||
#define SESMAN_CFG_LOG_LEVEL "LogLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_SYSLOG "EnableSyslog"
|
||||
#define SESMAN_CFG_LOG_SYSLOG_LEVEL "SyslogLevel"
|
||||
#define SESMAN_CFG_LOGGING "Logging"
|
||||
#define SESMAN_CFG_LOGGING_LOGGER "LoggingPerLogger"
|
||||
#define SESMAN_CFG_LOG_FILE "LogFile"
|
||||
#define SESMAN_CFG_LOG_LEVEL "LogLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_CONSOLE "EnableConsole"
|
||||
#define SESMAN_CFG_LOG_CONSOLE_LEVEL "ConsoleLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_SYSLOG "EnableSyslog"
|
||||
#define SESMAN_CFG_LOG_SYSLOG_LEVEL "SyslogLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_PID "EnableProcessId"
|
||||
|
||||
/* enable threading */
|
||||
/*#define LOG_ENABLE_THREAD*/
|
||||
|
||||
#ifdef XRDP_DEBUG
|
||||
#define LOG_DBG(args...) log_message(LOG_LEVEL_DEBUG, args);
|
||||
|
||||
/**
|
||||
* @brief Logging macro for messages that are for an XRDP developper to
|
||||
* understand and debug XRDP code.
|
||||
*
|
||||
* Note: all log levels are relavant to help a developper understand XRDP at
|
||||
* different levels of granularity.
|
||||
*
|
||||
* Note: the logging function calls are removed when XRDP_DEBUG is NOT defined.
|
||||
*
|
||||
* Note: when the build is configured with --enable-xrdpdebug, then
|
||||
* the log level can be configured per the source file name or method name
|
||||
* (with the suffix "()") in the [LoggingPerLogger]
|
||||
* section of the configuration file.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* [LoggingPerLogger]
|
||||
* xrdp.c=DEBUG
|
||||
* main()=WARNING
|
||||
* ```
|
||||
*
|
||||
* @param lvl, the log level
|
||||
* @param msg, the log text as a printf format c-string
|
||||
* @param ... the arguments for the printf format c-string
|
||||
*/
|
||||
#define LOG_DEVEL(log_level, args...) \
|
||||
log_message_with_location(__func__, __FILE__, __LINE__, log_level, args);
|
||||
|
||||
/**
|
||||
* @brief Logging macro for messages that are for a systeam administrator to
|
||||
* configure and run XRDP on their machine.
|
||||
*
|
||||
* Note: the logging function calls contain additional code location info when
|
||||
* XRDP_DEBUG is defined.
|
||||
*
|
||||
* @param lvl, the log level
|
||||
* @param msg, the log text as a printf format c-string
|
||||
* @param ... the arguments for the printf format c-string
|
||||
*/
|
||||
#define LOG(log_level, args...) \
|
||||
log_message_with_location(__func__, __FILE__, __LINE__, log_level, args);
|
||||
#else
|
||||
#define LOG_DBG(args...)
|
||||
#define LOG_DEVEL(log_level, args...)
|
||||
#define LOG(log_level, args...) log_message(log_level, args);
|
||||
#endif
|
||||
|
||||
enum log_logger_type
|
||||
{
|
||||
LOG_TYPE_FILE = 0,
|
||||
LOG_TYPE_FUNCTION,
|
||||
};
|
||||
|
||||
struct log_logger_level
|
||||
{
|
||||
enum logLevels log_level;
|
||||
enum log_logger_type logger_type;
|
||||
char logger_name[LOGGER_NAME_SIZE + 1];
|
||||
};
|
||||
|
||||
struct log_config
|
||||
{
|
||||
const char *program_name;
|
||||
char *log_file;
|
||||
int fd;
|
||||
enum logLevels log_level;
|
||||
int enable_console;
|
||||
enum logLevels console_level;
|
||||
int enable_syslog;
|
||||
enum logLevels syslog_level;
|
||||
struct list *per_logger_level;
|
||||
int enable_pid;
|
||||
pthread_mutex_t log_lock;
|
||||
pthread_mutexattr_t log_lock_attr;
|
||||
};
|
||||
@ -121,25 +186,28 @@ internal_log_text2level(const char *buf);
|
||||
* also init its content.
|
||||
* @return LOG_STARTUP_OK or LOG_ERROR_MALLOC
|
||||
*/
|
||||
enum logReturns
|
||||
struct log_config*
|
||||
internalInitAndAllocStruct(void);
|
||||
|
||||
/**
|
||||
* Read configuration from a file and store the values in lists.
|
||||
* @param file
|
||||
* @param lc
|
||||
* @param param_n
|
||||
* @param param_v
|
||||
* @param applicationName, the application name used in the log events.
|
||||
* Print the contents of the logging config to stdout.
|
||||
*/
|
||||
void
|
||||
internal_log_config_dump(struct log_config *config);
|
||||
|
||||
/**
|
||||
* the log function that all files use to log an event.
|
||||
* @param lvl, the loglevel
|
||||
* @param msg, the logtext.
|
||||
* @param ...
|
||||
* @return
|
||||
*/
|
||||
enum logReturns
|
||||
internal_config_read_logging(int file, struct log_config *lc,
|
||||
struct list *param_n,
|
||||
struct list *param_v,
|
||||
const char *applicationName);
|
||||
internal_log_message(const enum logLevels lvl, bool_t force_log, const char *msg, va_list args);
|
||||
|
||||
/*End of internal functions*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function initialize the log facilities according to the configuration
|
||||
* file, that is described by the in parameter.
|
||||
@ -152,11 +220,34 @@ log_start(const char *iniFile, const char *applicationName);
|
||||
|
||||
/**
|
||||
* An alternative log_start where the caller gives the params directly.
|
||||
* @param iniParams
|
||||
* @param config
|
||||
* @return
|
||||
*
|
||||
* @post to avoid memory leaks, the config argument must be free'ed using
|
||||
* `log_config_free()`
|
||||
*/
|
||||
enum logReturns
|
||||
log_start_from_param(const struct log_config *iniParams);
|
||||
log_start_from_param(const struct log_config *src_log_config);
|
||||
|
||||
/**
|
||||
* Read configuration from a file and store the values in the returned
|
||||
* log_config.
|
||||
* @param file
|
||||
* @param applicationName, the application name used in the log events.
|
||||
* @param section_prefix, prefix for the logging sections to parse
|
||||
* @return
|
||||
*/
|
||||
struct log_config*
|
||||
log_config_init_from_config(const char *iniFilename,
|
||||
const char *applicationName,
|
||||
const char *section_prefix);
|
||||
|
||||
/**
|
||||
* Free the memory for the log_config struct.
|
||||
*/
|
||||
enum logReturns
|
||||
log_config_free(struct log_config* config);
|
||||
|
||||
/**
|
||||
* Function that terminates all logging
|
||||
* @return
|
||||
@ -166,6 +257,9 @@ log_end(void);
|
||||
|
||||
/**
|
||||
* the log function that all files use to log an event.
|
||||
*
|
||||
* Please prefer to use the LOG and LOG_DEVEL macros instead of this function directly.
|
||||
*
|
||||
* @param lvl, the loglevel
|
||||
* @param msg, the logtext.
|
||||
* @param ...
|
||||
@ -174,6 +268,28 @@ log_end(void);
|
||||
enum logReturns
|
||||
log_message(const enum logLevels lvl, const char *msg, ...) printflike(2, 3);
|
||||
|
||||
/**
|
||||
* the log function that all files use to log an event,
|
||||
* with the function name and file line.
|
||||
*
|
||||
* Please prefer to use the LOG and LOG_DEVEL macros instead of this function directly.
|
||||
*
|
||||
* @param function_name, the function name (typicaly the __func__ macro)
|
||||
* @param file_name, the file name (typicaly the __FILE__ macro)
|
||||
* @param line_number, the line number in the file (typicaly the __LINE__ macro)
|
||||
* @param lvl, the loglevel
|
||||
* @param msg, the logtext.
|
||||
* @param ...
|
||||
* @return
|
||||
*/
|
||||
enum logReturns
|
||||
log_message_with_location(const char *function_name,
|
||||
const char *file_name,
|
||||
const int line_number,
|
||||
const enum logLevels lvl,
|
||||
const char *msg,
|
||||
...) printflike(5, 6);
|
||||
|
||||
/**
|
||||
* This function returns the configured file name for the logfile
|
||||
* @param replybuf the buffer where the reply is stored
|
||||
|
@ -32,6 +32,10 @@ X11 server settings for supported servers
|
||||
\fB[Chansrv]\fR
|
||||
Settings for xrdp-chansrv(8)
|
||||
|
||||
.TP
|
||||
\fB[Chansrv_Logging]\fR
|
||||
Logging settings for xrdp-chansrv(8)
|
||||
|
||||
.TP
|
||||
\fB[SessionVariables]\fR
|
||||
Environment variables for the session
|
||||
@ -81,12 +85,15 @@ relative path to \fI@xrdpconfdir@\fR. If not specified, defaults to
|
||||
\fI@xrdpconfdir@/reconnectwm.sh\fR.
|
||||
|
||||
.SH "LOGGING"
|
||||
Following parameters can be used in the \fB[Logging]\fR section.
|
||||
Following parameters can be used in the \fB[Logging]\fR and \fB[ChansrvLogging]\fR
|
||||
sections.
|
||||
|
||||
.TP
|
||||
\fBLogFile\fR=\fIfilename\fR
|
||||
Log file path. It can be either absolute or relative. If not specified,
|
||||
defaults to \fI./sesman.log\fR
|
||||
defaults to \fI./sesman.log\fR It is ignored in the [ChansrvLogging] section
|
||||
since the channel server creates one log file per display and instead uses the
|
||||
following log file naming convention \fIxrdp-chansrv.${DISPLAY}.log\fR
|
||||
|
||||
.TP
|
||||
\fBLogLevel\fR=\fIlevel\fR
|
||||
@ -112,8 +119,22 @@ syslog.
|
||||
.TP
|
||||
\fBSyslogLevel\fR=\fIlevel\fR
|
||||
Logging level for syslog. It can have the same values as \fBLogLevel\fR.
|
||||
If \fBSyslogLevel\fR and \fBLogLevel\fR differ, the least verbose setting
|
||||
takes effect for syslog.
|
||||
Defaults to \fBDEBUG\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableConsole\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging to
|
||||
the console (ie. stdout).
|
||||
|
||||
.TP
|
||||
\fBConsoleLevel\fR=\fIlevel\fR
|
||||
Logging level for the console. It can have the same values as \fBLogLevel\fR.
|
||||
Defaults to \fBDEBUG\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableProcessId\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging the
|
||||
process id in all log messages. Defaults to \fBfalse\fR.
|
||||
|
||||
.SH "SESSIONS"
|
||||
Following parameters can be used in the \fB[Sessions]\fR section.
|
||||
|
@ -31,30 +31,6 @@ Dynamic Virtual Channel
|
||||
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.I CHANSRV_LOG_LEVEL
|
||||
Logging level for chansrv. Case-insensitive. Takes one of these string values:
|
||||
.RS 8
|
||||
.TP
|
||||
.B LOG_LEVEL_ALWAYS
|
||||
Only log essential messages
|
||||
.TP
|
||||
.B LOG_LEVEL_ERROR
|
||||
Log errors and above
|
||||
.TP
|
||||
.B LOG_LEVEL_WARNING
|
||||
Log warnings and above
|
||||
.TP
|
||||
.B LOG_LEVEL_INFO
|
||||
Log info and above. This is the default if nothing is specified
|
||||
.TP
|
||||
.B LOG_LEVEL_DEBUG
|
||||
Log debug and above
|
||||
.TP
|
||||
.B LOG_LEVEL_TRACE
|
||||
Log everything
|
||||
.TP
|
||||
.RE
|
||||
.TP
|
||||
.I CHANSRV_LOG_PATH
|
||||
Path to the location where the log file is stored. If not specified,
|
||||
$\fBXDG_DATA_HOME/xrdp\fP or \fB$HOME/.local/share/xrdp\fP is used instead.
|
||||
|
@ -243,6 +243,18 @@ If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables logging to syslog
|
||||
\fBSyslogLevel\fR=\fIlevel\fR
|
||||
This option sets the logging level for syslog. It can have the same values of \fBLogLevel\fR. If \fBSyslogLevel\fR is greater than \fBLogLevel\fR, its value is lowered to that of \fBLogLevel\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableConsole\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging to the console (ie. stdout).
|
||||
|
||||
.TP
|
||||
\fBConsoleLevel\fR=\fIlevel\fR
|
||||
Logging level for the console. It can have the same values as \fBLogLevel\fR. Defaults to \fBDEBUG\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableProcessId\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging the process id in all log messages. Defaults to \fBfalse\fR.
|
||||
|
||||
.SH "CHANNELS"
|
||||
The Remote Desktop Protocol supports several channels, which are used to transfer additional data like sound, clipboard data and others.
|
||||
Channel names not listed here will be blocked by \fBxrdp\fP.
|
||||
|
@ -48,7 +48,7 @@ access_login_allowed(const char *user)
|
||||
|
||||
if ((0 == g_cfg->sec.ts_users_enable) && (0==g_cfg->sec.ts_always_group_check))
|
||||
{
|
||||
LOG_DBG("Terminal Server Users group is disabled, allowing authentication");
|
||||
log_message(LOG_LEVEL_INFO, "Terminal Server Users group is disabled, allowing authentication");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ access_login_mng_allowed(const char *user)
|
||||
|
||||
if (0 == g_cfg->sec.ts_admins_enable)
|
||||
{
|
||||
LOG_DBG("[MNG] Terminal Server Admin group is disabled, "
|
||||
log_message(LOG_LEVEL_INFO, "[MNG] Terminal Server Admin group is disabled, "
|
||||
"allowing authentication");
|
||||
return 1;
|
||||
}
|
||||
@ -109,7 +109,7 @@ access_login_mng_allowed(const char *user)
|
||||
|
||||
if (g_cfg->sec.ts_admins == gid)
|
||||
{
|
||||
LOG_DBG("[MNG] ts_users is user's primary group");
|
||||
LOG(LOG_LEVEL_INFO, "[MNG] ts_users is user's primary group");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ xrdp_chansrv_SOURCES = \
|
||||
fifo.h \
|
||||
irp.c \
|
||||
irp.h \
|
||||
mlog.h \
|
||||
rail.c \
|
||||
rail.h \
|
||||
smartcard.c \
|
||||
|
@ -118,7 +118,7 @@ audin_send_version(int chan_id)
|
||||
int bytes;
|
||||
struct stream *s;
|
||||
|
||||
LOG(0, ("audin_send_version:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_send_version:");
|
||||
make_stream(s);
|
||||
init_stream(s, 32);
|
||||
out_uint8(s, MSG_SNDIN_VERSION);
|
||||
@ -141,7 +141,7 @@ audin_send_formats(int chan_id)
|
||||
struct stream *s;
|
||||
struct xr_wave_format_ex *wf;
|
||||
|
||||
LOG(0, ("audin_send_formats:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_send_formats:");
|
||||
num_formats = sizeof(g_server_formats) /
|
||||
sizeof(g_server_formats[0]) - 1;
|
||||
make_stream(s);
|
||||
@ -152,9 +152,9 @@ audin_send_formats(int chan_id)
|
||||
for (index = 0; index < num_formats; index++)
|
||||
{
|
||||
wf = g_server_formats[index];
|
||||
LOG(0, ("audin_send_formats: sending format wFormatTag 0x%4.4x "
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_send_formats: sending format wFormatTag 0x%4.4x "
|
||||
"nChannels %d nSamplesPerSec %d",
|
||||
wf->wFormatTag, wf->nChannels, wf->nSamplesPerSec));
|
||||
wf->wFormatTag, wf->nChannels, wf->nSamplesPerSec);
|
||||
out_uint16_le(s, wf->wFormatTag);
|
||||
out_uint16_le(s, wf->nChannels);
|
||||
out_uint32_le(s, wf->nSamplesPerSec);
|
||||
@ -183,7 +183,7 @@ audin_send_open(int chan_id)
|
||||
struct stream *s;
|
||||
struct xr_wave_format_ex *wf;
|
||||
|
||||
LOG(0, ("audin_send_open:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_send_open:");
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
out_uint8(s, MSG_SNDIN_OPEN);
|
||||
@ -215,14 +215,14 @@ audin_process_version(int chan_id, struct stream *s)
|
||||
{
|
||||
int version;
|
||||
|
||||
LOG(0, ("audin_process_version:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_process_version:");
|
||||
if (!s_check_rem(s, 4))
|
||||
{
|
||||
LOG(0, ("audin_process_version: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_version: parse error");
|
||||
return 1;
|
||||
}
|
||||
in_uint32_le(s, version);
|
||||
LOG(0, ("audin_process_version: version %d", version));
|
||||
LOG(LOG_LEVEL_INFO, "audin_process_version: version %d", version);
|
||||
return audin_send_formats(chan_id);
|
||||
}
|
||||
|
||||
@ -234,11 +234,11 @@ audin_process_formats(int chan_id, struct stream *s)
|
||||
int num_formats;
|
||||
struct xr_wave_format_ex *wf;
|
||||
|
||||
LOG(0, ("audin_process_formats:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_process_formats:");
|
||||
cleanup_client_formats();
|
||||
if (!s_check_rem(s, 8))
|
||||
{
|
||||
LOG(0, ("audin_process_formats: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_formats: parse error");
|
||||
return 1;
|
||||
}
|
||||
in_uint32_le(s, num_formats);
|
||||
@ -248,7 +248,7 @@ audin_process_formats(int chan_id, struct stream *s)
|
||||
{
|
||||
if (!s_check_rem(s, 18))
|
||||
{
|
||||
LOG(0, ("audin_process_formats: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_formats: parse error");
|
||||
return 1;
|
||||
}
|
||||
wf = g_new0(struct xr_wave_format_ex, 1);
|
||||
@ -260,14 +260,14 @@ audin_process_formats(int chan_id, struct stream *s)
|
||||
in_uint16_le(s, wf->nBlockAlign);
|
||||
in_uint16_le(s, wf->wBitsPerSample);
|
||||
in_uint16_le(s, wf->cbSize);
|
||||
LOG(0, ("audin_process_formats: recved format wFormatTag 0x%4.4x "
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_process_formats: recved format wFormatTag 0x%4.4x "
|
||||
"nChannels %d nSamplesPerSec %d",
|
||||
wf->wFormatTag, wf->nChannels, wf->nSamplesPerSec));
|
||||
wf->wFormatTag, wf->nChannels, wf->nSamplesPerSec);
|
||||
if (wf->cbSize > 0)
|
||||
{
|
||||
if (!s_check_rem(s, wf->cbSize))
|
||||
{
|
||||
LOG(0, ("audin_process_formats: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_formats: parse error");
|
||||
return 1;
|
||||
}
|
||||
wf->data = g_new0(uint8_t, wf->cbSize);
|
||||
@ -286,11 +286,11 @@ audin_process_open_reply(int chan_id, struct stream *s)
|
||||
|
||||
if (!s_check_rem(s, 4))
|
||||
{
|
||||
LOG(0, ("audin_process_open_reply: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_open_reply: parse error");
|
||||
return 1;
|
||||
}
|
||||
in_uint32_le(s, result);
|
||||
LOG(0, ("audin_process_open_reply: result 0x%8.8x", result));
|
||||
LOG(LOG_LEVEL_INFO, "audin_process_open_reply: result 0x%8.8x", result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ audin_process_open_reply(int chan_id, struct stream *s)
|
||||
static int
|
||||
audin_process_incoming_data(int chan_id, struct stream *s)
|
||||
{
|
||||
LOG(10, ("audin_process_incoming_data:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_process_incoming_data:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ audin_process_data(int chan_id, struct stream *s)
|
||||
struct stream *ls;
|
||||
|
||||
data_bytes = (int) (s->end - s->p);
|
||||
LOG(10, ("audin_process_data: data_bytes %d", data_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_process_data: data_bytes %d", data_bytes);
|
||||
|
||||
xstream_new(ls, data_bytes);
|
||||
g_memcpy(ls->data, s->p, data_bytes);
|
||||
@ -326,15 +326,15 @@ audin_process_data(int chan_id, struct stream *s)
|
||||
static int
|
||||
audin_process_format_change(int chan_id, struct stream *s)
|
||||
{
|
||||
LOG(0, ("audin_process_format_change:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_process_format_change:");
|
||||
if (!s_check_rem(s, 4))
|
||||
{
|
||||
LOG(0, ("audin_process_format_change: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_format_change: parse error");
|
||||
return 1;
|
||||
}
|
||||
in_uint32_le(s, g_current_format);
|
||||
LOG(0, ("audin_process_format_change: g_current_format %d",
|
||||
g_current_format));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_process_format_change: g_current_format %d",
|
||||
g_current_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -344,14 +344,14 @@ audin_process_msg(int chan_id, struct stream *s)
|
||||
{
|
||||
int code;
|
||||
|
||||
LOG(10, ("audin_process_msg:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_process_msg:");
|
||||
if (!s_check_rem(s, 1))
|
||||
{
|
||||
LOG(0, ("audin_process_msg: parse error"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_msg: parse error");
|
||||
return 1;
|
||||
}
|
||||
in_uint8(s, code);
|
||||
LOG(10, ("audin_process_msg: code %d", code));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_process_msg: code %d", code);
|
||||
switch (code)
|
||||
{
|
||||
case MSG_SNDIN_VERSION:
|
||||
@ -367,7 +367,7 @@ audin_process_msg(int chan_id, struct stream *s)
|
||||
case MSG_SNDIN_FORMATCHANGE:
|
||||
return audin_process_format_change(chan_id, s);
|
||||
default:
|
||||
LOG(0, ("audin_process_msg: unprocessed code %d", code));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_process_msg: unprocessed code %d", code);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@ -377,7 +377,7 @@ audin_process_msg(int chan_id, struct stream *s)
|
||||
static int
|
||||
audin_open_response(int chan_id, int creation_status)
|
||||
{
|
||||
LOG(0, ("audin_open_response: creation_status 0x%8.8x", creation_status));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_open_response: creation_status 0x%8.8x", creation_status);
|
||||
if (creation_status == 0)
|
||||
{
|
||||
return audin_send_version(chan_id);
|
||||
@ -389,7 +389,7 @@ audin_open_response(int chan_id, int creation_status)
|
||||
static int
|
||||
audin_close_response(int chan_id)
|
||||
{
|
||||
LOG(0, ("audin_close_response:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_close_response:");
|
||||
g_audin_chanid = 0;
|
||||
cleanup_client_formats();
|
||||
free_stream(g_in_s);
|
||||
@ -402,13 +402,12 @@ static int
|
||||
audin_data_fragment(int chan_id, char *data, int bytes)
|
||||
{
|
||||
int rv;
|
||||
int left;
|
||||
|
||||
LOG(10, ("audin_data_fragment:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_data_fragment:");
|
||||
if (!s_check_rem(g_in_s, bytes))
|
||||
{
|
||||
left = (int) (g_in_s->end - g_in_s->p);
|
||||
LOG(0, ("audin_data_fragment: error bytes %d left %d", bytes, left));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_data_fragment: error bytes %d left %d",
|
||||
bytes, (int) (g_in_s->end - g_in_s->p));
|
||||
return 1;
|
||||
}
|
||||
out_uint8a(g_in_s, data, bytes);
|
||||
@ -427,10 +426,10 @@ audin_data_fragment(int chan_id, char *data, int bytes)
|
||||
static int
|
||||
audin_data_first(int chan_id, char *data, int bytes, int total_bytes)
|
||||
{
|
||||
LOG(10, ("audin_data_first:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_data_first:");
|
||||
if (g_in_s != NULL)
|
||||
{
|
||||
LOG(0, ("audin_data_first: warning g_in_s is not nil"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_data_first: warning g_in_s is not nil");
|
||||
free_stream(g_in_s);
|
||||
}
|
||||
make_stream(g_in_s);
|
||||
@ -445,7 +444,7 @@ audin_data(int chan_id, char *data, int bytes)
|
||||
{
|
||||
struct stream ls;
|
||||
|
||||
LOG(10, ("audin_data:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "audin_data:");
|
||||
//g_hexdump(data, bytes);
|
||||
if (g_in_s == NULL)
|
||||
{
|
||||
@ -462,7 +461,7 @@ audin_data(int chan_id, char *data, int bytes)
|
||||
int
|
||||
audin_init(void)
|
||||
{
|
||||
LOG(0, ("audin_init:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_init:");
|
||||
g_memset(&g_audin_info, 0, sizeof(g_audin_info));
|
||||
g_audin_info.open_response = audin_open_response;
|
||||
g_audin_info.close_response = audin_close_response;
|
||||
@ -477,7 +476,7 @@ audin_init(void)
|
||||
int
|
||||
audin_deinit(void)
|
||||
{
|
||||
LOG(0, ("audin_deinit:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_deinit:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -488,7 +487,7 @@ audin_start(void)
|
||||
int error;
|
||||
struct stream* s;
|
||||
|
||||
LOG(0, ("audin_start:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_start:");
|
||||
if (g_audin_chanid != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -504,7 +503,7 @@ audin_start(void)
|
||||
error = chansrv_drdynvc_open(AUDIN_NAME, AUDIN_FLAGS,
|
||||
&g_audin_info, /* callback functions */
|
||||
&g_audin_chanid); /* chansrv chan_id */
|
||||
LOG(0, ("audin_start: error %d g_audin_chanid %d", error, g_audin_chanid));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "audin_start: error %d g_audin_chanid %d", error, g_audin_chanid);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -512,7 +511,7 @@ audin_start(void)
|
||||
int
|
||||
audin_stop(void)
|
||||
{
|
||||
LOG(0, ("audin_stop:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "audin_stop:");
|
||||
chansrv_drdynvc_close(g_audin_chanid);
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ add_timeout(int msoffset, void (*callback)(void *data), void *data)
|
||||
struct timeout_obj *tobj;
|
||||
tui32 now;
|
||||
|
||||
LOG(10, ("add_timeout:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "add_timeout:");
|
||||
now = g_time3();
|
||||
tobj = g_new0(struct timeout_obj, 1);
|
||||
tobj->mstime = now + msoffset;
|
||||
@ -149,7 +149,7 @@ get_timeout(int *timeout)
|
||||
tui32 now;
|
||||
int ltimeout;
|
||||
|
||||
LOG(10, ("get_timeout:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "get_timeout:");
|
||||
ltimeout = *timeout;
|
||||
if (ltimeout < 1)
|
||||
{
|
||||
@ -161,7 +161,7 @@ get_timeout(int *timeout)
|
||||
now = g_time3();
|
||||
while (tobj != 0)
|
||||
{
|
||||
LOG(10, (" now %u tobj->mstime %u", now, tobj->mstime));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " now %u tobj->mstime %u", now, tobj->mstime);
|
||||
if (now < tobj->mstime)
|
||||
{
|
||||
ltimeout = tobj->mstime - now;
|
||||
@ -171,7 +171,7 @@ get_timeout(int *timeout)
|
||||
}
|
||||
if (ltimeout > 0)
|
||||
{
|
||||
LOG(10, (" ltimeout %d", ltimeout));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " ltimeout %d", ltimeout);
|
||||
if (*timeout < 1)
|
||||
{
|
||||
*timeout = ltimeout;
|
||||
@ -197,7 +197,7 @@ check_timeout(void)
|
||||
int count;
|
||||
tui32 now;
|
||||
|
||||
LOG(10, ("check_timeout:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "check_timeout:");
|
||||
count = 0;
|
||||
tobj = g_timeout_head;
|
||||
if (tobj != 0)
|
||||
@ -237,7 +237,7 @@ check_timeout(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG(10, (" count %d", count));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " count %d", count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ send_channel_data(int chan_id, const char *data, int size)
|
||||
int
|
||||
send_rail_drawing_orders(char* data, int size)
|
||||
{
|
||||
LOGM((LOG_LEVEL_DEBUG, "chansrv::send_rail_drawing_orders: size %d", size));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::send_rail_drawing_orders: size %d", size);
|
||||
|
||||
struct stream* s;
|
||||
int error;
|
||||
@ -349,10 +349,10 @@ process_message_channel_setup(struct stream *s)
|
||||
g_rdpsnd_chan_id = -1;
|
||||
g_rdpdr_chan_id = -1;
|
||||
g_rail_chan_id = -1;
|
||||
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_channel_setup:");
|
||||
in_uint16_le(s, num_chans);
|
||||
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d",
|
||||
num_chans));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_channel_setup: num_chans %d",
|
||||
num_chans);
|
||||
|
||||
for (index = 0; index < num_chans; index++)
|
||||
{
|
||||
@ -361,11 +361,8 @@ process_message_channel_setup(struct stream *s)
|
||||
in_uint8a(s, ci->name, 8);
|
||||
in_uint16_le(s, ci->id);
|
||||
in_uint16_le(s, ci->flags);
|
||||
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' "
|
||||
"id %d flags %8.8x", ci->name, ci->id, ci->flags));
|
||||
|
||||
g_writeln("process_message_channel_setup: chan name '%s' "
|
||||
"id %d flags %8.8x", ci->name, ci->id, ci->flags);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_channel_setup: chan name '%s' "
|
||||
"id %d flags %8.8x", ci->name, ci->id, ci->flags);
|
||||
|
||||
if (g_strcasecmp(ci->name, "cliprdr") == 0)
|
||||
{
|
||||
@ -390,7 +387,7 @@ process_message_channel_setup(struct stream *s)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(10, ("other %s", ci->name));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "other %s", ci->name);
|
||||
}
|
||||
|
||||
g_num_chan_items++;
|
||||
@ -445,9 +442,8 @@ process_message_channel_data(struct stream *s)
|
||||
in_uint16_le(s, chan_flags);
|
||||
in_uint16_le(s, length);
|
||||
in_uint32_le(s, total_length);
|
||||
LOGM((LOG_LEVEL_DEBUG, "process_message_channel_data: chan_id %d "
|
||||
"chan_flags %d", chan_id, chan_flags));
|
||||
LOG(10, ("process_message_channel_data"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_channel_data: chan_id %d "
|
||||
"chan_flags %d", chan_id, chan_flags);
|
||||
rv = 0;
|
||||
|
||||
if (rv == 0)
|
||||
@ -500,7 +496,7 @@ process_message_channel_data(struct stream *s)
|
||||
}
|
||||
if (found == 0)
|
||||
{
|
||||
LOG(0, ("process_message_channel_data: not found channel %d", chan_id));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "process_message_channel_data: not found channel %d", chan_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -518,7 +514,7 @@ process_message_drdynvc_open_response(struct stream *s)
|
||||
int chan_id;
|
||||
int creation_status;
|
||||
|
||||
LOG(10, ("process_message_drdynvc_open_response:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_drdynvc_open_response:");
|
||||
if (!s_check_rem(s, 8))
|
||||
{
|
||||
return 1;
|
||||
@ -532,7 +528,7 @@ process_message_drdynvc_open_response(struct stream *s)
|
||||
drdynvc = g_drdynvcs + chan_id;
|
||||
if (drdynvc->status != CHANSRV_DRDYNVC_STATUS_OPEN_SENT)
|
||||
{
|
||||
g_writeln("process_message_drdynvc_open_response: status not right");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "process_message_drdynvc_open_response: status not right");
|
||||
return 1;
|
||||
}
|
||||
if (creation_status == 0)
|
||||
@ -562,7 +558,7 @@ process_message_drdynvc_close_response(struct stream *s)
|
||||
struct chansrv_drdynvc *drdynvc;
|
||||
int chan_id;
|
||||
|
||||
LOG(10, ("process_message_drdynvc_close_response:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_drdynvc_close_response:");
|
||||
if (!s_check_rem(s, 4))
|
||||
{
|
||||
return 1;
|
||||
@ -575,7 +571,7 @@ process_message_drdynvc_close_response(struct stream *s)
|
||||
drdynvc = g_drdynvcs + chan_id;
|
||||
if (drdynvc->status != CHANSRV_DRDYNVC_STATUS_CLOSE_SENT)
|
||||
{
|
||||
g_writeln("process_message_drdynvc_close_response: status not right");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "process_message_drdynvc_close_response: status not right");
|
||||
return 0;
|
||||
}
|
||||
drdynvc->status = CHANSRV_DRDYNVC_STATUS_CLOSED;
|
||||
@ -601,7 +597,7 @@ process_message_drdynvc_data_first(struct stream *s)
|
||||
int total_bytes;
|
||||
char *data;
|
||||
|
||||
LOG(10, ("process_message_drdynvc_data_first:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_drdynvc_data_first:");
|
||||
if (!s_check_rem(s, 12))
|
||||
{
|
||||
return 1;
|
||||
@ -640,7 +636,7 @@ process_message_drdynvc_data(struct stream *s)
|
||||
int bytes;
|
||||
char *data;
|
||||
|
||||
LOG(10, ("process_message_drdynvc_data:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "process_message_drdynvc_data:");
|
||||
if (!s_check_rem(s, 8))
|
||||
{
|
||||
return 1;
|
||||
@ -747,7 +743,7 @@ chansrv_drdynvc_data_first(int chan_id, const char *data, int data_bytes,
|
||||
struct stream *s;
|
||||
int error;
|
||||
|
||||
//g_writeln("chansrv_drdynvc_data_first: data_bytes %d total_data_bytes %d",
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv_drdynvc_data_first: data_bytes %d total_data_bytes %d",
|
||||
// data_bytes, total_data_bytes);
|
||||
s = trans_get_out_s(g_con_trans, 8192);
|
||||
if (s == NULL)
|
||||
@ -774,7 +770,7 @@ chansrv_drdynvc_data(int chan_id, const char *data, int data_bytes)
|
||||
struct stream *s;
|
||||
int error;
|
||||
|
||||
//g_writeln("chansrv_drdynvc_data: data_bytes %d", data_bytes);
|
||||
// LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv_drdynvc_data: data_bytes %d", data_bytes);
|
||||
s = trans_get_out_s(g_con_trans, 8192);
|
||||
if (s == NULL)
|
||||
{
|
||||
@ -798,7 +794,7 @@ chansrv_drdynvc_send_data(int chan_id, const char *data, int data_bytes)
|
||||
{
|
||||
int this_send_bytes;
|
||||
|
||||
//g_writeln("chansrv_drdynvc_send_data: data_bytes %d", data_bytes);
|
||||
// LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv_drdynvc_send_data: data_bytes %d", data_bytes);
|
||||
if (data_bytes > 1590)
|
||||
{
|
||||
if (chansrv_drdynvc_data_first(chan_id, data, 1590, data_bytes) != 0)
|
||||
@ -874,7 +870,7 @@ process_message(void)
|
||||
rv = process_message_drdynvc_data(s);
|
||||
break;
|
||||
default:
|
||||
LOGM((LOG_LEVEL_ERROR, "process_message: unknown msg %d", id));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "process_message: unknown msg %d", id);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -909,7 +905,7 @@ my_trans_data_in(struct trans *trans)
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOGM((LOG_LEVEL_DEBUG, "my_trans_data_in:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "my_trans_data_in:");
|
||||
s = trans_get_in_s(trans);
|
||||
in_uint8s(s, 4); /* id */
|
||||
in_uint32_le(s, size);
|
||||
@ -1054,7 +1050,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
char chan_name[MAX(CHANNEL_NAME_LEN, MAX_PATH) + 1];
|
||||
unsigned int channel_name_bytes;
|
||||
|
||||
//g_writeln("my_api_trans_data_in: extra_flags %d", trans->extra_flags);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: extra_flags %d", trans->extra_flags);
|
||||
rv = 0;
|
||||
ad = (struct xrdp_api_data *) (trans->callback_data);
|
||||
s = trans_get_in_s(trans);
|
||||
@ -1062,7 +1058,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
{
|
||||
in_uint32_le(s, bytes);
|
||||
in_uint32_le(s, ver);
|
||||
//g_writeln("my_api_trans_data_in: bytes %d ver %d", bytes, ver);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: bytes %d ver %d", bytes, ver);
|
||||
if (ver != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -1074,7 +1070,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
{
|
||||
rv = 1;
|
||||
in_uint32_le(s, channel_name_bytes);
|
||||
//g_writeln("my_api_trans_data_in: channel_name_bytes %d", channel_name_bytes);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: channel_name_bytes %d", channel_name_bytes);
|
||||
if (channel_name_bytes > (sizeof(chan_name) - 1))
|
||||
{
|
||||
return 1;
|
||||
@ -1083,7 +1079,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
chan_name[channel_name_bytes] = '\0';
|
||||
|
||||
in_uint32_le(s, ad->chan_flags);
|
||||
//g_writeln("my_api_trans_data_in: chan_name %s chan_flags 0x%8.8x", chan_name, ad->chan_flags);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: chan_name %s chan_flags 0x%8.8x", chan_name, ad->chan_flags);
|
||||
if (ad->chan_flags == 0)
|
||||
{
|
||||
/* SVC */
|
||||
@ -1137,7 +1133,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
procs.data = my_api_data;
|
||||
rv = chansrv_drdynvc_open(chan_name, ad->chan_flags,
|
||||
&procs, &(ad->chan_id));
|
||||
//g_writeln("my_api_trans_data_in: chansrv_drdynvc_open rv %d "
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: chansrv_drdynvc_open rv %d "
|
||||
// "chan_id %d", rv, ad->chan_id);
|
||||
g_drdynvcs[ad->chan_id].xrdp_api_trans = trans;
|
||||
}
|
||||
@ -1150,7 +1146,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
bytes = g_sck_recv(trans->sck, s->data, s->size, 0);
|
||||
if (bytes < 1)
|
||||
{
|
||||
//g_writeln("my_api_trans_data_in: disconnect");
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: disconnect");
|
||||
return 1;
|
||||
}
|
||||
if (ad->chan_flags == 0)
|
||||
@ -1161,7 +1157,7 @@ my_api_trans_data_in(struct trans *trans)
|
||||
else
|
||||
{
|
||||
/* DVS */
|
||||
//g_writeln("my_api_trans_data_in: s->size %d bytes %d", s->size, bytes);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_data_in: s->size %d bytes %d", s->size, bytes);
|
||||
rv = chansrv_drdynvc_send_data(ad->chan_id, s->data, bytes);
|
||||
}
|
||||
init_stream(s, 0);
|
||||
@ -1193,7 +1189,7 @@ my_trans_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOGM((LOG_LEVEL_DEBUG, "my_trans_conn_in:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "my_trans_conn_in:");
|
||||
g_con_trans = new_trans;
|
||||
g_con_trans->trans_data_in = my_trans_data_in;
|
||||
g_con_trans->header_size = 8;
|
||||
@ -1212,10 +1208,10 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
{
|
||||
struct xrdp_api_data *ad;
|
||||
|
||||
//g_writeln("my_api_trans_conn_in:");
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "my_api_trans_conn_in:");
|
||||
if ((trans == NULL) || (trans != g_api_lis_trans) || (new_trans == NULL))
|
||||
{
|
||||
g_writeln("my_api_trans_conn_in: error");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "my_api_trans_conn_in: error");
|
||||
return 1;
|
||||
}
|
||||
new_trans->trans_data_in = my_api_trans_data_in;
|
||||
@ -1224,7 +1220,7 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
ad = g_new0(struct xrdp_api_data, 1);
|
||||
if (ad == NULL)
|
||||
{
|
||||
g_writeln("my_api_trans_conn_in: error");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "my_api_trans_conn_in: error");
|
||||
return 1;
|
||||
}
|
||||
new_trans->callback_data = ad;
|
||||
@ -1262,8 +1258,8 @@ setup_listen(void)
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "setup_listen: trans_listen failed for port %s",
|
||||
port));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "setup_listen: trans_listen failed for port %s",
|
||||
port);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1285,8 +1281,8 @@ setup_api_listen(void)
|
||||
|
||||
if (error != 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "setup_api_listen: trans_listen failed for port %s",
|
||||
port));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "setup_api_listen: trans_listen failed for port %s",
|
||||
port);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1395,7 +1391,7 @@ channel_thread_loop(void *in_val)
|
||||
int error;
|
||||
THREAD_RV rv;
|
||||
|
||||
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: thread start"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "channel_thread_loop: thread start");
|
||||
rv = 0;
|
||||
g_api_con_trans_list = list_create();
|
||||
setup_api_listen();
|
||||
@ -1417,7 +1413,7 @@ channel_thread_loop(void *in_val)
|
||||
check_timeout();
|
||||
if (g_is_wait_obj_set(g_term_event))
|
||||
{
|
||||
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: g_term_event set"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "channel_thread_loop: g_term_event set");
|
||||
clipboard_deinit();
|
||||
sound_deinit();
|
||||
devredir_deinit();
|
||||
@ -1429,8 +1425,8 @@ channel_thread_loop(void *in_val)
|
||||
{
|
||||
if (trans_check_wait_objs(g_lis_trans) != 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: "
|
||||
"trans_check_wait_objs error"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "channel_thread_loop: "
|
||||
"trans_check_wait_objs error");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1438,8 +1434,8 @@ channel_thread_loop(void *in_val)
|
||||
{
|
||||
if (trans_check_wait_objs(g_con_trans) != 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: "
|
||||
"trans_check_wait_objs error resetting"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "channel_thread_loop: "
|
||||
"trans_check_wait_objs error resetting");
|
||||
clipboard_deinit();
|
||||
sound_deinit();
|
||||
devredir_deinit();
|
||||
@ -1461,7 +1457,7 @@ channel_thread_loop(void *in_val)
|
||||
{
|
||||
if (trans_check_wait_objs(g_api_lis_trans) != 0)
|
||||
{
|
||||
LOG(0, ("channel_thread_loop: trans_check_wait_objs failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "channel_thread_loop: trans_check_wait_objs failed");
|
||||
}
|
||||
}
|
||||
/* check the wait_objs in g_api_con_trans_list */
|
||||
@ -1501,7 +1497,7 @@ channel_thread_loop(void *in_val)
|
||||
g_api_lis_trans = 0;
|
||||
api_con_trans_list_remove_all();
|
||||
list_delete(g_api_con_trans_list);
|
||||
LOGM((LOG_LEVEL_INFO, "channel_thread_loop: thread stop"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "channel_thread_loop: thread stop");
|
||||
g_set_wait_obj(g_thread_done_event);
|
||||
return rv;
|
||||
}
|
||||
@ -1510,7 +1506,7 @@ channel_thread_loop(void *in_val)
|
||||
void
|
||||
term_signal_handler(int sig)
|
||||
{
|
||||
LOGM((LOG_LEVEL_INFO, "term_signal_handler: got signal %d", sig));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "term_signal_handler: got signal %d", sig);
|
||||
g_set_wait_obj(g_term_event);
|
||||
}
|
||||
|
||||
@ -1518,7 +1514,7 @@ term_signal_handler(int sig)
|
||||
void
|
||||
nil_signal_handler(int sig)
|
||||
{
|
||||
LOGM((LOG_LEVEL_INFO, "nil_signal_handler: got signal %d", sig));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "nil_signal_handler: got signal %d", sig);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -1527,14 +1523,14 @@ child_signal_handler(int sig)
|
||||
{
|
||||
int pid;
|
||||
|
||||
LOG(0, ("child_signal_handler:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "child_signal_handler:");
|
||||
do
|
||||
{
|
||||
pid = g_waitchild();
|
||||
LOG(0, ("child_signal_handler: child pid %d", pid));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "child_signal_handler: child pid %d", pid);
|
||||
if ((pid == g_exec_pid) && (pid > 0))
|
||||
{
|
||||
LOG(0, ("child_signal_handler: found pid %d", pid));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "child_signal_handler: found pid %d", pid);
|
||||
//shutdownx();
|
||||
}
|
||||
}
|
||||
@ -1545,7 +1541,7 @@ child_signal_handler(int sig)
|
||||
void
|
||||
segfault_signal_handler(int sig)
|
||||
{
|
||||
LOG(0, ("segfault_signal_handler: entered......."));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "segfault_signal_handler: entered.......");
|
||||
xfuse_deinit();
|
||||
exit(0);
|
||||
}
|
||||
@ -1554,7 +1550,7 @@ segfault_signal_handler(int sig)
|
||||
static void
|
||||
x_server_fatal_handler(void)
|
||||
{
|
||||
LOGM((LOG_LEVEL_INFO, "xserver_fatal_handler: entered......."));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "xserver_fatal_handler: entered.......");
|
||||
/* At this point the X server has gone away. Dont make any X calls. */
|
||||
xfuse_deinit();
|
||||
exit(0);
|
||||
@ -1695,41 +1691,13 @@ get_log_path(char *path, int bytes)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static enum logLevels
|
||||
get_log_level(const char* level_str, enum logLevels default_level)
|
||||
{
|
||||
static const char* levels[] = {
|
||||
"LOG_LEVEL_ALWAYS",
|
||||
"LOG_LEVEL_ERROR",
|
||||
"LOG_LEVEL_WARNING",
|
||||
"LOG_LEVEL_INFO",
|
||||
"LOG_LEVEL_DEBUG",
|
||||
"LOG_LEVEL_TRACE"
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
if (level_str == NULL || level_str[0] == 0)
|
||||
{
|
||||
return default_level;
|
||||
}
|
||||
for (i = 0; i < ARRAYSIZE(levels); ++i)
|
||||
{
|
||||
if (g_strcasecmp(levels[i], level_str) == 0)
|
||||
{
|
||||
return (enum logLevels) i;
|
||||
}
|
||||
}
|
||||
return default_level;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
run_exec(void)
|
||||
{
|
||||
int pid;
|
||||
|
||||
LOG(10, ("run_exec:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "run_exec:");
|
||||
pid = g_fork();
|
||||
|
||||
if (pid == 0)
|
||||
@ -1757,14 +1725,14 @@ main(int argc, char **argv)
|
||||
tbus waiters[4];
|
||||
int pid = 0;
|
||||
char text[256];
|
||||
const char *config_path;
|
||||
char log_path[256];
|
||||
char *display_text;
|
||||
char log_file[256];
|
||||
enum logReturns error;
|
||||
struct log_config logconfig;
|
||||
enum logLevels log_level;
|
||||
struct log_config *logconfig;
|
||||
g_init("xrdp-chansrv"); /* os_calls */
|
||||
|
||||
g_memset(g_drdynvcs, 0, sizeof(g_drdynvcs));
|
||||
|
||||
log_path[255] = 0;
|
||||
if (get_log_path(log_path, 255) != 0)
|
||||
@ -1777,7 +1745,8 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* The user is unable at present to override the sysadmin-provided
|
||||
* sesman.ini location */
|
||||
if ((g_cfg = config_read(0, XRDP_CFG_PATH "/sesman.ini")) == NULL)
|
||||
config_path = XRDP_CFG_PATH "/sesman.ini";
|
||||
if ((g_cfg = config_read(0, config_path)) == NULL)
|
||||
{
|
||||
main_cleanup();
|
||||
return 1;
|
||||
@ -1791,27 +1760,24 @@ main(int argc, char **argv)
|
||||
get_display_num_from_display(display_text);
|
||||
}
|
||||
|
||||
log_level = get_log_level(g_getenv("CHANSRV_LOG_LEVEL"), LOG_LEVEL_INFO);
|
||||
|
||||
/* starting logging subsystem */
|
||||
g_memset(&logconfig, 0, sizeof(struct log_config));
|
||||
logconfig.program_name = "xrdp-chansrv";
|
||||
g_snprintf(log_file, 255, "%s/xrdp-chansrv.%d.log", log_path, g_display_num);
|
||||
g_writeln("chansrv::main: using log file [%s]", log_file);
|
||||
|
||||
if (g_file_exist(log_file))
|
||||
{
|
||||
g_file_delete(log_file);
|
||||
}
|
||||
|
||||
g_memset(g_drdynvcs, 0, sizeof(g_drdynvcs));
|
||||
|
||||
logconfig.log_file = log_file;
|
||||
logconfig.fd = -1;
|
||||
logconfig.log_level = log_level;
|
||||
logconfig.enable_syslog = 0;
|
||||
logconfig.syslog_level = LOG_LEVEL_ALWAYS;
|
||||
error = log_start_from_param(&logconfig);
|
||||
logconfig = log_config_init_from_config(config_path, "xrdp-chansrv", "Chansrv");
|
||||
if (logconfig->log_file != NULL)
|
||||
{
|
||||
g_free(logconfig->log_file);
|
||||
}
|
||||
logconfig->log_file = log_file;
|
||||
error = log_start_from_param(logconfig);
|
||||
logconfig->log_file = NULL;
|
||||
log_config_free(logconfig);
|
||||
logconfig = NULL;
|
||||
|
||||
if (error != LOG_STARTUP_OK)
|
||||
{
|
||||
@ -1833,7 +1799,7 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOGM((LOG_LEVEL_ALWAYS, "main: app started pid %d(0x%8.8x)", pid, pid));
|
||||
LOG_DEVEL(LOG_LEVEL_ALWAYS, "main: app started pid %d(0x%8.8x)", pid, pid);
|
||||
/* set up signal handler */
|
||||
g_signal_terminate(term_signal_handler); /* SIGTERM */
|
||||
g_signal_user_interrupt(term_signal_handler); /* SIGINT */
|
||||
@ -1844,16 +1810,16 @@ main(int argc, char **argv)
|
||||
/* Cater for the X server exiting unexpectedly */
|
||||
xcommon_set_x_server_fatal_handler(x_server_fatal_handler);
|
||||
|
||||
LOGM((LOG_LEVEL_INFO, "main: DISPLAY env var set to %s", display_text));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "main: DISPLAY env var set to %s", display_text);
|
||||
|
||||
if (g_display_num == 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "main: error, display is zero"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "main: error, display is zero");
|
||||
main_cleanup();
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOGM((LOG_LEVEL_INFO, "main: using DISPLAY %d", g_display_num));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "main: using DISPLAY %d", g_display_num);
|
||||
g_snprintf(text, 255, "xrdp_chansrv_%8.8x_main_term", pid);
|
||||
g_term_event = g_create_wait_obj(text);
|
||||
g_snprintf(text, 255, "xrdp_chansrv_%8.8x_thread_done", pid);
|
||||
@ -1871,7 +1837,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (g_obj_wait(waiters, 2, 0, 0, 0) != 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "main: error, g_obj_wait failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "main: error, g_obj_wait failed");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1892,14 +1858,14 @@ main(int argc, char **argv)
|
||||
/* wait for thread to exit */
|
||||
if (g_obj_wait(&g_thread_done_event, 1, 0, 0, 0) != 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "main: error, g_obj_wait failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "main: error, g_obj_wait failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
main_cleanup();
|
||||
LOGM((LOG_LEVEL_INFO, "main: app exiting pid %d(0x%8.8x)", pid, pid));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "main: app exiting pid %d(0x%8.8x)", pid, pid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -39,19 +39,6 @@ int send_rail_drawing_orders(char* data, int size);
|
||||
int main_cleanup(void);
|
||||
int add_timeout(int msoffset, void (*callback)(void* data), void* data);
|
||||
|
||||
#define LOG_LEVEL 5
|
||||
|
||||
#define LOG(_a, _params) \
|
||||
{ \
|
||||
if (_a < LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("xrdp-chansrv [%10.10u]: ", g_time3()); \
|
||||
g_writeln _params ; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LOGM(_args) do { log_message _args ; } while (0)
|
||||
|
||||
#ifndef GSET_UINT8
|
||||
#define GSET_UINT8(_ptr, _offset, _data) \
|
||||
*((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))) = (unsigned char)(_data)
|
||||
|
@ -121,6 +121,7 @@ void xfuse_devredir_cb_file_close(struct state_close *fip)
|
||||
#include "clipboard_file.h"
|
||||
#include "chansrv_fuse.h"
|
||||
#include "chansrv_xfs.h"
|
||||
#include "chansrv.h"
|
||||
#include "chansrv_config.h"
|
||||
#include "devredir.h"
|
||||
#include "list.h"
|
||||
@ -133,48 +134,6 @@ void xfuse_devredir_cb_file_close(struct state_close *fip)
|
||||
#define XFUSE_ATTR_TIMEOUT 5.0
|
||||
#define XFUSE_ENTRY_TIMEOUT 5.0
|
||||
|
||||
/* module based logging */
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG 2
|
||||
#ifndef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
#define log_error(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: FUSE %s: %d : ERROR: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_always(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: FUSE %s: %d : ALWAYS: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_info(_params...) \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: FUSE %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define log_debug(_params...) \
|
||||
{ \
|
||||
if (LOG_DEBUG <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: FUSE %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/* Type of buffer used for fuse_add_direntry() calls */
|
||||
struct dirbuf1
|
||||
@ -472,13 +431,13 @@ xfuse_init(void)
|
||||
/* if already inited, just return */
|
||||
if (g_xfuse_inited)
|
||||
{
|
||||
log_debug("already inited");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "already inited");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (g_ch != 0)
|
||||
{
|
||||
log_error("g_ch is not zero");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "g_ch is not zero");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -493,7 +452,7 @@ xfuse_init(void)
|
||||
{
|
||||
if (!g_create_dir(g_fuse_root_path))
|
||||
{
|
||||
log_error("mkdir %s failed. If %s is already mounted, you must "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "mkdir %s failed. If %s is already mounted, you must "
|
||||
"first unmount it", g_fuse_root_path, g_fuse_root_path);
|
||||
return -1;
|
||||
}
|
||||
@ -650,7 +609,7 @@ int xfuse_create_share(tui32 device_id, const char *dirname)
|
||||
xinode = xfs_add_entry(g_xfs, FUSE_ROOT_ID, dirname, (0777 | S_IFDIR));
|
||||
if (xinode == NULL)
|
||||
{
|
||||
log_debug("xfs_add_entry() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xfs_add_entry() failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -703,24 +662,24 @@ int xfuse_clear_clip_dir(void)
|
||||
int
|
||||
xfuse_file_contents_range(int stream_id, const char *data, int data_bytes)
|
||||
{
|
||||
log_debug("entered: stream_id=%d data_bytes=%d", stream_id, data_bytes);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: stream_id=%d data_bytes=%d", stream_id, data_bytes);
|
||||
|
||||
struct req_list_item *rli;
|
||||
|
||||
if ((rli = (struct req_list_item *) list_get_item(g_req_list, 0)) == NULL)
|
||||
{
|
||||
log_error("range error!");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "range error!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_debug("lindex=%d off=%d size=%d", rli->lindex, rli->off, rli->size);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "lindex=%d off=%d size=%d", rli->lindex, rli->off, rli->size);
|
||||
|
||||
fuse_reply_buf(rli->req, data, data_bytes);
|
||||
|
||||
list_remove_item(g_req_list, 0);
|
||||
if (g_req_list->count <= 0)
|
||||
{
|
||||
log_debug("completed all requests");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "completed all requests");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -728,11 +687,11 @@ xfuse_file_contents_range(int stream_id, const char *data, int data_bytes)
|
||||
rli = (struct req_list_item *) list_get_item(g_req_list, 0);
|
||||
if (rli == NULL)
|
||||
{
|
||||
log_error("range error!");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "range error!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_debug("requesting clipboard file data");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "requesting clipboard file data");
|
||||
|
||||
clipboard_request_file_data(rli->stream_id, rli->lindex,
|
||||
rli->off, rli->size);
|
||||
@ -751,7 +710,7 @@ xfuse_file_contents_range(int stream_id, const char *data, int data_bytes)
|
||||
int
|
||||
xfuse_add_clip_dir_item(const char *filename, int flags, int size, int lindex)
|
||||
{
|
||||
log_debug("entered: filename=%s flags=%d size=%d lindex=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: filename=%s flags=%d size=%d lindex=%d",
|
||||
filename, flags, size, lindex);
|
||||
|
||||
/* add entry to xrdp_fs */
|
||||
@ -761,7 +720,7 @@ xfuse_add_clip_dir_item(const char *filename, int flags, int size, int lindex)
|
||||
(0666 | S_IFREG));
|
||||
if (xinode == NULL)
|
||||
{
|
||||
log_debug("failed to create file in xrdp filesystem");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "failed to create file in xrdp filesystem");
|
||||
return -1;
|
||||
}
|
||||
xinode->size = size;
|
||||
@ -778,7 +737,7 @@ xfuse_add_clip_dir_item(const char *filename, int flags, int size, int lindex)
|
||||
|
||||
int xfuse_file_contents_size(int stream_id, int file_size)
|
||||
{
|
||||
log_debug("entered: stream_id=%d file_size=%d", stream_id, file_size);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: stream_id=%d file_size=%d", stream_id, file_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -798,14 +757,14 @@ static int xfuse_init_lib(struct fuse_args *args)
|
||||
{
|
||||
if (fuse_parse_cmdline(args, &g_mount_point, 0, 0) < 0)
|
||||
{
|
||||
log_error("fuse_parse_cmdline() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "fuse_parse_cmdline() failed");
|
||||
fuse_opt_free_args(args);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((g_ch = fuse_mount(g_mount_point, args)) == 0)
|
||||
{
|
||||
log_error("fuse_mount() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "fuse_mount() failed");
|
||||
fuse_opt_free_args(args);
|
||||
return -1;
|
||||
}
|
||||
@ -813,7 +772,7 @@ static int xfuse_init_lib(struct fuse_args *args)
|
||||
g_se = fuse_lowlevel_new(args, &g_xfuse_ops, sizeof(g_xfuse_ops), 0);
|
||||
if (g_se == 0)
|
||||
{
|
||||
log_error("fuse_lowlevel_new() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "fuse_lowlevel_new() failed");
|
||||
fuse_unmount(g_mount_point, g_ch);
|
||||
g_ch = 0;
|
||||
fuse_opt_free_args(args);
|
||||
@ -852,7 +811,7 @@ static int xfuse_init_xrdp_fs(void)
|
||||
}
|
||||
else if ((g_xfs = xfs_create_xfs_fs(0, g_getuid(), g_getgid())) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -861,7 +820,7 @@ static int xfuse_init_xrdp_fs(void)
|
||||
(0777 | S_IFDIR));
|
||||
if (xino == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
xfs_delete_xfs_fs(g_xfs);
|
||||
g_xfs = NULL;
|
||||
}
|
||||
@ -912,7 +871,7 @@ void xfuse_devredir_cb_enum_dir_add_entry(
|
||||
|
||||
if (!xfs_get(g_xfs, fip->pinum))
|
||||
{
|
||||
log_error("inode %ld is not valid", fip->pinum);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", fip->pinum);
|
||||
}
|
||||
else if ((strcmp(name, ".") == 0) ||
|
||||
(strcmp(name, "..") == 0))
|
||||
@ -921,7 +880,7 @@ void xfuse_devredir_cb_enum_dir_add_entry(
|
||||
}
|
||||
else
|
||||
{
|
||||
log_debug("parent_inode=%ld name=%s", fip->pinum, name);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "parent_inode=%ld name=%s", fip->pinum, name);
|
||||
|
||||
/* Does the file already exist ? If it does it's important we
|
||||
* don't mess with it, as we're only enumerating the directory, and
|
||||
@ -931,12 +890,12 @@ void xfuse_devredir_cb_enum_dir_add_entry(
|
||||
if (xinode == NULL)
|
||||
{
|
||||
/* Add a new node to the file system */
|
||||
log_debug("Creating name=%s in parent=%ld in xrdp_fs",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Creating name=%s in parent=%ld in xrdp_fs",
|
||||
name, fip->pinum);
|
||||
xinode = xfs_add_entry(g_xfs, fip->pinum, name, fattr->mode);
|
||||
if (xinode == NULL)
|
||||
{
|
||||
log_error("xfs_add_entry() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "xfs_add_entry() failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -961,7 +920,7 @@ void xfuse_devredir_cb_enum_dir_add_entry(
|
||||
void xfuse_devredir_cb_enum_dir_done(struct state_dirscan *fip,
|
||||
enum NTSTATUS IoStatus)
|
||||
{
|
||||
log_debug("fip=%p IoStatus=0x%x", fip, IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "fip=%p IoStatus=0x%x", fip, IoStatus);
|
||||
|
||||
/*
|
||||
* STATUS_NO_SUCH_FILE is returned for empty directories
|
||||
@ -981,7 +940,7 @@ void xfuse_devredir_cb_enum_dir_done(struct state_dirscan *fip,
|
||||
}
|
||||
else if (!xfs_get(g_xfs, fip->pinum))
|
||||
{
|
||||
log_error("inode %ld is not valid", fip->pinum);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", fip->pinum);
|
||||
fuse_reply_err(fip->req, ENOENT);
|
||||
}
|
||||
else
|
||||
@ -1045,19 +1004,19 @@ void xfuse_devredir_cb_lookup_entry(struct state_lookup *fip,
|
||||
break;
|
||||
|
||||
default:
|
||||
log_info("Error code %08x - fallthrough", (int) IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "Error code %08x - fallthrough", (int) IoStatus);
|
||||
fuse_reply_err(fip->req, EIO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!xfs_get(g_xfs, fip->pinum))
|
||||
{
|
||||
log_error("parent inode %ld is not valid", fip->pinum);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "parent inode %ld is not valid", fip->pinum);
|
||||
fuse_reply_err(fip->req, ENOENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_debug("parent_inode=%ld name=%s", fip->pinum, fip->name);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "parent_inode=%ld name=%s", fip->pinum, fip->name);
|
||||
|
||||
/* Does the file already exist ? */
|
||||
xinode = xfs_lookup_in_dir(g_xfs, fip->pinum, fip->name);
|
||||
@ -1067,7 +1026,7 @@ void xfuse_devredir_cb_lookup_entry(struct state_lookup *fip,
|
||||
if ((xinode->mode & (S_IFREG | S_IFDIR)) ==
|
||||
(file_info->mode & (S_IFREG | S_IFDIR)))
|
||||
{
|
||||
log_debug("inode=%ld name=%s already exists in xrdp_fs as %ld",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "inode=%ld name=%s already exists in xrdp_fs as %ld",
|
||||
fip->pinum, fip->name, xinode->inum);
|
||||
if (xfs_get_file_open_count(g_xfs, xinode->inum) > 0)
|
||||
{
|
||||
@ -1077,19 +1036,19 @@ void xfuse_devredir_cb_lookup_entry(struct state_lookup *fip,
|
||||
* would be truncating a file we're currently writing
|
||||
* to, as the lookup value for the size is stale.
|
||||
*/
|
||||
log_debug("inode=%ld is open - "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "inode=%ld is open - "
|
||||
"preferring local attributes", xinode->inum);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_debug("Updating attributes of inode=%ld", xinode->inum);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Updating attributes of inode=%ld", xinode->inum);
|
||||
update_inode_file_attributes(file_info, TO_SET_ALL, xinode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Type has changed from file to directory, or vice-versa */
|
||||
log_debug("inode=%ld name=%s of different type in xrdp_fs"
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "inode=%ld name=%s of different type in xrdp_fs"
|
||||
" - removing",
|
||||
fip->pinum, xinode->name);
|
||||
xfs_remove_entry(g_xfs, xinode->inum);
|
||||
@ -1100,13 +1059,13 @@ void xfuse_devredir_cb_lookup_entry(struct state_lookup *fip,
|
||||
if (xinode == NULL)
|
||||
{
|
||||
/* Add a new node to the file system */
|
||||
log_debug("Creating name=%s in parent=%ld in xrdp_fs",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Creating name=%s in parent=%ld in xrdp_fs",
|
||||
fip->name, fip->pinum);
|
||||
xinode = xfs_add_entry(g_xfs, fip->pinum, fip->name,
|
||||
file_info->mode);
|
||||
if (xinode == NULL)
|
||||
{
|
||||
log_debug("xfs_add_entry() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xfs_add_entry() failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1159,7 +1118,7 @@ void xfuse_devredir_cb_setattr(struct state_setattr *fip,
|
||||
break;
|
||||
|
||||
default:
|
||||
log_info("Error code %08x - fallthrough", (int) IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "Error code %08x - fallthrough", (int) IoStatus);
|
||||
fuse_reply_err(fip->req, EIO);
|
||||
break;
|
||||
}
|
||||
@ -1222,7 +1181,7 @@ void xfuse_devredir_cb_create_file(struct state_create *fip,
|
||||
if ((fip->mode & S_IFREG) != 0 && fh == NULL)
|
||||
{
|
||||
/* We failed to allocate a file handle */
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(fip->req, ENOMEM);
|
||||
}
|
||||
else
|
||||
@ -1253,7 +1212,7 @@ void xfuse_devredir_cb_create_file(struct state_create *fip,
|
||||
|
||||
if (xinode == NULL)
|
||||
{
|
||||
log_error("Out of memory!");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Out of memory!");
|
||||
fuse_reply_err(fip->req, ENOMEM);
|
||||
}
|
||||
else
|
||||
@ -1272,6 +1231,7 @@ void xfuse_devredir_cb_create_file(struct state_create *fip,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
free(fip);
|
||||
@ -1309,7 +1269,7 @@ void xfuse_devredir_cb_open_file(struct state_open *fip,
|
||||
/* Allocate an XFUSE_HANDLE for future file operations */
|
||||
if ((fh = xfuse_handle_create()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(fip->req, ENOMEM);
|
||||
}
|
||||
else
|
||||
@ -1320,7 +1280,7 @@ void xfuse_devredir_cb_open_file(struct state_open *fip,
|
||||
|
||||
fip->fi.fh = xfuse_handle_to_fuse_handle(fh);
|
||||
|
||||
log_debug("sending fuse_reply_open(); "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sending fuse_reply_open(); "
|
||||
"DeviceId=%d FileId=%d req=%p",
|
||||
fh->DeviceId, fh->FileId, fip->req);
|
||||
|
||||
@ -1340,7 +1300,7 @@ void xfuse_devredir_cb_read_file(struct state_read *fip,
|
||||
{
|
||||
if (IoStatus != STATUS_SUCCESS)
|
||||
{
|
||||
log_error("Read NTSTATUS is %d", (int) IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Read NTSTATUS is %d", (int) IoStatus);
|
||||
fuse_reply_err(fip->req, EIO);
|
||||
}
|
||||
else
|
||||
@ -1360,7 +1320,7 @@ void xfuse_devredir_cb_write_file(
|
||||
|
||||
if (IoStatus != STATUS_SUCCESS)
|
||||
{
|
||||
log_error("Write NTSTATUS is %d", (int) IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Write NTSTATUS is %d", (int) IoStatus);
|
||||
fuse_reply_err(fip->req, EIO);
|
||||
}
|
||||
else
|
||||
@ -1378,7 +1338,7 @@ void xfuse_devredir_cb_write_file(
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error("inode %ld is invalid", fip->inum);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is invalid", fip->inum);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1404,7 +1364,7 @@ void xfuse_devredir_cb_rmdir_or_file(struct state_remove *fip,
|
||||
break;
|
||||
|
||||
default:
|
||||
log_info("Error code %08x - fallthrough", (int) IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "Error code %08x - fallthrough", (int) IoStatus);
|
||||
fuse_reply_err(fip->req, EBADF);
|
||||
break;
|
||||
}
|
||||
@ -1456,7 +1416,7 @@ static void xfuse_cb_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
XFS_INODE *parent_xinode;
|
||||
XFS_INODE *xinode = NULL;
|
||||
|
||||
log_debug("looking for parent=%ld name=%s", parent, name);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "looking for parent=%ld name=%s", parent, name);
|
||||
|
||||
if (strlen(name) > XFS_MAXFILENAMELEN)
|
||||
{
|
||||
@ -1464,7 +1424,7 @@ static void xfuse_cb_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
}
|
||||
else if ((parent_xinode = xfs_get(g_xfs, parent)) == NULL)
|
||||
{
|
||||
log_error("inode %ld is not valid", parent);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", parent);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else
|
||||
@ -1474,7 +1434,7 @@ static void xfuse_cb_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
/* File cannot be remote - we either know about it or we don't */
|
||||
if ((xinode = xfs_lookup_in_dir(g_xfs, parent, name)) != NULL)
|
||||
{
|
||||
log_debug("found entry for parent=%ld name=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "found entry for parent=%ld name=%s",
|
||||
parent, name);
|
||||
make_fuse_entry_reply(req, xinode);
|
||||
}
|
||||
@ -1494,7 +1454,7 @@ static void xfuse_cb_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
|
||||
if (fip == NULL || full_path == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(fip);
|
||||
free(full_path);
|
||||
@ -1519,7 +1479,7 @@ static void xfuse_cb_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
fip->existing_inum = xinode->inum;
|
||||
fip->existing_generation = xinode->generation;
|
||||
}
|
||||
log_debug("Looking up %s in %s on %d", name, cptr,
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Looking up %s in %s on %d", name, cptr,
|
||||
parent_xinode->device_id);
|
||||
/*
|
||||
* If this call succeeds, further request processing happens in
|
||||
@ -1527,7 +1487,7 @@ static void xfuse_cb_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
|
||||
*/
|
||||
if (devredir_lookup_entry(fip, parent_xinode->device_id, cptr))
|
||||
{
|
||||
log_error("failed to send devredir_lookup_entry() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_lookup_entry() cmd");
|
||||
fuse_reply_err(req, EREMOTEIO);
|
||||
free(fip);
|
||||
}
|
||||
@ -1549,12 +1509,12 @@ static void xfuse_cb_getattr(fuse_req_t req, fuse_ino_t ino,
|
||||
{
|
||||
XFS_INODE *xino;
|
||||
|
||||
log_debug("req=%p ino=%ld", req, ino);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "req=%p ino=%ld", req, ino);
|
||||
|
||||
/* if ino is not valid, just return */
|
||||
if ((xino = xfs_get(g_xfs, ino)) == NULL)
|
||||
{
|
||||
log_error("inode %ld is not valid", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", ino);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else
|
||||
@ -1620,12 +1580,12 @@ static void xfuse_cb_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
struct xfs_dir_handle *dh;
|
||||
struct dirbuf1 b;
|
||||
|
||||
log_debug("req=%p inode=%ld size=%zd offset=%lld", req, ino, size, (long long) off);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "req=%p inode=%ld size=%zd offset=%lld", req, ino, size, (long long) off);
|
||||
|
||||
/* On the first call, check the inode is valid */
|
||||
if (off == 0 && !xfs_get(g_xfs, ino))
|
||||
{
|
||||
log_error("inode %ld is not valid", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", ino);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else if ((xhandle = xfuse_handle_from_fuse_handle(fi->fh)) == NULL
|
||||
@ -1663,7 +1623,7 @@ static void xfuse_cb_mkdir(fuse_req_t req, fuse_ino_t parent,
|
||||
{
|
||||
XFS_INODE *xinode;
|
||||
|
||||
log_debug("entered: parent_inode=%ld name=%s", parent, name);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: parent_inode=%ld name=%s", parent, name);
|
||||
|
||||
if ((xinode = xfs_lookup_in_dir(g_xfs, parent, name)) != NULL)
|
||||
{
|
||||
@ -1687,7 +1647,7 @@ static void xfuse_cb_unlink(fuse_req_t req, fuse_ino_t parent,
|
||||
{
|
||||
XFS_INODE *xinode;
|
||||
|
||||
log_debug("entered: parent=%ld name=%s", parent, name);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: parent=%ld name=%s", parent, name);
|
||||
|
||||
if (strlen(name) > XFS_MAXFILENAMELEN)
|
||||
{
|
||||
@ -1695,14 +1655,14 @@ static void xfuse_cb_unlink(fuse_req_t req, fuse_ino_t parent,
|
||||
}
|
||||
else if ((xinode = xfs_lookup_in_dir(g_xfs, parent, name)) == NULL)
|
||||
{
|
||||
log_error("did not find file with pinode=%ld name=%s", parent, name);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "did not find file with pinode=%ld name=%s", parent, name);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
|
||||
else if ((xinode->mode & S_IFDIR) != 0 &&
|
||||
!xfs_is_dir_empty(g_xfs, xinode->inum))
|
||||
{
|
||||
log_debug("cannot rmdir; directory is not empty");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "cannot rmdir; directory is not empty");
|
||||
fuse_reply_err(req, ENOTEMPTY);
|
||||
}
|
||||
|
||||
@ -1711,7 +1671,7 @@ static void xfuse_cb_unlink(fuse_req_t req, fuse_ino_t parent,
|
||||
/* specified file is a local resource */
|
||||
//XFUSE_HANDLE *fh;
|
||||
|
||||
log_debug("LK_TODO: this is still a TODO");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "LK_TODO: this is still a TODO");
|
||||
fuse_reply_err(req, EROFS);
|
||||
}
|
||||
else
|
||||
@ -1721,7 +1681,7 @@ static void xfuse_cb_unlink(fuse_req_t req, fuse_ino_t parent,
|
||||
char *full_path = xfs_get_full_path(g_xfs, xinode->inum);
|
||||
if (!full_path || !fip)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(fip);
|
||||
}
|
||||
@ -1742,7 +1702,7 @@ static void xfuse_cb_unlink(fuse_req_t req, fuse_ino_t parent,
|
||||
*/
|
||||
if (devredir_rmdir_or_file(fip, xinode->device_id, cptr))
|
||||
{
|
||||
log_error("failed to send devredir_rmdir_or_file() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_rmdir_or_file() cmd");
|
||||
fuse_reply_err(req, EREMOTEIO);
|
||||
free(fip);
|
||||
}
|
||||
@ -1759,7 +1719,7 @@ static void xfuse_cb_rename(fuse_req_t req,
|
||||
XFS_INODE *old_xinode;
|
||||
XFS_INODE *new_parent_xinode;
|
||||
|
||||
log_debug("entered: old_parent=%ld old_name=%s new_parent=%ld new_name=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: old_parent=%ld old_name=%s new_parent=%ld new_name=%s",
|
||||
old_parent, old_name, new_parent, new_name);
|
||||
|
||||
if (strlen(old_name) > XFS_MAXFILENAMELEN ||
|
||||
@ -1769,14 +1729,14 @@ static void xfuse_cb_rename(fuse_req_t req,
|
||||
}
|
||||
else if (!(old_xinode = xfs_lookup_in_dir(g_xfs, old_parent, old_name)))
|
||||
{
|
||||
log_error("did not find file with pinode=%ld name=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "did not find file with pinode=%ld name=%s",
|
||||
old_parent, old_name);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
|
||||
else if (!(new_parent_xinode = xfs_get(g_xfs, new_parent)))
|
||||
{
|
||||
log_error("inode %ld is not valid", new_parent);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", new_parent);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
|
||||
@ -1796,7 +1756,7 @@ static void xfuse_cb_rename(fuse_req_t req,
|
||||
else if (!old_xinode->is_redirected)
|
||||
{
|
||||
/* specified file is a local resource */
|
||||
log_debug("LK_TODO: this is still a TODO");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "LK_TODO: this is still a TODO");
|
||||
fuse_reply_err(req, EROFS);
|
||||
}
|
||||
|
||||
@ -1810,7 +1770,7 @@ static void xfuse_cb_rename(fuse_req_t req,
|
||||
|
||||
if (!old_full_path || !new_full_path || !fip)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(fip);
|
||||
free(old_full_path);
|
||||
@ -1836,7 +1796,7 @@ static void xfuse_cb_rename(fuse_req_t req,
|
||||
*/
|
||||
if (devredir_file_rename(fip, old_xinode->device_id, cptr, cp))
|
||||
{
|
||||
log_error("failed to send devredir_file_rename() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_file_rename() cmd");
|
||||
fuse_reply_err(req, EREMOTEIO);
|
||||
free(fip);
|
||||
}
|
||||
@ -1863,7 +1823,7 @@ static void xfuse_create_dir_or_file(fuse_req_t req, fuse_ino_t parent,
|
||||
{
|
||||
XFS_INODE *xinode;
|
||||
|
||||
log_debug("entered: parent_ino=%ld name=%s mode=%o type=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: parent_ino=%ld name=%s mode=%o type=%s",
|
||||
parent, name, mode, (mode & S_IFDIR) ? "dir" : "file");
|
||||
|
||||
/* name must be valid */
|
||||
@ -1904,7 +1864,7 @@ static void xfuse_create_dir_or_file(fuse_req_t req, fuse_ino_t parent,
|
||||
/* specified file is a local resource */
|
||||
//XFUSE_HANDLE *fh;
|
||||
|
||||
log_debug("LK_TODO: this is still a TODO");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "LK_TODO: this is still a TODO");
|
||||
fuse_reply_err(req, EROFS);
|
||||
}
|
||||
else
|
||||
@ -1914,7 +1874,7 @@ static void xfuse_create_dir_or_file(fuse_req_t req, fuse_ino_t parent,
|
||||
|
||||
if (full_path == NULL || fip == NULL)
|
||||
{
|
||||
log_error("Out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(fip);
|
||||
free(full_path);
|
||||
@ -1941,7 +1901,7 @@ static void xfuse_create_dir_or_file(fuse_req_t req, fuse_ino_t parent,
|
||||
*/
|
||||
if (devredir_file_create(fip, xinode->device_id, cptr, mode))
|
||||
{
|
||||
log_error("failed to send devredir_file_create() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_file_create() cmd");
|
||||
fuse_reply_err(req, EREMOTEIO);
|
||||
free(fip);
|
||||
}
|
||||
@ -1964,24 +1924,24 @@ static void xfuse_cb_open(fuse_req_t req, fuse_ino_t ino,
|
||||
{
|
||||
XFS_INODE *xinode;
|
||||
|
||||
log_debug("entered: ino=%ld", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: ino=%ld", ino);
|
||||
|
||||
if (!(xinode = xfs_get(g_xfs, ino)))
|
||||
{
|
||||
log_error("inode %ld is not valid", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", ino);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else if (xinode->mode & S_IFDIR)
|
||||
{
|
||||
/* Can't open directories like this */
|
||||
log_debug("reading/writing a dir not allowed!");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "reading/writing a dir not allowed!");
|
||||
fuse_reply_err(req, EISDIR);
|
||||
}
|
||||
else if ((fi->flags & O_ACCMODE) != O_RDONLY &&
|
||||
(fi->flags & O_ACCMODE) != O_WRONLY &&
|
||||
(fi->flags & O_ACCMODE) != O_RDWR)
|
||||
{
|
||||
log_debug("Invalid access mode specified");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Invalid access mode specified");
|
||||
fuse_reply_err(req, EINVAL);
|
||||
}
|
||||
else if (!xinode->is_redirected)
|
||||
@ -2007,7 +1967,7 @@ static void xfuse_cb_open(fuse_req_t req, fuse_ino_t ino,
|
||||
|
||||
if (!full_path || !fip)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(fip);
|
||||
free(full_path);
|
||||
@ -2034,7 +1994,7 @@ static void xfuse_cb_open(fuse_req_t req, fuse_ino_t ino,
|
||||
*/
|
||||
if (devredir_file_open(fip, xinode->device_id, cptr, fi->flags))
|
||||
{
|
||||
log_error("failed to send devredir_file_open() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_file_open() cmd");
|
||||
fuse_reply_err(req, EREMOTEIO);
|
||||
free(fip);
|
||||
}
|
||||
@ -2055,12 +2015,12 @@ static void xfuse_cb_release(fuse_req_t req, fuse_ino_t ino, struct
|
||||
|
||||
XFUSE_HANDLE *handle = xfuse_handle_from_fuse_handle(fi->fh);
|
||||
|
||||
log_debug("entered: ino=%ld fi=%p fi->fh=0x%llx", ino, fi,
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: ino=%ld fi=%p fi->fh=0x%llx", ino, fi,
|
||||
(long long) fi->fh);
|
||||
|
||||
if ((xinode = xfs_get(g_xfs, ino)) == NULL)
|
||||
{
|
||||
log_error("inode %ld is not valid", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", ino);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else if (!xinode->is_redirected)
|
||||
@ -2075,7 +2035,7 @@ static void xfuse_cb_release(fuse_req_t req, fuse_ino_t ino, struct
|
||||
struct state_close *fip = g_new0(struct state_close, 1);
|
||||
if (fip == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
return;
|
||||
}
|
||||
@ -2092,7 +2052,7 @@ static void xfuse_cb_release(fuse_req_t req, fuse_ino_t ino, struct
|
||||
*/
|
||||
if (devredir_file_close(fip, xinode->device_id, handle->FileId))
|
||||
{
|
||||
log_error("failed to send devredir_close_file() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_close_file() cmd");
|
||||
fuse_reply_err(req, EREMOTEIO);
|
||||
free(fip);
|
||||
}
|
||||
@ -2115,7 +2075,7 @@ static void xfuse_cb_read(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
XFS_INODE *xinode;
|
||||
struct req_list_item *rli;
|
||||
|
||||
log_debug("want_bytes %zd bytes at off %lld", size, (long long) off);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "want_bytes %zd bytes at off %lld", size, (long long) off);
|
||||
|
||||
if ((fh = xfuse_handle_from_fuse_handle(fi->fh)) == NULL)
|
||||
{
|
||||
@ -2125,11 +2085,11 @@ static void xfuse_cb_read(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
{
|
||||
/* target file is in .clipboard dir */
|
||||
|
||||
log_debug("target file is in .clipboard dir");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "target file is in .clipboard dir");
|
||||
|
||||
if ((xinode = xfs_get(g_xfs, ino)) == NULL)
|
||||
{
|
||||
log_error("ino does not exist in xrdp_fs");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "ino does not exist in xrdp_fs");
|
||||
fuse_reply_buf(req, 0, 0);
|
||||
return;
|
||||
}
|
||||
@ -2145,7 +2105,7 @@ static void xfuse_cb_read(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
|
||||
if (g_req_list->count == 1)
|
||||
{
|
||||
log_debug("requesting clipboard file data lindex = %d off = %lld size = %zd",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "requesting clipboard file data lindex = %d off = %lld size = %zd",
|
||||
rli->lindex, (long long) off, size);
|
||||
|
||||
clipboard_request_file_data(rli->stream_id, rli->lindex,
|
||||
@ -2159,7 +2119,7 @@ static void xfuse_cb_read(fuse_req_t req, fuse_ino_t ino, size_t size,
|
||||
fusep = g_new0(struct state_read, 1);
|
||||
if (fusep == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
}
|
||||
else
|
||||
@ -2187,18 +2147,18 @@ static void xfuse_cb_write(fuse_req_t req, fuse_ino_t ino, const char *buf,
|
||||
XFUSE_HANDLE *fh;
|
||||
struct state_write *fusep;
|
||||
|
||||
log_debug("write %zd bytes at off %lld to inode=%ld",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "write %zd bytes at off %lld to inode=%ld",
|
||||
size, (long long) off, ino);
|
||||
|
||||
if ((fh = xfuse_handle_from_fuse_handle(fi->fh)) == NULL)
|
||||
{
|
||||
log_error("file handle fi->fh is NULL");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "file handle fi->fh is NULL");
|
||||
fuse_reply_err(req, EINVAL);
|
||||
}
|
||||
else if (fh->is_loc_resource)
|
||||
{
|
||||
/* target file is in .clipboard dir */
|
||||
log_debug("THIS IS STILL A TODO!");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "THIS IS STILL A TODO!");
|
||||
fuse_reply_err(req, EROFS);
|
||||
}
|
||||
else
|
||||
@ -2208,7 +2168,7 @@ static void xfuse_cb_write(fuse_req_t req, fuse_ino_t ino, const char *buf,
|
||||
fusep = g_new0(struct state_write, 1);
|
||||
if (fusep == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
}
|
||||
else
|
||||
@ -2238,7 +2198,7 @@ static void xfuse_cb_create(fuse_req_t req, fuse_ino_t parent,
|
||||
const char *name, mode_t mode,
|
||||
struct fuse_file_info *fi)
|
||||
{
|
||||
log_debug("entered: parent_inode=%ld, name=%s fi=%p",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: parent_inode=%ld, name=%s fi=%p",
|
||||
parent, name, fi);
|
||||
|
||||
xfuse_create_dir_or_file(req, parent, name, mode & ~S_IFDIR , fi);
|
||||
@ -2251,8 +2211,8 @@ static void xfuse_cb_create(fuse_req_t req, fuse_ino_t parent,
|
||||
static void xfuse_cb_fsync(fuse_req_t req, fuse_ino_t ino, int datasync,
|
||||
struct fuse_file_info *fi)
|
||||
{
|
||||
log_debug("#################### entered: ino=%ld datasync=%d", ino, datasync);
|
||||
log_debug("function not required");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "#################### entered: ino=%ld datasync=%d", ino, datasync);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "function not required");
|
||||
fuse_reply_err(req, EINVAL);
|
||||
}
|
||||
#endif
|
||||
@ -2275,11 +2235,11 @@ static void xfuse_cb_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
|
||||
{
|
||||
XFS_INODE *xinode;
|
||||
|
||||
log_debug("entered to_set=0x%x", to_set);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered to_set=0x%x", to_set);
|
||||
|
||||
if ((xinode = xfs_get(g_xfs, ino)) == NULL)
|
||||
{
|
||||
log_error("inode %ld is not valid", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", ino);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else if (((to_set & FUSE_SET_ATTR_UID) && attr->st_uid != xinode->uid) ||
|
||||
@ -2292,7 +2252,7 @@ static void xfuse_cb_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
|
||||
(attr->st_mode & ~(0777 | S_IFDIR | S_IFREG)) != 0)
|
||||
{
|
||||
/* We only support standard mode bits and S_IFDIR / S_IFREG */
|
||||
log_error("Asking for invalid mode bits 0%o to be set", attr->st_mode);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Asking for invalid mode bits 0%o to be set", attr->st_mode);
|
||||
fuse_reply_err(req, EINVAL);
|
||||
}
|
||||
else
|
||||
@ -2341,7 +2301,7 @@ static void xfuse_cb_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
|
||||
char *full_path = xfs_get_full_path(g_xfs, ino);
|
||||
if (!full_path || !fip)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
fuse_reply_err(req, ENOMEM);
|
||||
free(fip);
|
||||
free(full_path);
|
||||
@ -2389,11 +2349,11 @@ static void xfuse_cb_opendir(fuse_req_t req, fuse_ino_t ino,
|
||||
XFS_INODE *xinode;
|
||||
XFUSE_HANDLE *xhandle;
|
||||
|
||||
log_debug("inode=%ld", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "inode=%ld", ino);
|
||||
|
||||
if ((xinode = xfs_get(g_xfs, ino)) == NULL)
|
||||
{
|
||||
log_error("inode %ld is not valid", ino);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "inode %ld is not valid", ino);
|
||||
fuse_reply_err(req, ENOENT);
|
||||
}
|
||||
else if (!xinode->is_redirected)
|
||||
@ -2418,7 +2378,7 @@ static void xfuse_cb_opendir(fuse_req_t req, fuse_ino_t ino,
|
||||
}
|
||||
else
|
||||
{
|
||||
log_debug("did not find entry; redirecting call to devredir");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "did not find entry; redirecting call to devredir");
|
||||
struct state_dirscan *fip = g_new0(struct state_dirscan, 1);
|
||||
char *full_path = xfs_get_full_path(g_xfs, ino);
|
||||
|
||||
@ -2431,7 +2391,7 @@ static void xfuse_cb_opendir(fuse_req_t req, fuse_ino_t ino,
|
||||
else
|
||||
{
|
||||
const char *cptr;
|
||||
log_debug("dev_id=%d ino=%ld full_path=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "dev_id=%d ino=%ld full_path=%s",
|
||||
xinode->device_id, ino, full_path);
|
||||
|
||||
fip->req = req;
|
||||
@ -2450,7 +2410,7 @@ static void xfuse_cb_opendir(fuse_req_t req, fuse_ino_t ino,
|
||||
*/
|
||||
if (devredir_get_dir_listing(fip, xinode->device_id, cptr))
|
||||
{
|
||||
log_error("failed to send devredir_get_dir_listing() cmd");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "failed to send devredir_get_dir_listing() cmd");
|
||||
fuse_reply_buf(req, NULL, 0);
|
||||
free(fip);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "os_calls.h"
|
||||
#include "log.h"
|
||||
|
||||
#include "chansrv_xfs.h"
|
||||
|
||||
@ -113,47 +114,6 @@ struct xfs_dir_handle
|
||||
tui32 generation;
|
||||
};
|
||||
|
||||
/* module based logging */
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG 2
|
||||
#ifndef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
#define log_error(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: XFS %s: %d : ERROR: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_always(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: XFS %s: %d : ALWAYS: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_info(_params...) \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: XFS %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define log_debug(_params...) \
|
||||
{ \
|
||||
if (LOG_DEBUG <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: XFS %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
static int
|
||||
@ -450,7 +410,7 @@ xfs_add_entry(struct xfs_fs *xfs, fuse_ino_t parent_inum,
|
||||
fuse_ino_t inum = xfs->free_list[--xfs->free_count];
|
||||
if (xfs->inode_table[inum] != NULL)
|
||||
{
|
||||
log_error("Unexpected non-NULL value in inode table "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Unexpected non-NULL value in inode table "
|
||||
"entry %ld", inum);
|
||||
}
|
||||
xfs->inode_table[inum] = xino;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,46 +41,6 @@
|
||||
#include "xcommon.h"
|
||||
#include "chansrv_fuse.h"
|
||||
|
||||
/* module based logging */
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG 2
|
||||
#define LOG_LVL LOG_ERROR
|
||||
|
||||
#define log_error(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: CLIPFILE %s: %d : ERROR: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_always(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: CLIPFILE %s: %d : ALWAYS: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_info(_params...) \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LVL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: CLIPFILE %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define log_debug(_params...) \
|
||||
{ \
|
||||
if (LOG_DEBUG <= LOG_LVL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: CLIPFILE %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
extern int g_cliprdr_chan_id; /* in chansrv.c */
|
||||
|
||||
extern struct clip_s2c g_clip_s2c; /* in clipboard.c */
|
||||
@ -152,7 +112,7 @@ clipboard_check_file(char *filename)
|
||||
index++;
|
||||
}
|
||||
}
|
||||
log_debug("[%s] [%s]", filename, lfilename);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "[%s] [%s]", filename, lfilename);
|
||||
g_strcpy(filename, lfilename);
|
||||
return 0;
|
||||
}
|
||||
@ -209,14 +169,14 @@ clipboard_get_file(const char *file, int bytes)
|
||||
g_snprintf(full_fn, 255, "%s/%s", pathname, filename);
|
||||
if (g_directory_exist(full_fn))
|
||||
{
|
||||
log_error("clipboard_get_file: file [%s] is a directory, "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_get_file: file [%s] is a directory, "
|
||||
"not supported", full_fn);
|
||||
flags |= CB_FILE_ATTRIBUTE_DIRECTORY;
|
||||
return 1;
|
||||
}
|
||||
if (!g_file_exist(full_fn))
|
||||
{
|
||||
log_error("clipboard_get_file: file [%s] does not exist",
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_get_file: file [%s] does not exist",
|
||||
full_fn);
|
||||
return 1;
|
||||
}
|
||||
@ -229,7 +189,7 @@ clipboard_get_file(const char *file, int bytes)
|
||||
cfi->size = g_file_get_size(full_fn);
|
||||
cfi->flags = flags;
|
||||
cfi->time = (g_time1() + CB_EPOCH_DIFF) * 10000000LL;
|
||||
log_debug("ok filename [%s] pathname [%s] size [%d]",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "ok filename [%s] pathname [%s] size [%d]",
|
||||
cfi->filename, cfi->pathname, cfi->size);
|
||||
}
|
||||
return 0;
|
||||
@ -292,7 +252,7 @@ clipboard_send_data_response_for_file(const char *data, int data_size)
|
||||
char fn[256];
|
||||
struct cb_file_info *cfi;
|
||||
|
||||
log_debug("clipboard_send_data_response_for_file: data_size %d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_send_data_response_for_file: data_size %d",
|
||||
data_size);
|
||||
//g_hexdump(data, data_size);
|
||||
if (g_files_list == 0)
|
||||
@ -355,17 +315,17 @@ clipboard_send_file_size(int streamId, int lindex)
|
||||
|
||||
if (g_files_list == 0)
|
||||
{
|
||||
log_error("clipboard_send_file_size: error g_files_list is nil");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_size: error g_files_list is nil");
|
||||
return 1;
|
||||
}
|
||||
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
|
||||
if (cfi == 0)
|
||||
{
|
||||
log_error("clipboard_send_file_size: error cfi is nil");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_size: error cfi is nil");
|
||||
return 1;
|
||||
}
|
||||
file_size = cfi->size;
|
||||
log_debug("clipboard_send_file_size: streamId %d file_size %d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_send_file_size: streamId %d file_size %d",
|
||||
streamId, file_size);
|
||||
make_stream(s);
|
||||
init_stream(s, 8192);
|
||||
@ -392,10 +352,10 @@ clipboard_request_file_size(int stream_id, int lindex)
|
||||
int size;
|
||||
int rv;
|
||||
|
||||
log_debug("clipboard_request_file_size:");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_request_file_size:");
|
||||
if (g_file_request_sent_type != 0)
|
||||
{
|
||||
log_error("clipboard_request_file_size: warning, still waiting "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_request_file_size: warning, still waiting "
|
||||
"for CB_FILECONTENTS_RESPONSE");
|
||||
}
|
||||
make_stream(s);
|
||||
@ -434,29 +394,29 @@ clipboard_send_file_data(int streamId, int lindex,
|
||||
|
||||
if (g_files_list == 0)
|
||||
{
|
||||
log_error("clipboard_send_file_data: error g_files_list is nil");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_data: error g_files_list is nil");
|
||||
return 1;
|
||||
}
|
||||
cfi = (struct cb_file_info *)list_get_item(g_files_list, lindex);
|
||||
if (cfi == 0)
|
||||
{
|
||||
log_error("clipboard_send_file_data: error cfi is nil");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_data: error cfi is nil");
|
||||
return 1;
|
||||
}
|
||||
log_debug("clipboard_send_file_data: streamId %d lindex %d "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_send_file_data: streamId %d lindex %d "
|
||||
"nPositionLow %d cbRequested %d", streamId, lindex,
|
||||
nPositionLow, cbRequested);
|
||||
g_snprintf(full_fn, 255, "%s/%s", cfi->pathname, cfi->filename);
|
||||
fd = g_file_open_ex(full_fn, 1, 0, 0, 0);
|
||||
if (fd == -1)
|
||||
{
|
||||
log_error("clipboard_send_file_data: file open [%s] failed",
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_data: file open [%s] failed",
|
||||
full_fn);
|
||||
return 1;
|
||||
}
|
||||
if (g_file_seek(fd, nPositionLow) < 0)
|
||||
{
|
||||
log_message(LOG_LEVEL_ERROR, "clipboard_send_file_data: seek error "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_data: seek error "
|
||||
"in file: %s", full_fn);
|
||||
g_file_close(fd);
|
||||
return 1;
|
||||
@ -466,7 +426,7 @@ clipboard_send_file_data(int streamId, int lindex,
|
||||
size = g_file_read(fd, s->data + 12, cbRequested);
|
||||
if (size < 1)
|
||||
{
|
||||
log_error("clipboard_send_file_data: read error, want %d got %d",
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_send_file_data: read error, want %d got %d",
|
||||
cbRequested, size);
|
||||
free_stream(s);
|
||||
g_file_close(fd);
|
||||
@ -496,12 +456,12 @@ clipboard_request_file_data(int stream_id, int lindex, int offset,
|
||||
int size;
|
||||
int rv;
|
||||
|
||||
log_debug("clipboard_request_file_data: stream_id=%d lindex=%d off=%d request_bytes=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_request_file_data: stream_id=%d lindex=%d off=%d request_bytes=%d",
|
||||
stream_id, lindex, offset, request_bytes);
|
||||
|
||||
if (g_file_request_sent_type != 0)
|
||||
{
|
||||
log_error("clipboard_request_file_data: warning, still waiting "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_request_file_data: warning, still waiting "
|
||||
"for CB_FILECONTENTS_RESPONSE");
|
||||
}
|
||||
make_stream(s);
|
||||
@ -539,7 +499,7 @@ clipboard_process_file_request(struct stream *s, int clip_msg_status,
|
||||
int cbRequested;
|
||||
//int clipDataId;
|
||||
|
||||
log_debug("clipboard_process_file_request:");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_process_file_request:");
|
||||
//g_hexdump(s->p, clip_msg_len);
|
||||
in_uint32_le(s, streamId);
|
||||
in_uint32_le(s, lindex);
|
||||
@ -569,13 +529,13 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
|
||||
int streamId;
|
||||
int file_size;
|
||||
|
||||
log_debug("clipboard_process_file_response:");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_process_file_response:");
|
||||
if (g_file_request_sent_type == CB_FILECONTENTS_SIZE)
|
||||
{
|
||||
g_file_request_sent_type = 0;
|
||||
in_uint32_le(s, streamId);
|
||||
in_uint32_le(s, file_size);
|
||||
log_debug("clipboard_process_file_response: streamId %d "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_process_file_response: streamId %d "
|
||||
"file_size %d", streamId, file_size);
|
||||
xfuse_file_contents_size(streamId, file_size);
|
||||
}
|
||||
@ -587,7 +547,7 @@ clipboard_process_file_response(struct stream *s, int clip_msg_status,
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error("clipboard_process_file_response: error");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_process_file_response: error");
|
||||
g_file_request_sent_type = 0;
|
||||
}
|
||||
return 0;
|
||||
@ -615,14 +575,14 @@ clipboard_c2s_in_file_info(struct stream *s, struct clip_file_desc *cfd)
|
||||
ex_bytes -= 2;
|
||||
in_uint8s(s, ex_bytes);
|
||||
in_uint8s(s, 8); /* pad */
|
||||
log_debug("clipboard_c2s_in_file_info:");
|
||||
log_debug(" flags 0x%8.8x", cfd->flags);
|
||||
log_debug(" fileAttributes 0x%8.8x", cfd->fileAttributes);
|
||||
log_debug(" lastWriteTime 0x%8.8x%8.8x", cfd->lastWriteTimeHigh,
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_c2s_in_file_info:");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " flags 0x%8.8x", cfd->flags);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " fileAttributes 0x%8.8x", cfd->fileAttributes);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " lastWriteTime 0x%8.8x%8.8x", cfd->lastWriteTimeHigh,
|
||||
cfd->lastWriteTimeLow);
|
||||
log_debug(" fileSize 0x%8.8x%8.8x", cfd->fileSizeHigh,
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " fileSize 0x%8.8x%8.8x", cfd->fileSizeHigh,
|
||||
cfd->fileSizeLow);
|
||||
log_debug(" num_chars %d cFileName [%s]", num_chars, cfd->cFileName);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " num_chars %d cFileName [%s]", num_chars, cfd->cFileName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -639,17 +599,17 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
|
||||
|
||||
if (!s_check_rem(s, 4))
|
||||
{
|
||||
log_error("clipboard_c2s_in_files: parse error");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_c2s_in_files: parse error");
|
||||
return 1;
|
||||
}
|
||||
in_uint32_le(s, cItems);
|
||||
if (cItems > 64 * 1024) /* sanity check */
|
||||
{
|
||||
log_error("clipboard_c2s_in_files: error cItems %d too big", cItems);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_c2s_in_files: error cItems %d too big", cItems);
|
||||
return 1;
|
||||
}
|
||||
xfuse_clear_clip_dir();
|
||||
log_debug("clipboard_c2s_in_files: cItems %d", cItems);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "clipboard_c2s_in_files: cItems %d", cItems);
|
||||
cfd = (struct clip_file_desc *)
|
||||
g_malloc(sizeof(struct clip_file_desc), 0);
|
||||
file_count = 0;
|
||||
@ -661,13 +621,13 @@ clipboard_c2s_in_files(struct stream *s, char *file_list)
|
||||
if ((g_pos(cfd->cFileName, "\\") >= 0) ||
|
||||
(cfd->fileAttributes & CB_FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
log_error("clipboard_c2s_in_files: skipping directory not "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_c2s_in_files: skipping directory not "
|
||||
"supported [%s]", cfd->cFileName);
|
||||
continue;
|
||||
}
|
||||
if (xfuse_add_clip_dir_item(cfd->cFileName, 0, cfd->fileSizeLow, lindex) == -1)
|
||||
{
|
||||
log_error("clipboard_c2s_in_files: failed to add clip dir item");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "clipboard_c2s_in_files: failed to add clip dir item");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -59,40 +59,6 @@
|
||||
#include "ms-fscc.h"
|
||||
#include "ms-erref.h"
|
||||
|
||||
/* module based logging */
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG 2
|
||||
|
||||
#undef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_ERROR
|
||||
|
||||
#define log_error(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: DEV_REDIR %s: %d : ERROR: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_info(_params...) \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define log_debug(_params...) \
|
||||
{ \
|
||||
if (LOG_DEBUG <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: DEV_REDIR %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* client minor versions */
|
||||
#define RDP_CLIENT_50 0x0002
|
||||
@ -351,7 +317,7 @@ devredir_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
||||
/* for now we only handle core type, not printers */
|
||||
if (comp_type != RDPDR_CTYP_CORE)
|
||||
{
|
||||
log_error("invalid component type in response; expected 0x%x got 0x%x",
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "invalid component type in response; expected 0x%x got 0x%x",
|
||||
RDPDR_CTYP_CORE, comp_type);
|
||||
|
||||
rv = -1;
|
||||
@ -416,7 +382,7 @@ devredir_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
||||
break;
|
||||
|
||||
default:
|
||||
log_error("got unknown response 0x%x", pktID);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "got unknown response 0x%x", pktID);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -599,14 +565,14 @@ devredir_send_drive_create_request(tui32 device_id,
|
||||
int len;
|
||||
tui32 SharedAccess;
|
||||
|
||||
log_debug("device_id=%d path=\"%s\""
|
||||
" DesiredAccess=0x%x CreateDisposition=0x%x"
|
||||
" FileAttributes=0x%x CreateOptions=0x%x"
|
||||
" CompletionId=%d",
|
||||
device_id, path,
|
||||
DesiredAccess, CreateDisposition,
|
||||
FileAttributes, CreateOptions,
|
||||
completion_id);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "device_id=%d path=\"%s\""
|
||||
" DesiredAccess=0x%x CreateDisposition=0x%x"
|
||||
" FileAttributes=0x%x CreateOptions=0x%x"
|
||||
" CompletionId=%d",
|
||||
device_id, path,
|
||||
DesiredAccess, CreateDisposition,
|
||||
FileAttributes, CreateOptions,
|
||||
completion_id);
|
||||
|
||||
/* path in unicode needs this much space */
|
||||
len = ((g_mbstowcs(NULL, path, 0) * sizeof(twchar)) / 2) + 2;
|
||||
@ -673,7 +639,7 @@ devredir_send_drive_close_request(tui16 Component, tui16 PacketId,
|
||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||
|
||||
xstream_free(s);
|
||||
log_debug("sent close request; expect CID_FILE_CLOSE");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sent close request; expect CID_FILE_CLOSE");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -771,21 +737,21 @@ devredir_proc_client_core_cap_resp(struct stream *s)
|
||||
switch (cap_type)
|
||||
{
|
||||
case CAP_GENERAL_TYPE:
|
||||
log_debug("got CAP_GENERAL_TYPE");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "got CAP_GENERAL_TYPE");
|
||||
break;
|
||||
|
||||
case CAP_PRINTER_TYPE:
|
||||
log_debug("got CAP_PRINTER_TYPE");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "got CAP_PRINTER_TYPE");
|
||||
g_is_printer_redir_supported = 1;
|
||||
break;
|
||||
|
||||
case CAP_PORT_TYPE:
|
||||
log_debug("got CAP_PORT_TYPE");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "got CAP_PORT_TYPE");
|
||||
g_is_port_redir_supported = 1;
|
||||
break;
|
||||
|
||||
case CAP_DRIVE_TYPE:
|
||||
log_debug("got CAP_DRIVE_TYPE");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "got CAP_DRIVE_TYPE");
|
||||
g_is_drive_redir_supported = 1;
|
||||
if (cap_version == 2)
|
||||
{
|
||||
@ -794,7 +760,7 @@ devredir_proc_client_core_cap_resp(struct stream *s)
|
||||
break;
|
||||
|
||||
case CAP_SMARTCARD_TYPE:
|
||||
log_debug("got CAP_SMARTCARD_TYPE");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "got CAP_SMARTCARD_TYPE");
|
||||
g_is_smartcard_redir_supported = 1;
|
||||
scard_init();
|
||||
break;
|
||||
@ -817,7 +783,7 @@ devredir_proc_client_devlist_announce_req(struct stream *s)
|
||||
/* get number of devices being announced */
|
||||
xstream_rd_u32_le(s, device_count);
|
||||
|
||||
log_debug("num of devices announced: %d", device_count);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "num of devices announced: %d", device_count);
|
||||
|
||||
for (i = 0; i < device_count; i++)
|
||||
{
|
||||
@ -845,7 +811,7 @@ devredir_proc_client_devlist_announce_req(struct stream *s)
|
||||
device_data_len);
|
||||
}
|
||||
|
||||
log_debug("device_type=FILE_SYSTEM device_id=0x%x dosname=%s "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "device_type=FILE_SYSTEM device_id=0x%x dosname=%s "
|
||||
"device_data_len=%d full_name=%s", g_device_id,
|
||||
preferred_dos_name,
|
||||
device_data_len, g_full_name_for_filesystem);
|
||||
@ -860,7 +826,7 @@ devredir_proc_client_devlist_announce_req(struct stream *s)
|
||||
case RDPDR_DTYP_SMARTCARD:
|
||||
/* for smart cards, device data len always 0 */
|
||||
|
||||
log_debug("device_type=SMARTCARD device_id=0x%x dosname=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "device_type=SMARTCARD device_id=0x%x dosname=%s",
|
||||
g_device_id, preferred_dos_name);
|
||||
|
||||
response_status = STATUS_SUCCESS;
|
||||
@ -869,25 +835,25 @@ devredir_proc_client_devlist_announce_req(struct stream *s)
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_SERIAL:
|
||||
log_debug(
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG,
|
||||
"device_type=SERIAL device_id=0x%x dosname=%s",
|
||||
g_device_id, preferred_dos_name);
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_PARALLEL:
|
||||
log_debug(
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG,
|
||||
"device_type=PARALLEL device_id=0x%x dosname=%s",
|
||||
g_device_id, preferred_dos_name);
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_PRINT:
|
||||
log_debug(
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG,
|
||||
"device_type=PRINT device_id=0x%x dosname=%s",
|
||||
g_device_id, preferred_dos_name);
|
||||
break;
|
||||
|
||||
default:
|
||||
log_debug(
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG,
|
||||
"device_type=UNKNOWN device_id=0x%x dosname=%s",
|
||||
g_device_id, preferred_dos_name);
|
||||
break;
|
||||
@ -909,7 +875,7 @@ devredir_proc_client_devlist_remove_req(struct stream *s)
|
||||
/* get number of devices being announced */
|
||||
xstream_rd_u32_le(s, device_count);
|
||||
|
||||
log_debug("num of devices removed: %d", device_count);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "num of devices removed: %d", device_count);
|
||||
{
|
||||
for (i = 0; i < device_count; i++)
|
||||
{
|
||||
@ -937,7 +903,7 @@ devredir_proc_device_iocompletion(struct stream *s)
|
||||
|
||||
if ((irp = devredir_irp_find(CompletionId)) == NULL)
|
||||
{
|
||||
log_error("IRP with completion ID %d not found", CompletionId);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "IRP with completion ID %d not found", CompletionId);
|
||||
}
|
||||
else
|
||||
if (irp->callback)
|
||||
@ -954,16 +920,15 @@ devredir_proc_device_iocompletion(struct stream *s)
|
||||
(IoStatus == STATUS_NO_SUCH_FILE && comp_type == CID_LOOKUP))
|
||||
{
|
||||
/* Successes or common occurrences - debug logging only */
|
||||
log_debug("got %s", completion_type_to_str(comp_type));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "got %s", completion_type_to_str(comp_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *pathname = (irp->pathname) ? irp->pathname : "<none>";
|
||||
log_error("CompletionType = %s, IoStatus=%08x "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "CompletionType = %s, IoStatus=%08x "
|
||||
"Pathname = %s",
|
||||
completion_type_to_str(comp_type),
|
||||
IoStatus,
|
||||
pathname);
|
||||
(irp->pathname) ? irp->pathname : "<none>");
|
||||
}
|
||||
|
||||
switch (comp_type)
|
||||
@ -1063,7 +1028,7 @@ devredir_proc_device_iocompletion(struct stream *s)
|
||||
break;
|
||||
|
||||
default:
|
||||
log_error("got unknown CompletionID: DeviceId=0x%x "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "got unknown CompletionID: DeviceId=0x%x "
|
||||
"CompletionId=0x%x IoStatus=0x%x",
|
||||
DeviceId, CompletionId, IoStatus);
|
||||
break;
|
||||
@ -1110,12 +1075,12 @@ devredir_proc_query_dir_response(IRP *irp,
|
||||
|
||||
i += 64 + FileNameLength;
|
||||
|
||||
//log_debug("LastAccessTime: 0x%llx", LastAccessTime);
|
||||
//log_debug("LastWriteTime: 0x%llx", LastWriteTime);
|
||||
//log_debug("EndOfFile: %lld", EndOfFile);
|
||||
//log_debug("FileAttributes: 0x%x", FileAttributes);
|
||||
//log_debug("FileNameLength: %d", FileNameLength);
|
||||
log_debug("FileName: %s", filename);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "LastAccessTime: 0x%llx", LastAccessTime);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "LastWriteTime: 0x%llx", LastWriteTime);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "EndOfFile: %lld", EndOfFile);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "FileAttributes: 0x%x", FileAttributes);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "FileNameLength: %d", FileNameLength);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "FileName: %s", filename);
|
||||
|
||||
fattr.mode = WindowsToLinuxFilePerm(FileAttributes);
|
||||
fattr.size = (size_t) EndOfFile;
|
||||
@ -1194,7 +1159,7 @@ devredir_get_dir_listing(struct state_dirscan *fusep, tui32 device_id,
|
||||
0, CreateDisposition,
|
||||
irp->CompletionId);
|
||||
|
||||
log_debug("looking for device_id=%d path=%s", device_id, irp->pathname);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "looking for device_id=%d path=%s", device_id, irp->pathname);
|
||||
|
||||
/* when we get a response to devredir_send_drive_create_request(), we
|
||||
* call devredir_send_drive_dir_request(), which needs the following
|
||||
@ -1232,7 +1197,7 @@ devredir_lookup_entry(struct state_lookup *fusep, tui32 device_id,
|
||||
int rval = -1;
|
||||
IRP *irp;
|
||||
|
||||
log_debug("fusep=%p", fusep);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "fusep=%p", fusep);
|
||||
|
||||
if ((irp = devredir_irp_with_pathname_new(path)) != NULL)
|
||||
{
|
||||
@ -1253,7 +1218,7 @@ devredir_lookup_entry(struct state_lookup *fusep, tui32 device_id,
|
||||
CreateOptions = 0;
|
||||
CreateDisposition = CD_FILE_OPEN;
|
||||
|
||||
log_debug("lookup for device_id=%d path=%s CompletionId=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "lookup for device_id=%d path=%s CompletionId=%d",
|
||||
device_id, irp->pathname, irp->CompletionId);
|
||||
|
||||
rval = devredir_send_drive_create_request(device_id,
|
||||
@ -1290,7 +1255,7 @@ devredir_setattr_for_entry(struct state_setattr *fusep, tui32 device_id,
|
||||
int rval = -1;
|
||||
IRP *irp;
|
||||
|
||||
log_debug("fusep=%p", fusep);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "fusep=%p", fusep);
|
||||
|
||||
if ((irp = devredir_irp_with_pathname_new(filename)) != NULL)
|
||||
{
|
||||
@ -1322,8 +1287,8 @@ devredir_setattr_for_entry(struct state_setattr *fusep, tui32 device_id,
|
||||
CreateOptions = 0;
|
||||
CreateDisposition = CD_FILE_OPEN;
|
||||
|
||||
log_debug("lookup for device_id=%d path=%s",
|
||||
device_id, irp->pathname);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "lookup for device_id=%d path=%s",
|
||||
device_id, irp->pathname);
|
||||
|
||||
rval = devredir_send_drive_create_request(device_id,
|
||||
irp->pathname,
|
||||
@ -1346,7 +1311,7 @@ devredir_file_create(struct state_create *fusep, tui32 device_id,
|
||||
int rval = -1;
|
||||
IRP *irp;
|
||||
|
||||
log_debug("device_id=%d path=%s mode=0%o", device_id, path, mode);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "device_id=%d path=%s mode=0%o", device_id, path, mode);
|
||||
|
||||
if ((irp = devredir_irp_with_pathname_new(path)) != NULL)
|
||||
{
|
||||
@ -1358,17 +1323,18 @@ devredir_file_create(struct state_create *fusep, tui32 device_id,
|
||||
irp->DeviceId = device_id;
|
||||
irp->fuse_info = fusep;
|
||||
|
||||
|
||||
DesiredAccess = 0x0016019f; /* got this value from windows */
|
||||
FileAttributes = LinuxToWindowsFilePerm(mode);
|
||||
if (mode & S_IFDIR)
|
||||
{
|
||||
log_debug("creating dir");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "creating dir");
|
||||
CreateOptions = CO_FILE_DIRECTORY_FILE | CO_FILE_SYNCHRONOUS_IO_NONALERT;
|
||||
irp->gen.create.creating_dir = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_debug("creating file");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "creating file");
|
||||
CreateOptions = 0x44; /* got this value from windows */
|
||||
irp->gen.create.creating_dir = 0;
|
||||
}
|
||||
@ -1397,7 +1363,7 @@ devredir_file_open(struct state_open *fusep, tui32 device_id,
|
||||
int rval = -1;
|
||||
IRP *irp;
|
||||
|
||||
log_debug("device_id=%d path=%s flags=0%x",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "device_id=%d path=%s flags=0%x",
|
||||
device_id, path, flags);
|
||||
|
||||
if ((irp = devredir_irp_with_pathname_new(path)) != NULL)
|
||||
@ -1414,12 +1380,12 @@ devredir_file_open(struct state_open *fusep, tui32 device_id,
|
||||
switch(flags & O_ACCMODE)
|
||||
{
|
||||
case O_RDONLY:
|
||||
log_debug("open file in O_RDONLY");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "open file in O_RDONLY");
|
||||
DesiredAccess = DA_FILE_READ_DATA | DA_SYNCHRONIZE;
|
||||
break;
|
||||
|
||||
case O_WRONLY:
|
||||
log_debug("open file in O_WRONLY");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "open file in O_WRONLY");
|
||||
DesiredAccess = DA_FILE_WRITE_DATA | DA_SYNCHRONIZE;
|
||||
break;
|
||||
|
||||
@ -1428,7 +1394,7 @@ devredir_file_open(struct state_open *fusep, tui32 device_id,
|
||||
* The access mode could conceivably be invalid here,
|
||||
* but we assume this has been checked by the caller
|
||||
*/
|
||||
log_debug("open file in O_RDWR");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "open file in O_RDWR");
|
||||
/* without the 0x00000010 rdesktop opens files in */
|
||||
/* O_RDONLY instead of O_RDWR mode */
|
||||
DesiredAccess = DA_FILE_READ_DATA | DA_FILE_WRITE_DATA |
|
||||
@ -1453,7 +1419,7 @@ int devredir_file_close(struct state_close *fusep, tui32 device_id,
|
||||
{
|
||||
IRP *irp;
|
||||
|
||||
log_debug("entered: fusep=%p device_id=%d FileId=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: fusep=%p device_id=%d FileId=%d",
|
||||
fusep, device_id, FileId);
|
||||
|
||||
#if 0
|
||||
@ -1464,7 +1430,7 @@ int devredir_file_close(struct state_close *fusep, tui32 device_id,
|
||||
#else
|
||||
if ((irp = devredir_irp_find_by_fileid(FileId)) == NULL)
|
||||
{
|
||||
log_error("no IRP found with FileId = %d", FileId);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "no IRP found with FileId = %d", FileId);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@ -1545,7 +1511,7 @@ devredir_file_read(struct state_read *fusep, tui32 DeviceId, tui32 FileId,
|
||||
/* Check we've got an open IRP for this file already */
|
||||
if ((irp = devredir_irp_find_by_fileid(FileId)) == NULL)
|
||||
{
|
||||
log_error("no IRP found with FileId = %d", FileId);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "no IRP found with FileId = %d", FileId);
|
||||
xfuse_devredir_cb_read_file(fusep, STATUS_UNSUCCESSFUL, NULL, 0);
|
||||
xstream_free(s);
|
||||
}
|
||||
@ -1597,14 +1563,14 @@ devredir_file_write(struct state_write *fusep, tui32 DeviceId, tui32 FileId,
|
||||
IRP *new_irp;
|
||||
int bytes;
|
||||
|
||||
log_debug("DeviceId=%d FileId=%d Length=%d Offset=%lld",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "DeviceId=%d FileId=%d Length=%d Offset=%lld",
|
||||
DeviceId, FileId, Length, (long long)Offset);
|
||||
|
||||
xstream_new(s, 1024 + Length);
|
||||
|
||||
if ((irp = devredir_irp_find_by_fileid(FileId)) == NULL)
|
||||
{
|
||||
log_error("no IRP found with FileId = %d", FileId);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "no IRP found with FileId = %d", FileId);
|
||||
xfuse_devredir_cb_write_file(fusep, STATUS_UNSUCCESSFUL, 0, 0);
|
||||
xstream_free(s);
|
||||
}
|
||||
@ -1644,6 +1610,7 @@ devredir_file_write(struct state_write *fusep, tui32 DeviceId, tui32 FileId,
|
||||
send_channel_data(g_rdpdr_chan_id, s->data, bytes);
|
||||
xstream_free(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1659,7 +1626,7 @@ int devredir_file_rename(struct state_rename *fusep, tui32 device_id,
|
||||
IRP *irp;
|
||||
unsigned int len;
|
||||
|
||||
log_debug("device_id=%d old_name=%s new_name=%s",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "device_id=%d old_name=%s new_name=%s",
|
||||
device_id, old_name, new_name);
|
||||
|
||||
/*
|
||||
@ -1880,7 +1847,7 @@ devredir_proc_cid_rename_file(IRP *irp, enum NTSTATUS IoStatus)
|
||||
|
||||
if (IoStatus != STATUS_SUCCESS)
|
||||
{
|
||||
log_debug("rename returned with IoStatus=0x%x", IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "rename returned with IoStatus=0x%x", IoStatus);
|
||||
|
||||
xfuse_devredir_cb_rename_file((struct state_rename *)irp->fuse_info,
|
||||
IoStatus);
|
||||
@ -1922,8 +1889,6 @@ devredir_proc_cid_rename_file(IRP *irp, enum NTSTATUS IoStatus)
|
||||
static void
|
||||
devredir_proc_cid_rename_file_resp(IRP *irp, enum NTSTATUS IoStatus)
|
||||
{
|
||||
log_debug("entered");
|
||||
|
||||
xfuse_devredir_cb_rename_file((struct state_rename *)irp->fuse_info,
|
||||
IoStatus);
|
||||
|
||||
@ -1983,7 +1948,7 @@ static void lookup_read_basic_attributes(IRP *irp, struct stream *s_in)
|
||||
tui64 LastWriteTime;
|
||||
tui32 FileAttributes;
|
||||
|
||||
log_debug("processing FILE_BASIC_INFORMATION");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "processing FILE_BASIC_INFORMATION");
|
||||
|
||||
xstream_seek(s_in, 8); /* CreationTime */
|
||||
xstream_rd_u64_le(s_in, LastAccessTime);
|
||||
@ -1991,13 +1956,13 @@ static void lookup_read_basic_attributes(IRP *irp, struct stream *s_in)
|
||||
xstream_seek(s_in, 8); /* ChangeTime */
|
||||
xstream_rd_u32_le(s_in, FileAttributes);
|
||||
|
||||
//log_debug("LastAccessTime: 0x%llx",
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "LastAccessTime: 0x%llx",
|
||||
// (unsigned long long)LastAccessTime);
|
||||
//log_debug("LastWriteTime: 0x%llx",
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "LastWriteTime: 0x%llx",
|
||||
// (unsigned long long)LastWriteTime);
|
||||
//log_debug("ChangeTime: 0x%llx",
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "ChangeTime: 0x%llx",
|
||||
// (unsigned long long)ChangeTime);
|
||||
//log_debug("FileAttributes: 0x%x", (unsigned int)FileAttributes);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "FileAttributes: 0x%x", (unsigned int)FileAttributes);
|
||||
|
||||
/* Save the basic attributes in the IRP */
|
||||
irp->gen.lookup.fattr.mode = WindowsToLinuxFilePerm(FileAttributes);
|
||||
@ -2011,10 +1976,10 @@ static void lookup_read_basic_attributes(IRP *irp, struct stream *s_in)
|
||||
static void lookup_read_standard_attributes(IRP *irp, struct stream *s_in)
|
||||
{
|
||||
tui64 EndOfFile;
|
||||
log_debug("processing FILE_STD_INFORMATION");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "processing FILE_STD_INFORMATION");
|
||||
xstream_seek(s_in, 8); /* AllocationSize */
|
||||
xstream_rd_u64_le(s_in, EndOfFile);
|
||||
//log_debug("EndOfFile: %lld",
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "EndOfFile: %lld",
|
||||
// (unsigned long long)EndOfFile);
|
||||
|
||||
irp->gen.lookup.fattr.size = EndOfFile;
|
||||
@ -2027,7 +1992,7 @@ static void lookup_read_standard_attributes(IRP *irp, struct stream *s_in)
|
||||
*****************************************************************************/
|
||||
static void lookup_done(IRP *irp, enum NTSTATUS IoStatus)
|
||||
{
|
||||
log_debug("Lookup with completion_id=%d returning 0x%x",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Lookup with completion_id=%d returning 0x%x",
|
||||
irp->CompletionId, IoStatus);
|
||||
xfuse_devredir_cb_lookup_entry((struct state_lookup *)irp->fuse_info,
|
||||
IoStatus,
|
||||
@ -2063,11 +2028,11 @@ devredir_proc_cid_lookup(IRP *irp,
|
||||
{
|
||||
tui32 Length;
|
||||
|
||||
log_debug("entry state is %d",irp->gen.lookup.state);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entry state is %d",irp->gen.lookup.state);
|
||||
if (IoStatus != STATUS_SUCCESS)
|
||||
{
|
||||
/* This is common to all setattr states */
|
||||
log_debug("last lookup returned with IoStatus=0x%08x", IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "last lookup returned with IoStatus=0x%08x", IoStatus);
|
||||
lookup_done(irp, IoStatus);
|
||||
}
|
||||
else
|
||||
@ -2087,7 +2052,7 @@ devredir_proc_cid_lookup(IRP *irp,
|
||||
xstream_rd_u32_le(s_in, Length);
|
||||
if (Length != FILE_BASIC_INFORMATION_SIZE)
|
||||
{
|
||||
log_error("Expected FILE_BASIC_INFORMATION length"
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Expected FILE_BASIC_INFORMATION length"
|
||||
"%d, got len=%d",
|
||||
FILE_BASIC_INFORMATION_SIZE, Length);
|
||||
IoStatus = STATUS_UNSUCCESSFUL;
|
||||
@ -2106,7 +2071,7 @@ devredir_proc_cid_lookup(IRP *irp,
|
||||
xstream_rd_u32_le(s_in, Length);
|
||||
if (Length != FILE_STD_INFORMATION_SIZE)
|
||||
{
|
||||
log_error("Expected FILE_STD_INFORMATION length"
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Expected FILE_STD_INFORMATION length"
|
||||
"%d, got len=%d",
|
||||
FILE_STD_INFORMATION_SIZE, Length);
|
||||
IoStatus = STATUS_UNSUCCESSFUL;
|
||||
@ -2241,11 +2206,11 @@ devredir_proc_cid_setattr(IRP *irp,
|
||||
TO_SET_ATIME | TO_SET_MTIME)
|
||||
tui32 Length;
|
||||
|
||||
log_debug("entry state is %d",irp->gen.setattr.state);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entry state is %d",irp->gen.setattr.state);
|
||||
if (IoStatus != STATUS_SUCCESS)
|
||||
{
|
||||
/* This is common to all setattr states */
|
||||
log_debug("last setattr returned with IoStatus=0x%08x", IoStatus);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "last setattr returned with IoStatus=0x%08x", IoStatus);
|
||||
setattr_done(irp, IoStatus);
|
||||
}
|
||||
else
|
||||
@ -2263,7 +2228,7 @@ devredir_proc_cid_setattr(IRP *irp,
|
||||
xstream_rd_u32_le(s_in, Length);
|
||||
if (Length != FILE_BASIC_INFORMATION_SIZE)
|
||||
{
|
||||
log_error("Expected FILE_BASIC_INFORMATION length"
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Expected FILE_BASIC_INFORMATION length"
|
||||
"%d, got len=%d",
|
||||
FILE_BASIC_INFORMATION_SIZE, Length);
|
||||
}
|
||||
@ -2277,7 +2242,7 @@ devredir_proc_cid_setattr(IRP *irp,
|
||||
xstream_rd_u32_le(s_in, Length);
|
||||
if (Length != FILE_END_OF_FILE_INFORMATION_SIZE)
|
||||
{
|
||||
log_error("Expected FILE_END_OF_FILE_INFORMATION length"
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "Expected FILE_END_OF_FILE_INFORMATION length"
|
||||
"%d, got len=%d",
|
||||
FILE_END_OF_FILE_INFORMATION_SIZE, Length);
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
#define MODULE_NAME "FIFO "
|
||||
#define LOCAL_DEBUG
|
||||
|
||||
#include "chansrv.h"
|
||||
#include "fifo.h"
|
||||
#include "mlog.h"
|
||||
#include "os_calls.h"
|
||||
|
||||
/**
|
||||
@ -41,12 +41,12 @@
|
||||
int
|
||||
fifo_init(FIFO* fp, int num_entries)
|
||||
{
|
||||
log_debug_high("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "entered");
|
||||
|
||||
/* validate params */
|
||||
if (!fp)
|
||||
{
|
||||
log_debug_high("invalid parameters");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "invalid parameters");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -60,13 +60,13 @@ fifo_init(FIFO* fp, int num_entries)
|
||||
if (fp->user_data)
|
||||
{
|
||||
fp->entries = num_entries;
|
||||
log_debug_low("FIFO created; rd_ptr=%d wr_ptr=%d entries=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "FIFO created; rd_ptr=%d wr_ptr=%d entries=%d",
|
||||
fp->rd_ptr, fp->wr_ptr, fp->entries);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_error("FIFO create error; system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "FIFO create error; system out of memory");
|
||||
fp->entries = 0;
|
||||
return -1;
|
||||
}
|
||||
@ -82,11 +82,11 @@ fifo_init(FIFO* fp, int num_entries)
|
||||
int
|
||||
fifo_deinit(FIFO* fp)
|
||||
{
|
||||
log_debug_high("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "entered");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
log_debug_high("FIFO is null");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is null");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -112,11 +112,11 @@ fifo_deinit(FIFO* fp)
|
||||
int
|
||||
fifo_is_empty(FIFO* fp)
|
||||
{
|
||||
log_debug_high("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "entered");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
log_debug_high("FIFO is null");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is null");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -139,11 +139,11 @@ fifo_insert(FIFO* fp, void* data)
|
||||
int next_val; /* next value for wr_ptr */
|
||||
int i;
|
||||
|
||||
log_debug_high("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "entered");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
log_debug_high("FIFO is null");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is null");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -157,11 +157,11 @@ fifo_insert(FIFO* fp, void* data)
|
||||
lp = (long *) g_malloc(sizeof(long) * (fp->entries + 10), 1);
|
||||
if (!lp)
|
||||
{
|
||||
log_debug_low("FIFO full; cannot expand, no memory");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "FIFO full; cannot expand, no memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_debug_low("FIFO full, expanding by 10 entries");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "FIFO full, expanding by 10 entries");
|
||||
|
||||
/* copy old data new location */
|
||||
for (i = 0; i < (fp->entries - 1); i++)
|
||||
@ -182,7 +182,7 @@ fifo_insert(FIFO* fp, void* data)
|
||||
fp->user_data = lp;
|
||||
}
|
||||
|
||||
log_debug_low("inserting data at index %d", fp->wr_ptr);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "inserting data at index %d", fp->wr_ptr);
|
||||
|
||||
fp->user_data[fp->wr_ptr] = (long) data;
|
||||
fp->wr_ptr = next_val;
|
||||
@ -202,27 +202,27 @@ fifo_remove(FIFO* fp)
|
||||
{
|
||||
long data;
|
||||
|
||||
log_debug_high("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "entered");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
log_debug_high("FIFO is null");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is null");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fp->rd_ptr == fp->wr_ptr)
|
||||
{
|
||||
log_debug_high("FIFO is empty");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is empty");
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_debug_low("removing data at index %d", fp->rd_ptr);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "removing data at index %d", fp->rd_ptr);
|
||||
|
||||
data = fp->user_data[fp->rd_ptr++];
|
||||
|
||||
if (fp->rd_ptr >= fp->entries)
|
||||
{
|
||||
log_debug_high("FIFO rd_ptr wrapped around");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO rd_ptr wrapped around");
|
||||
fp->rd_ptr = 0;
|
||||
}
|
||||
|
||||
@ -239,21 +239,21 @@ fifo_remove(FIFO* fp)
|
||||
void*
|
||||
fifo_peek(FIFO* fp)
|
||||
{
|
||||
log_debug_high("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "entered");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
log_debug_high("FIFO is null");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is null");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fp->rd_ptr == fp->wr_ptr)
|
||||
{
|
||||
log_debug_high("FIFO is empty");
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "FIFO is empty");
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_debug_low("peeking data at index %d", fp->rd_ptr);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "peeking data at index %d", fp->rd_ptr);
|
||||
|
||||
return (void *) fp->user_data[fp->rd_ptr];
|
||||
}
|
||||
|
@ -25,46 +25,11 @@
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include "chansrv.h"
|
||||
#include "parse.h"
|
||||
#include "os_calls.h"
|
||||
#include "irp.h"
|
||||
|
||||
/* module based logging */
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG 2
|
||||
|
||||
#ifndef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_ERROR
|
||||
#endif
|
||||
|
||||
#define log_error(_params...) \
|
||||
{ \
|
||||
g_write("[%10.10u]: IRP %s: %d : ERROR: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
}
|
||||
|
||||
#define log_info(_params...) \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: IRP %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define log_debug(_params...) \
|
||||
{ \
|
||||
if (LOG_DEBUG <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: IRP %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
}
|
||||
|
||||
IRP *g_irp_head = NULL;
|
||||
|
||||
/**
|
||||
@ -78,13 +43,13 @@ IRP * devredir_irp_new(void)
|
||||
IRP *irp;
|
||||
IRP *irp_last;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* create new IRP */
|
||||
irp = g_new0(IRP, 1);
|
||||
if (irp == NULL)
|
||||
{
|
||||
log_error("system out of memory!");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -100,7 +65,7 @@ IRP * devredir_irp_new(void)
|
||||
irp->prev = irp_last;
|
||||
}
|
||||
|
||||
log_debug("new IRP=%p", irp);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "new IRP=%p", irp);
|
||||
return irp;
|
||||
}
|
||||
|
||||
@ -140,13 +105,13 @@ IRP * devredir_irp_with_pathnamelen_new(unsigned int pathnamelen)
|
||||
IRP *irp;
|
||||
IRP *irp_last;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* create new IRP with space on end for the pathname and a terminator */
|
||||
irp = (IRP *)g_malloc(sizeof(IRP) + (pathnamelen + 1), 1);
|
||||
if (irp == NULL)
|
||||
{
|
||||
log_error("system out of memory!");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -164,7 +129,7 @@ IRP * devredir_irp_with_pathnamelen_new(unsigned int pathnamelen)
|
||||
irp->prev = irp_last;
|
||||
}
|
||||
|
||||
log_debug("new IRP=%p", irp);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "new IRP=%p", irp);
|
||||
return irp;
|
||||
}
|
||||
|
||||
@ -181,7 +146,7 @@ int devredir_irp_delete(IRP *irp)
|
||||
if ((irp == NULL) || (lirp == NULL))
|
||||
return -1;
|
||||
|
||||
log_debug("irp=%p completion_id=%d type=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "irp=%p completion_id=%d type=%d",
|
||||
irp, irp->CompletionId, irp->completion_type);
|
||||
|
||||
devredir_irp_dump(); // LK_TODO
|
||||
@ -244,14 +209,14 @@ IRP *devredir_irp_find(tui32 completion_id)
|
||||
{
|
||||
if (irp->CompletionId == completion_id)
|
||||
{
|
||||
log_debug("returning irp=%p", irp);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "returning irp=%p", irp);
|
||||
return irp;
|
||||
}
|
||||
|
||||
irp = irp->next;
|
||||
}
|
||||
|
||||
log_debug("returning irp=NULL");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "returning irp=NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -263,14 +228,14 @@ IRP * devredir_irp_find_by_fileid(tui32 FileId)
|
||||
{
|
||||
if (irp->FileId == FileId)
|
||||
{
|
||||
log_debug("returning irp=%p", irp);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "returning irp=%p", irp);
|
||||
return irp;
|
||||
}
|
||||
|
||||
irp = irp->next;
|
||||
}
|
||||
|
||||
log_debug("returning irp=NULL");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "returning irp=NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -290,7 +255,7 @@ IRP * devredir_irp_get_last(void)
|
||||
irp = irp->next;
|
||||
}
|
||||
|
||||
log_debug("returning irp=%p", irp);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "returning irp=%p", irp);
|
||||
return irp;
|
||||
}
|
||||
|
||||
@ -298,13 +263,13 @@ void devredir_irp_dump(void)
|
||||
{
|
||||
IRP *irp = g_irp_head;
|
||||
|
||||
log_debug("------- dumping IRPs --------");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "------- dumping IRPs --------");
|
||||
while (irp)
|
||||
{
|
||||
log_debug(" completion_id=%d\tcompletion_type=%d\tFileId=%d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " completion_id=%d\tcompletion_type=%d\tFileId=%d",
|
||||
irp->CompletionId, irp->completion_type, irp->FileId);
|
||||
|
||||
irp = irp->next;
|
||||
}
|
||||
log_debug("------- dumping IRPs done ---");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "------- dumping IRPs done ---");
|
||||
}
|
||||
|
@ -1,112 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Laxmikant Rashinkar 2013 LK.Rashinkar@gmail.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* module based logging */
|
||||
|
||||
#ifndef _MLOG_H
|
||||
#define _MLOG_H
|
||||
|
||||
/*
|
||||
* Note1: to enable debug messages, in your .c file, #define LOCAL_DEBUG
|
||||
* BEFORE including this file
|
||||
*
|
||||
* Note2: in your .c file, #define MODULE_NAME, 8 chars long, to print each
|
||||
* log entry with your module name
|
||||
*/
|
||||
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG_LOW 2
|
||||
#define LOG_DEBUG_HIGH 3
|
||||
#define LOG_LEVEL LOG_ERROR
|
||||
|
||||
/*
|
||||
* print always
|
||||
*/
|
||||
|
||||
#define log_error(_params...) \
|
||||
do \
|
||||
{ \
|
||||
g_write("[%10.10u]: %s %s: %d: ERROR: ", g_time3(), \
|
||||
MODULE_NAME, __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define log_always(_params...) \
|
||||
do \
|
||||
{ \
|
||||
g_write("[%10.10u]: %s %s: %d: ALWAYS: ", g_time3(), \
|
||||
MODULE_NAME, __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
/*
|
||||
* print conditionally
|
||||
*/
|
||||
|
||||
#ifdef LOCAL_DEBUG
|
||||
#define log_info(_params...) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: %s %s: %d: INFO: ", g_time3(), \
|
||||
MODULE_NAME, __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define log_info(_params...)
|
||||
#endif
|
||||
|
||||
#ifdef LOCAL_DEBUG
|
||||
#define log_debug_low(_params...) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_DEBUG_LOW <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: %s %s: %d: DEBUG: ", g_time3(), \
|
||||
MODULE_NAME, __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define log_debug_low(_params...)
|
||||
#endif
|
||||
|
||||
#ifdef LOCAL_DEBUG
|
||||
#define log_debug_high(_params...) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_DEBUG_HIGH <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: %s %s: %d: DEBUG: ", g_time3(), \
|
||||
MODULE_NAME, __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define log_debug_high(_params...)
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef _MLOG_H */
|
@ -196,7 +196,7 @@ rail_get_window_data(Window window)
|
||||
unsigned char* prop_return;
|
||||
struct rail_window_data* rv;
|
||||
|
||||
LOG(10, ("chansrv::rail_get_window_data:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_get_window_data:");
|
||||
rv = 0;
|
||||
actual_type_return = 0;
|
||||
actual_format_return = 0;
|
||||
@ -283,7 +283,7 @@ rail_send_init(void)
|
||||
int bytes;
|
||||
char *size_ptr;
|
||||
|
||||
LOG(10, ("chansrv::rail_send_init:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_send_init:");
|
||||
make_stream(s);
|
||||
init_stream(s, 8182);
|
||||
out_uint16_le(s, TS_RAIL_ORDER_HANDSHAKE);
|
||||
@ -337,7 +337,7 @@ rail_is_another_wm_running(void)
|
||||
int
|
||||
rail_init(void)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_init:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_init:");
|
||||
xcommon_init();
|
||||
|
||||
return 0;
|
||||
@ -387,11 +387,11 @@ rail_startup(void)
|
||||
|
||||
if (g_xrr_event_base > 0)
|
||||
{
|
||||
LOG(0, ("rail_init: found RandR extension"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "rail_init: found RandR extension");
|
||||
st = XRRQueryVersion(g_display, &ver_maj, &ver_min);
|
||||
if (st)
|
||||
{
|
||||
LOG(0, ("rail_init: RandR version major %d minor %d", ver_maj, ver_min));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "rail_init: RandR version major %d minor %d", ver_maj, ver_min);
|
||||
}
|
||||
XRRSelectInput(g_display, g_root_window, RRScreenChangeNotifyMask);
|
||||
}
|
||||
@ -453,7 +453,7 @@ rail_process_exec(struct stream *s, int size)
|
||||
char *WorkingDir;
|
||||
char *Arguments;
|
||||
|
||||
LOG(0, ("chansrv::rail_process_exec:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "chansrv::rail_process_exec:");
|
||||
in_uint16_le(s, flags);
|
||||
in_uint16_le(s, ExeOrFileLength);
|
||||
in_uint16_le(s, WorkingDirLength);
|
||||
@ -461,23 +461,23 @@ rail_process_exec(struct stream *s, int size)
|
||||
ExeOrFile = read_uni(s, ExeOrFileLength);
|
||||
WorkingDir = read_uni(s, WorkingDirLength);
|
||||
Arguments = read_uni(s, ArgumentsLen);
|
||||
LOG(10, (" flags 0x%8.8x ExeOrFileLength %d WorkingDirLength %d "
|
||||
LOG(LOG_LEVEL_DEBUG, " flags 0x%8.8x ExeOrFileLength %d WorkingDirLength %d "
|
||||
"ArgumentsLen %d ExeOrFile [%s] WorkingDir [%s] "
|
||||
"Arguments [%s]", flags, ExeOrFileLength, WorkingDirLength,
|
||||
ArgumentsLen, ExeOrFile, WorkingDir, Arguments));
|
||||
ArgumentsLen, ExeOrFile, WorkingDir, Arguments);
|
||||
|
||||
if (g_strlen(ExeOrFile) > 0)
|
||||
{
|
||||
rail_startup();
|
||||
|
||||
LOG(10, ("rail_process_exec: pre"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "rail_process_exec: pre");
|
||||
/* ask main thread to fork */
|
||||
tc_mutex_lock(g_exec_mutex);
|
||||
g_exec_name = ExeOrFile;
|
||||
g_set_wait_obj(g_exec_event);
|
||||
tc_sem_dec(g_exec_sem);
|
||||
tc_mutex_unlock(g_exec_mutex);
|
||||
LOG(10, ("rail_process_exec: post"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "rail_process_exec: post");
|
||||
}
|
||||
|
||||
g_free(ExeOrFile);
|
||||
@ -512,7 +512,7 @@ rail_win_popdown(void)
|
||||
window_attributes.map_state == IsViewable &&
|
||||
list_index_of(g_window_list, children[i]) >= 0)
|
||||
{
|
||||
LOG(10, (" dismiss pop up 0x%8.8lx", children[i]));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " dismiss pop up 0x%8.8lx", children[i]);
|
||||
rail_send_key_esc(children[i]);
|
||||
rv = 1;
|
||||
}
|
||||
@ -528,7 +528,7 @@ rail_close_window(int window_id)
|
||||
{
|
||||
XEvent ce;
|
||||
|
||||
LOG(0, ("chansrv::rail_close_window:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "chansrv::rail_close_window:");
|
||||
|
||||
rail_win_popdown();
|
||||
|
||||
@ -549,10 +549,10 @@ rail_close_window(int window_id)
|
||||
void
|
||||
my_timeout(void* data)
|
||||
{
|
||||
LOG(10, ("my_timeout: g_got_focus %d", g_got_focus));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "my_timeout: g_got_focus %d", g_got_focus);
|
||||
if (g_focus_counter == (int)(long)data)
|
||||
{
|
||||
LOG(10, ("my_timeout: g_focus_counter %d", g_focus_counter));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "my_timeout: g_focus_counter %d", g_focus_counter);
|
||||
rail_win_popdown();
|
||||
}
|
||||
}
|
||||
@ -567,21 +567,21 @@ rail_process_activate(struct stream *s, int size)
|
||||
XWindowAttributes window_attributes;
|
||||
Window transient_for = 0;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_activate:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_activate:");
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint8(s, enabled);
|
||||
|
||||
index = list_index_of(g_window_list, window_id);
|
||||
if (index < 0)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_activate: window 0x%8.8x not in list",
|
||||
window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_activate: window 0x%8.8x not in list",
|
||||
window_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_focus_counter++;
|
||||
g_got_focus = enabled;
|
||||
LOG(10, (" window_id 0x%8.8x enabled %d", window_id, enabled));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x enabled %d", window_id, enabled);
|
||||
|
||||
XGetWindowAttributes(g_display, window_id, &window_attributes);
|
||||
|
||||
@ -606,18 +606,18 @@ rail_process_activate(struct stream *s, int size)
|
||||
/* Owner window should be raised up as well */
|
||||
XRaiseWindow(g_display, transient_for);
|
||||
}
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id);
|
||||
XRaiseWindow(g_display, window_id);
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XSetInputFocus 0x%8.8x", 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);
|
||||
}
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id);
|
||||
XRaiseWindow(g_display, window_id);
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XSetInputFocus 0x%8.8x", 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 {
|
||||
LOG(10, (" window attributes: override_redirect %d",
|
||||
window_attributes.override_redirect));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window attributes: override_redirect %d",
|
||||
window_attributes.override_redirect);
|
||||
add_timeout(200, my_timeout, (void*)(long)g_focus_counter);
|
||||
}
|
||||
return 0;
|
||||
@ -672,9 +672,9 @@ rail_process_system_param(struct stream *s, int size)
|
||||
{
|
||||
int system_param;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_system_param:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_system_param:");
|
||||
in_uint32_le(s, system_param);
|
||||
LOG(10, (" system_param 0x%8.8x", system_param));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " system_param 0x%8.8x", system_param);
|
||||
/*
|
||||
* Ask client to re-create the existing rail windows. This is supposed
|
||||
* to be done after handshake and client is initialised properly, we
|
||||
@ -682,7 +682,7 @@ rail_process_system_param(struct stream *s, int size)
|
||||
*/
|
||||
if (system_param == 0x0000002F) /*SPI_SET_WORK_AREA*/
|
||||
{
|
||||
LOG(10, (" restore rail windows"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " restore rail windows");
|
||||
rail_restore_windows();
|
||||
}
|
||||
return 0;
|
||||
@ -705,7 +705,7 @@ rail_get_property(Display* display, Window target, Atom type, Atom property,
|
||||
if ((ret != Success || nitems < 1) && atom_return == None)
|
||||
{
|
||||
prop_name = XGetAtomName(g_display, property);
|
||||
LOG(10, (" rail_get_property %s: failed", prop_name));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " rail_get_property %s: failed", prop_name);
|
||||
XFree(prop_name);
|
||||
return 1;
|
||||
}
|
||||
@ -744,7 +744,7 @@ rail_win_get_state(Window win)
|
||||
{
|
||||
rv = *(unsigned long *)data;
|
||||
XFree(data);
|
||||
LOG(10, (" rail_win_get_state: %d", rv));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " rail_win_get_state: %d", rv);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -757,7 +757,7 @@ rail_win_set_state(Window win, unsigned long state)
|
||||
int old_state;
|
||||
unsigned long data[2] = { state, None };
|
||||
|
||||
LOG(10, (" rail_win_set_state: %ld", state));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " rail_win_set_state: %ld", state);
|
||||
/* check whether WM_STATE exists */
|
||||
old_state = rail_win_get_state(win);
|
||||
if (old_state == -1)
|
||||
@ -765,7 +765,7 @@ rail_win_set_state(Window win, unsigned long state)
|
||||
/* create WM_STATE property */
|
||||
XChangeProperty(g_display, win, g_wm_state, g_wm_state, 32, PropModeAppend,
|
||||
(unsigned char *)data, 2);
|
||||
LOG(10, (" rail_win_set_state: create WM_STATE property"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " rail_win_set_state: create WM_STATE property");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -819,7 +819,7 @@ rail_win_get_text(Window win, char **data)
|
||||
static int
|
||||
rail_minmax_window(int window_id, int max)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_minmax_window 0x%8.8x:", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_minmax_window 0x%8.8x:", window_id);
|
||||
if (max)
|
||||
{
|
||||
|
||||
@ -840,15 +840,15 @@ rail_restore_window(int window_id)
|
||||
{
|
||||
XWindowAttributes window_attributes;
|
||||
|
||||
LOG(10, ("chansrv::rail_restore_window 0x%8.8x:", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_restore_window 0x%8.8x:", window_id);
|
||||
XGetWindowAttributes(g_display, window_id, &window_attributes);
|
||||
if (window_attributes.map_state != IsViewable)
|
||||
{
|
||||
XMapWindow(g_display, window_id);
|
||||
}
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_activate: calling XRaiseWindow 0x%8.8x", window_id);
|
||||
XRaiseWindow(g_display, window_id);
|
||||
LOG(10, ("chansrv::rail_process_activate: calling XSetInputFocus 0x%8.8x", 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);
|
||||
|
||||
return 0;
|
||||
@ -862,50 +862,50 @@ rail_process_system_command(struct stream *s, int size)
|
||||
int command;
|
||||
int index;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_system_command:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_system_command:");
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, command);
|
||||
|
||||
index = list_index_of(g_window_list, window_id);
|
||||
if (index < 0)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_system_command: window 0x%8.8x not in list",
|
||||
window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_system_command: window 0x%8.8x not in list",
|
||||
window_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case SC_SIZE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_SIZE", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_SIZE", window_id);
|
||||
break;
|
||||
case SC_MOVE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_MOVE", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_MOVE", window_id);
|
||||
break;
|
||||
case SC_MINIMIZE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_MINIMIZE", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_MINIMIZE", window_id);
|
||||
rail_minmax_window(window_id, 0);
|
||||
break;
|
||||
case SC_MAXIMIZE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_MAXIMIZE", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_MAXIMIZE", window_id);
|
||||
break;
|
||||
case SC_CLOSE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_CLOSE", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_CLOSE", window_id);
|
||||
rail_close_window(window_id);
|
||||
break;
|
||||
case SC_KEYMENU:
|
||||
LOG(10, (" window_id 0x%8.8x SC_KEYMENU", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_KEYMENU", window_id);
|
||||
break;
|
||||
case SC_RESTORE:
|
||||
LOG(10, (" window_id 0x%8.8x SC_RESTORE", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_RESTORE", window_id);
|
||||
rail_restore_window(window_id);
|
||||
break;
|
||||
case SC_DEFAULT:
|
||||
LOG(10, (" window_id 0x%8.8x SC_DEFAULT", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x SC_DEFAULT", window_id);
|
||||
break;
|
||||
default:
|
||||
LOG(10, (" window_id 0x%8.8x unknown command command %d",
|
||||
window_id, command));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x unknown command command %d",
|
||||
window_id, command);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -918,9 +918,9 @@ rail_process_handshake(struct stream *s, int size)
|
||||
{
|
||||
int build_number;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_handshake:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_handshake:");
|
||||
in_uint32_le(s, build_number);
|
||||
LOG(10, (" build_number 0x%8.8x", build_number));
|
||||
LOG(LOG_LEVEL_DEBUG, " build_number 0x%8.8x", build_number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -932,12 +932,12 @@ rail_process_notify_event(struct stream *s, int size)
|
||||
int notify_id;
|
||||
int message;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_notify_event:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_notify_event:");
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint32_le(s, notify_id);
|
||||
in_uint32_le(s, message);
|
||||
LOG(10, (" window_id 0x%8.8x notify_id 0x%8.8x message 0x%8.8x",
|
||||
window_id, notify_id, message));
|
||||
LOG(LOG_LEVEL_DEBUG, " window_id 0x%8.8x notify_id 0x%8.8x message 0x%8.8x",
|
||||
window_id, notify_id, message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -953,7 +953,7 @@ rail_process_window_move(struct stream *s, int size)
|
||||
tsi16 si16;
|
||||
struct rail_window_data* rwd;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_window_move:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_window_move:");
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, si16);
|
||||
left = si16;
|
||||
@ -963,8 +963,8 @@ rail_process_window_move(struct stream *s, int size)
|
||||
right = si16;
|
||||
in_uint16_le(s, si16);
|
||||
bottom = si16;
|
||||
LOG(10, (" window_id 0x%8.8x left %d top %d right %d bottom %d width %d height %d",
|
||||
window_id, left, top, right, bottom, right - left, bottom - top));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window_id 0x%8.8x left %d top %d right %d bottom %d width %d height %d",
|
||||
window_id, left, top, right, bottom, right - left, bottom - top);
|
||||
XMoveResizeWindow(g_display, window_id, left, top, right - left, bottom - top);
|
||||
rwd = (struct rail_window_data*)
|
||||
g_malloc(sizeof(struct rail_window_data), 1);
|
||||
@ -988,7 +988,7 @@ rail_process_local_move_size(struct stream *s, int size)
|
||||
int pos_y;
|
||||
tsi16 si16;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_local_move_size:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_local_move_size:");
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, is_move_size_start);
|
||||
in_uint16_le(s, move_size_type);
|
||||
@ -996,9 +996,9 @@ rail_process_local_move_size(struct stream *s, int size)
|
||||
pos_x = si16;
|
||||
in_uint16_le(s, si16);
|
||||
pos_y = si16;
|
||||
LOG(10, (" window_id 0x%8.8x is_move_size_start %d move_size_type %d "
|
||||
LOG(LOG_LEVEL_DEBUG, " window_id 0x%8.8x is_move_size_start %d move_size_type %d "
|
||||
"pos_x %d pos_y %d", window_id, is_move_size_start, move_size_type,
|
||||
pos_x, pos_y));
|
||||
pos_x, pos_y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1007,7 +1007,7 @@ rail_process_local_move_size(struct stream *s, int size)
|
||||
static int
|
||||
rail_process_min_max_info(struct stream *s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_min_max_info:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_min_max_info:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1017,9 +1017,9 @@ rail_process_client_status(struct stream *s, int size)
|
||||
{
|
||||
int flags;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_client_status:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_client_status:");
|
||||
in_uint32_le(s, flags);
|
||||
LOG(10, (" flags 0x%8.8x", flags));
|
||||
LOG(LOG_LEVEL_DEBUG, " flags 0x%8.8x", flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1032,13 +1032,13 @@ rail_process_sys_menu(struct stream *s, int size)
|
||||
int top;
|
||||
tsi16 si16;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_sys_menu:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_sys_menu:");
|
||||
in_uint32_le(s, window_id);
|
||||
in_uint16_le(s, si16);
|
||||
left = si16;
|
||||
in_uint16_le(s, si16);
|
||||
top = si16;
|
||||
LOG(10, (" window_id 0x%8.8x left %d top %d", window_id, left, top));
|
||||
LOG(LOG_LEVEL_DEBUG, " window_id 0x%8.8x left %d top %d", window_id, left, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1048,9 +1048,9 @@ rail_process_lang_bar_info(struct stream *s, int size)
|
||||
{
|
||||
int language_bar_status;
|
||||
|
||||
LOG(10, ("chansrv::rail_process_lang_bar_info:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_lang_bar_info:");
|
||||
in_uint32_le(s, language_bar_status);
|
||||
LOG(10, (" language_bar_status 0x%8.8x", language_bar_status));
|
||||
LOG(LOG_LEVEL_DEBUG, " language_bar_status 0x%8.8x", language_bar_status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1058,7 +1058,7 @@ rail_process_lang_bar_info(struct stream *s, int size)
|
||||
static int
|
||||
rail_process_appid_req(struct stream *s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_appid_req:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_appid_req:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ rail_process_appid_req(struct stream *s, int size)
|
||||
static int
|
||||
rail_process_appid_resp(struct stream *s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_appid_resp:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_appid_resp:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1075,7 +1075,7 @@ rail_process_appid_resp(struct stream *s, int size)
|
||||
static int
|
||||
rail_process_exec_result(struct stream *s, int size)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_process_exec_result:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_process_exec_result:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1088,7 +1088,7 @@ rail_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
||||
int code;
|
||||
int size;
|
||||
|
||||
LOG(10, ("chansrv::rail_data_in:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_data_in:");
|
||||
in_uint8(s, code);
|
||||
in_uint8s(s, 1);
|
||||
in_uint16_le(s, size);
|
||||
@ -1141,7 +1141,7 @@ rail_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
||||
rail_process_exec_result(s, size);
|
||||
break;
|
||||
default:
|
||||
LOG(10, ("rail_data_in: unknown code %d size %d", code, size));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "rail_data_in: unknown code %d size %d", code, size);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1232,7 +1232,7 @@ rail_win_send_text(Window win)
|
||||
int crc;
|
||||
struct rail_window_data* rwd;
|
||||
|
||||
LOG(10, ("chansrv::rail_win_send_text:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_win_send_text:");
|
||||
len = rail_win_get_text(win, &data);
|
||||
rwd = rail_get_window_data_safe(win);
|
||||
if (rwd != 0)
|
||||
@ -1244,7 +1244,7 @@ rail_win_send_text(Window win)
|
||||
crc = get_string_crc(data);
|
||||
if (rwd->title_crc == crc)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_win_send_text: skipping, title not changed"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_win_send_text: skipping, title not changed");
|
||||
g_free(data);
|
||||
XFree(rwd);
|
||||
return 0;
|
||||
@ -1254,14 +1254,14 @@ rail_win_send_text(Window win)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(0, ("chansrv::rail_win_send_text: error rail_get_window_data_safe failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "chansrv::rail_win_send_text: error rail_get_window_data_safe failed");
|
||||
g_free(data);
|
||||
return 1;
|
||||
}
|
||||
if (data && len > 0)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_win_send_text: 0x%8.8lx text %s length %d",
|
||||
win, data, len));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_win_send_text: 0x%8.8lx text %s length %d",
|
||||
win, data, len);
|
||||
make_stream(s);
|
||||
init_stream(s, len + 1024);
|
||||
flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_FIELD_TITLE;
|
||||
@ -1290,7 +1290,7 @@ rail_destroy_window(Window window_id)
|
||||
{
|
||||
struct stream *s;
|
||||
|
||||
LOG(10, ("chansrv::rail_destroy_window 0x%8.8lx", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_destroy_window 0x%8.8lx", window_id);
|
||||
make_stream(s);
|
||||
init_stream(s, 1024);
|
||||
|
||||
@ -1310,7 +1310,7 @@ rail_show_window(Window window_id, int show_state)
|
||||
int flags;
|
||||
struct stream* s;
|
||||
|
||||
LOG(10, ("chansrv::rail_show_window 0x%8.8lx 0x%x", window_id, show_state));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_show_window 0x%8.8lx 0x%x", window_id, show_state);
|
||||
make_stream(s);
|
||||
init_stream(s, 1024);
|
||||
|
||||
@ -1352,31 +1352,31 @@ rail_create_window(Window window_id, Window owner_id)
|
||||
struct rail_window_data* rwd;
|
||||
struct stream* s;
|
||||
|
||||
LOG(10, ("chansrv::rail_create_window 0x%8.8lx", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_create_window 0x%8.8lx", window_id);
|
||||
|
||||
rwd = rail_get_window_data_safe(window_id);
|
||||
if (rwd == 0)
|
||||
{
|
||||
LOG(0, ("chansrv::rail_create_window: error rail_get_window_data_safe failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "chansrv::rail_create_window: error rail_get_window_data_safe failed");
|
||||
return 0;
|
||||
}
|
||||
XGetGeometry(g_display, window_id, &root, &x, &y, &width, &height,
|
||||
&border, &depth);
|
||||
XGetWindowAttributes(g_display, window_id, &attributes);
|
||||
|
||||
LOG(10, (" x %d y %d width %d height %d border_width %d", x, y, width,
|
||||
height, border));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " x %d y %d width %d height %d border_width %d", x, y, width,
|
||||
height, border);
|
||||
|
||||
index = list_index_of(g_window_list, window_id);
|
||||
if (index == -1)
|
||||
{
|
||||
LOG(10, (" create new window"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " create new window");
|
||||
flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_STATE_NEW;
|
||||
list_add_item(g_window_list, window_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(10, (" update existing window"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " update existing window");
|
||||
flags = WINDOW_ORDER_TYPE_WINDOW;
|
||||
}
|
||||
|
||||
@ -1416,7 +1416,7 @@ rail_create_window(Window window_id, Window owner_id)
|
||||
out_uint32_le(s, ext_style); /* extended_style */
|
||||
flags |= WINDOW_ORDER_FIELD_STYLE;
|
||||
out_uint32_le(s, 0x05); /* show_state */
|
||||
LOG(10, (" title %s", title_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " title %s", title_bytes);
|
||||
flags |= WINDOW_ORDER_FIELD_SHOW;
|
||||
if (title_size > 0)
|
||||
{
|
||||
@ -1433,7 +1433,7 @@ rail_create_window(Window window_id, Window owner_id)
|
||||
rwd->valid |= RWD_TITLE;
|
||||
rwd->title_crc = 0;
|
||||
}
|
||||
LOG(10, (" set title info %d", title_size));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " set title info %d", title_size);
|
||||
flags |= WINDOW_ORDER_FIELD_TITLE;
|
||||
out_uint32_le(s, 0); /* client_offset_x */
|
||||
out_uint32_le(s, 0); /* client_offset_y */
|
||||
@ -1504,15 +1504,15 @@ rail_configure_request_window(XConfigureRequestEvent* config)
|
||||
|
||||
window_id = config->window;
|
||||
mask = config->value_mask;
|
||||
LOG(10, ("chansrv::rail_configure_request_window: mask %d", mask));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_configure_request_window: mask %d", mask);
|
||||
if (mask & CWStackMode)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_configure_request_window: CWStackMode "
|
||||
"detail 0x%8.8x above 0x%8.8lx", config->detail, config->above));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_configure_request_window: CWStackMode "
|
||||
"detail 0x%8.8x above 0x%8.8lx", config->detail, config->above);
|
||||
if (config->detail == Above)
|
||||
{
|
||||
LOG(10, ("chansrv::rail_configure_request_window: bring to front "
|
||||
"window_id 0x%8.8x", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_configure_request_window: bring to front "
|
||||
"window_id 0x%8.8x", window_id);
|
||||
/* 0x05 - Show the window in its current size and position. */
|
||||
rail_show_window(window_id, 5);
|
||||
}
|
||||
@ -1621,17 +1621,17 @@ rail_configure_request_window(XConfigureRequestEvent* config)
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG(10, ("chansrv::rail_configure_request_window: 0x%8.8x", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_configure_request_window: 0x%8.8x", window_id);
|
||||
|
||||
|
||||
LOG(10, (" x %d y %d width %d height %d border_width %d", config->x,
|
||||
config->y, config->width, config->height, config->border_width));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " x %d y %d width %d height %d border_width %d", config->x,
|
||||
config->y, config->width, config->height, config->border_width);
|
||||
|
||||
index = list_index_of(g_window_list, window_id);
|
||||
if (index == -1)
|
||||
{
|
||||
/* window isn't mapped yet */
|
||||
LOG(0, ("chansrv::rail_configure_request_window: window not mapped"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "chansrv::rail_configure_request_window: window not mapped");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1706,11 +1706,11 @@ rail_configure_window(XConfigureEvent *config)
|
||||
|
||||
window_id = config->window;
|
||||
|
||||
LOG(10, ("chansrv::rail_configure_window 0x%8.8x", window_id));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_configure_window 0x%8.8x", window_id);
|
||||
|
||||
|
||||
LOG(10, (" x %d y %d width %d height %d border_width %d", config->x,
|
||||
config->y, config->width, config->height, config->border_width));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " x %d y %d width %d height %d border_width %d", config->x,
|
||||
config->y, config->width, config->height, config->border_width);
|
||||
|
||||
index = list_index_of(g_window_list, window_id);
|
||||
if (index == -1)
|
||||
@ -1778,7 +1778,7 @@ rail_configure_window(XConfigureEvent *config)
|
||||
static int
|
||||
rail_desktop_resize(XEvent *lxevent)
|
||||
{
|
||||
LOG(0, ("rail_desktop_resize:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "rail_desktop_resize:");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1795,7 +1795,7 @@ rail_xevent(void *xevent)
|
||||
XWindowAttributes wnd_attributes;
|
||||
char* prop_name;
|
||||
|
||||
LOG(10, ("chansrv::rail_xevent:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "chansrv::rail_xevent:");
|
||||
|
||||
if (!g_rail_up)
|
||||
{
|
||||
@ -1809,9 +1809,9 @@ rail_xevent(void *xevent)
|
||||
{
|
||||
case PropertyNotify:
|
||||
prop_name = XGetAtomName(g_display, lxevent->xproperty.atom);
|
||||
LOG(10, (" got PropertyNotify window_id 0x%8.8lx %s state new %d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got PropertyNotify window_id 0x%8.8lx %s state new %d",
|
||||
lxevent->xproperty.window, prop_name,
|
||||
lxevent->xproperty.state == PropertyNewValue));
|
||||
lxevent->xproperty.state == PropertyNewValue);
|
||||
|
||||
if (list_index_of(g_window_list, lxevent->xproperty.window) < 0)
|
||||
{
|
||||
@ -1832,7 +1832,7 @@ rail_xevent(void *xevent)
|
||||
break;
|
||||
|
||||
case ConfigureRequest:
|
||||
LOG(10, (" got ConfigureRequest window_id 0x%8.8lx", lxevent->xconfigurerequest.window));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got ConfigureRequest window_id 0x%8.8lx", lxevent->xconfigurerequest.window);
|
||||
g_memset(&xwc, 0, sizeof(xwc));
|
||||
xwc.x = lxevent->xconfigurerequest.x;
|
||||
xwc.y = lxevent->xconfigurerequest.y;
|
||||
@ -1850,14 +1850,14 @@ rail_xevent(void *xevent)
|
||||
break;
|
||||
|
||||
case CreateNotify:
|
||||
LOG(10, (" got CreateNotify window 0x%8.8lx parent 0x%8.8lx",
|
||||
lxevent->xcreatewindow.window, lxevent->xcreatewindow.parent));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got CreateNotify window 0x%8.8lx parent 0x%8.8lx",
|
||||
lxevent->xcreatewindow.window, lxevent->xcreatewindow.parent);
|
||||
rail_select_input(lxevent->xcreatewindow.window);
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
LOG(10, (" got DestroyNotify window 0x%8.8lx event 0x%8.8lx",
|
||||
lxevent->xdestroywindow.window, lxevent->xdestroywindow.event));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got DestroyNotify window 0x%8.8lx event 0x%8.8lx",
|
||||
lxevent->xdestroywindow.window, lxevent->xdestroywindow.event);
|
||||
if (lxevent->xdestroywindow.window != lxevent->xdestroywindow.event)
|
||||
{
|
||||
break;
|
||||
@ -1872,13 +1872,13 @@ rail_xevent(void *xevent)
|
||||
break;
|
||||
|
||||
case MapRequest:
|
||||
LOG(10, (" got MapRequest window 0x%8.8lx", lxevent->xmaprequest.window));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got MapRequest window 0x%8.8lx", lxevent->xmaprequest.window);
|
||||
XMapWindow(g_display, lxevent->xmaprequest.window);
|
||||
break;
|
||||
|
||||
case MapNotify:
|
||||
LOG(10, (" got MapNotify window 0x%8.8lx event 0x%8.8lx",
|
||||
lxevent->xmap.window, lxevent->xmap.event));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got MapNotify window 0x%8.8lx event 0x%8.8lx",
|
||||
lxevent->xmap.window, lxevent->xmap.event);
|
||||
if (lxevent->xmap.window != lxevent->xmap.event)
|
||||
{
|
||||
break;
|
||||
@ -1903,7 +1903,7 @@ rail_xevent(void *xevent)
|
||||
break;
|
||||
|
||||
case UnmapNotify:
|
||||
LOG(10, (" got UnmapNotify 0x%8.8lx", lxevent->xunmap.event));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got UnmapNotify 0x%8.8lx", lxevent->xunmap.event);
|
||||
if (lxevent->xunmap.window != lxevent->xunmap.event)
|
||||
{
|
||||
break;
|
||||
@ -1911,7 +1911,7 @@ rail_xevent(void *xevent)
|
||||
if (is_window_valid_child_of_root(lxevent->xunmap.window))
|
||||
{
|
||||
index = list_index_of(g_window_list, lxevent->xunmap.window);
|
||||
LOG(10, (" window 0x%8.8lx is unmapped", lxevent->xunmap.window));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " window 0x%8.8lx is unmapped", lxevent->xunmap.window);
|
||||
if (index >= 0)
|
||||
{
|
||||
XGetWindowAttributes(g_display, lxevent->xunmap.window, &wnd_attributes);
|
||||
@ -1930,8 +1930,8 @@ rail_xevent(void *xevent)
|
||||
break;
|
||||
|
||||
case ConfigureNotify:
|
||||
LOG(10, (" got ConfigureNotify 0x%8.8lx event 0x%8.8lx", lxevent->xconfigure.window,
|
||||
lxevent->xconfigure.event));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got ConfigureNotify 0x%8.8lx event 0x%8.8lx", lxevent->xconfigure.window,
|
||||
lxevent->xconfigure.event);
|
||||
rv = 0;
|
||||
if (lxevent->xconfigure.event != lxevent->xconfigure.window ||
|
||||
lxevent->xconfigure.override_redirect)
|
||||
@ -1955,32 +1955,32 @@ rail_xevent(void *xevent)
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
LOG(10, (" got FocusIn"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got FocusIn");
|
||||
g_focus_win = lxevent->xfocus.window;
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
LOG(10, (" got FocusOut"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got FocusOut");
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
LOG(10, (" got ButtonPress"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got ButtonPress");
|
||||
break;
|
||||
|
||||
case EnterNotify:
|
||||
LOG(10, (" got EnterNotify"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got EnterNotify");
|
||||
break;
|
||||
|
||||
case LeaveNotify:
|
||||
LOG(10, (" got LeaveNotify"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got LeaveNotify");
|
||||
break;
|
||||
|
||||
case ReparentNotify:
|
||||
LOG(10, (" got ReparentNotify window 0x%8.8lx parent 0x%8.8lx "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " got ReparentNotify window 0x%8.8lx parent 0x%8.8lx "
|
||||
"event 0x%8.8lx x %d y %d override redirect %d",
|
||||
lxevent->xreparent.window, lxevent->xreparent.parent,
|
||||
lxevent->xreparent.event, lxevent->xreparent.x,
|
||||
lxevent->xreparent.y, lxevent->xreparent.override_redirect));
|
||||
lxevent->xreparent.y, lxevent->xreparent.override_redirect);
|
||||
|
||||
if (lxevent->xreparent.window != lxevent->xreparent.event)
|
||||
{
|
||||
|
@ -59,45 +59,6 @@
|
||||
* if TS Client's build number is >= 4,034 use SCREDIR_VERSION_LONGHORN
|
||||
*/
|
||||
|
||||
/* module based logging */
|
||||
#define LOG_ERROR 0
|
||||
#define LOG_INFO 1
|
||||
#define LOG_DEBUG 2
|
||||
|
||||
#undef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_INFO
|
||||
|
||||
#define log_error(_params...) \
|
||||
do \
|
||||
{ \
|
||||
g_write("[%10.10u]: SMART_CARD %s: %d : ERROR: ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} while (0)
|
||||
|
||||
#define log_info(_params...) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_INFO <= LOG_LEVEL) \
|
||||
{ \
|
||||
g_write("[%10.10u]: SMART_CARD %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define log_debug(_params...) \
|
||||
do \
|
||||
{ \
|
||||
if (LOG_DEBUG <= LOG_LEVEL) \
|
||||
if (2 <= 1) \
|
||||
{ \
|
||||
g_write("[%10.10u]: SMART_CARD %s: %d : ", \
|
||||
g_time3(), __func__, __LINE__); \
|
||||
g_writeln (_params); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* [MS-RDPESC] 3.1.4 */
|
||||
#define SCARD_IOCTL_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */
|
||||
#define SCARD_IOCTL_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */
|
||||
@ -301,11 +262,11 @@ static void scard_handle_GetAttrib_Return(struct stream *s, IRP *irp,
|
||||
void
|
||||
scard_device_announce(tui32 device_id)
|
||||
{
|
||||
log_debug("entered: device_id=%d", device_id);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered: device_id=%d", device_id);
|
||||
|
||||
if (g_smartcards_inited)
|
||||
{
|
||||
log_error("already init");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "already init");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,9 +276,13 @@ scard_device_announce(tui32 device_id)
|
||||
g_scard_index = scard_add_new_device(device_id);
|
||||
|
||||
if (g_scard_index < 0)
|
||||
log_debug("scard_add_new_device failed with DeviceId=%d", g_device_id);
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "scard_add_new_device failed with DeviceId=%d", g_device_id);
|
||||
}
|
||||
else
|
||||
log_debug("added smartcard with DeviceId=%d to list", g_device_id);
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "added smartcard with DeviceId=%d to list", g_device_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -344,7 +309,7 @@ scard_check_wait_objs(void)
|
||||
int
|
||||
scard_init(void)
|
||||
{
|
||||
LOG(0, ("scard_init:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "scard_init:");
|
||||
return scard_pcsc_init();
|
||||
}
|
||||
|
||||
@ -354,7 +319,7 @@ scard_init(void)
|
||||
int
|
||||
scard_deinit(void)
|
||||
{
|
||||
LOG(0, ("scard_deinit:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "scard_deinit:");
|
||||
scard_pcsc_deinit();
|
||||
scard_release_resources();
|
||||
g_smartcards_inited = 0;
|
||||
@ -372,7 +337,7 @@ scard_send_establish_context(void *user_data, int scope)
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -400,7 +365,7 @@ scard_send_release_context(void *user_data,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -427,7 +392,7 @@ scard_send_is_valid_context(void *user_data, char *context, int context_bytes)
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -455,7 +420,7 @@ scard_send_list_readers(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
irp->scard_index = g_scard_index;
|
||||
@ -490,7 +455,7 @@ scard_send_get_status_change(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -522,7 +487,7 @@ scard_send_connect(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -558,7 +523,7 @@ scard_send_reconnect(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -589,7 +554,7 @@ scard_send_begin_transaction(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -622,7 +587,7 @@ scard_send_end_transaction(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -655,7 +620,7 @@ scard_send_status(void *user_data, int wide, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -687,7 +652,7 @@ scard_send_disconnect(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -720,7 +685,7 @@ scard_send_transmit(void *user_data, char *context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -752,7 +717,7 @@ scard_send_control(void *user_data, char* context, int context_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -782,7 +747,7 @@ scard_send_cancel(void *user_data, char *context, int context_bytes)
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -810,7 +775,7 @@ scard_send_get_attrib(void *user_data, char *card, int card_bytes,
|
||||
/* setup up IRP */
|
||||
if ((irp = devredir_irp_new()) == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -900,14 +865,14 @@ scard_add_new_device(tui32 device_id)
|
||||
|
||||
if ((index = scard_get_free_slot()) < 0)
|
||||
{
|
||||
log_error("scard_get_free_slot failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_get_free_slot failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
sc = g_new0(SMARTCARD, 1);
|
||||
if (sc == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "system out of memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -932,12 +897,12 @@ scard_get_free_slot(void)
|
||||
{
|
||||
if (smartcards[i] == NULL)
|
||||
{
|
||||
log_debug("found free slot at index %d", i);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "found free slot at index %d", i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
log_error("too many smart card devices; rejecting this one");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "too many smart card devices; rejecting this one");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -970,7 +935,7 @@ scard_send_EstablishContext(IRP *irp, int scope)
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_ESTABLISH_CONTEXT)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1013,13 +978,13 @@ scard_send_ReleaseContext(IRP *irp, char *context, int context_bytes)
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_RELEASE_CONTEXT)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1064,13 +1029,13 @@ scard_send_IsContextValid(IRP *irp, char *context, int context_bytes)
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_IS_VALID_CONTEXT)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1134,7 +1099,7 @@ scard_send_ListReaders(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1143,7 +1108,7 @@ scard_send_ListReaders(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, ioctl)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1267,7 +1232,7 @@ scard_send_GetStatusChange(IRP* irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1276,7 +1241,7 @@ scard_send_GetStatusChange(IRP* irp, char *context, int context_bytes,
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, ioctl)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1395,7 +1360,7 @@ scard_send_Connect(IRP* irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1404,7 +1369,7 @@ scard_send_Connect(IRP* irp, char *context, int context_bytes,
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, ioctl)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1488,13 +1453,13 @@ scard_send_Reconnect(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_RECONNECT)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1558,13 +1523,13 @@ scard_send_BeginTransaction(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_BEGIN_TRANSACTION)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1626,13 +1591,13 @@ scard_send_EndTransaction(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_END_TRANSACTION)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1694,14 +1659,14 @@ scard_send_Status(IRP *irp, int wide, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
ioctl = wide ? SCARD_IOCTL_STATUS_W : SCARD_IOCTL_STATUS_A;
|
||||
if ((s = scard_make_new_ioctl(irp, ioctl)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
@ -1780,13 +1745,13 @@ scard_send_Disconnect(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_DISCONNECT)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl failed");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1848,17 +1813,17 @@ scard_send_Transmit(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_TRANSMIT)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl");
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_debug("send_bytes %d recv_bytes %d send dwProtocol %d cbPciLength %d "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "send_bytes %d recv_bytes %d send dwProtocol %d cbPciLength %d "
|
||||
"extra_bytes %d recv dwProtocol %d cbPciLength %d extra_bytes %d",
|
||||
send_bytes, recv_bytes, send_ior->dwProtocol, send_ior->cbPciLength,
|
||||
send_ior->extra_bytes, recv_ior->dwProtocol, recv_ior->cbPciLength,
|
||||
@ -2039,13 +2004,13 @@ scard_send_Control(IRP *irp, char *context, int context_bytes,
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_CONTROL)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2112,13 +2077,13 @@ scard_send_Cancel(IRP *irp, char *context, int context_bytes)
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_CANCEL)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2164,13 +2129,13 @@ scard_send_GetAttrib(IRP *irp, char *card, int card_bytes, READER_STATE *rs)
|
||||
|
||||
if ((sc = smartcards[irp->scard_index]) == NULL)
|
||||
{
|
||||
log_error("smartcards[%d] is NULL", irp->scard_index);
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "smartcards[%d] is NULL", irp->scard_index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((s = scard_make_new_ioctl(irp, SCARD_IOCTL_GETATTRIB)) == NULL)
|
||||
{
|
||||
log_error("scard_make_new_ioctl");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "scard_make_new_ioctl");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2230,18 +2195,18 @@ scard_handle_EstablishContext_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
/* get OutputBufferLen */
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_establish_context_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2254,18 +2219,18 @@ scard_handle_ReleaseContext_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
/* get OutputBufferLen */
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_release_context_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2278,12 +2243,12 @@ scard_handle_IsContextValid_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2291,7 +2256,7 @@ scard_handle_IsContextValid_Return(struct stream *s, IRP *irp,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_is_context_valid_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2304,18 +2269,18 @@ scard_handle_ListReaders_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
/* get OutputBufferLen */
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_list_readers_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2328,18 +2293,18 @@ scard_handle_GetStatusChange_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
/* get OutputBufferLen */
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_get_status_change_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2352,12 +2317,12 @@ scard_handle_Connect_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2367,7 +2332,7 @@ scard_handle_Connect_Return(struct stream *s, IRP *irp,
|
||||
scard_function_connect_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2380,12 +2345,12 @@ scard_handle_Reconnect_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2393,7 +2358,7 @@ scard_handle_Reconnect_Return(struct stream *s, IRP *irp,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_reconnect_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2406,12 +2371,12 @@ scard_handle_BeginTransaction_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2419,7 +2384,7 @@ scard_handle_BeginTransaction_Return(struct stream *s, IRP *irp,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_begin_transaction_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2432,12 +2397,12 @@ scard_handle_EndTransaction_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2445,7 +2410,7 @@ scard_handle_EndTransaction_Return(struct stream *s, IRP *irp,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_end_transaction_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2458,12 +2423,12 @@ scard_handle_Status_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2471,7 +2436,7 @@ scard_handle_Status_Return(struct stream *s, IRP *irp,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_status_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2484,12 +2449,12 @@ scard_handle_Disconnect_Return(struct stream *s, IRP *irp,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2497,7 +2462,7 @@ scard_handle_Disconnect_Return(struct stream *s, IRP *irp,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_disconnect_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2509,12 +2474,12 @@ scard_handle_Transmit_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2522,7 +2487,7 @@ scard_handle_Transmit_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_transmit_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2534,12 +2499,12 @@ scard_handle_Control_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2547,7 +2512,7 @@ scard_handle_Control_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_control_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2559,12 +2524,12 @@ scard_handle_Cancel_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2572,7 +2537,7 @@ scard_handle_Cancel_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_cancel_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2584,12 +2549,12 @@ scard_handle_GetAttrib_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
{
|
||||
tui32 len;
|
||||
|
||||
log_debug("entered");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "entered");
|
||||
|
||||
/* sanity check */
|
||||
if ((DeviceId != irp->DeviceId) || (CompletionId != irp->CompletionId))
|
||||
{
|
||||
log_error("DeviceId/CompletionId do not match those in IRP");
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "DeviceId/CompletionId do not match those in IRP");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2597,5 +2562,5 @@ scard_handle_GetAttrib_Return(struct stream *s, IRP *irp, tui32 DeviceId,
|
||||
xstream_rd_u32_le(s, len);
|
||||
scard_function_get_attrib_return(irp->user_data, s, len, IoStatus);
|
||||
devredir_irp_delete(irp);
|
||||
log_debug("leaving");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "leaving");
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ sound_send_server_output_formats(void)
|
||||
|
||||
num_formats = sizeof(g_wave_outp_formats) /
|
||||
sizeof(g_wave_outp_formats[0]) - 1;
|
||||
LOG(10, ("sound_send_server_output_formats: num_formats %d", num_formats));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_server_output_formats: num_formats %d", num_formats);
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8182);
|
||||
@ -369,14 +369,14 @@ sound_process_output_format(int aindex, int wFormatTag, int nChannels,
|
||||
int nBlockAlign, int wBitsPerSample,
|
||||
int cbSize, char *data)
|
||||
{
|
||||
LOG(1, ("sound_process_output_format:"));
|
||||
LOG(1, (" wFormatTag %d", wFormatTag));
|
||||
LOG(1, (" nChannels %d", nChannels));
|
||||
LOG(1, (" nSamplesPerSec %d", nSamplesPerSec));
|
||||
LOG(1, (" nAvgBytesPerSec %d", nAvgBytesPerSec));
|
||||
LOG(1, (" nBlockAlign %d", nBlockAlign));
|
||||
LOG(1, (" wBitsPerSample %d", wBitsPerSample));
|
||||
LOG(1, (" cbSize %d", cbSize));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_process_output_format:");
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " wFormatTag %d", wFormatTag);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " nChannels %d", nChannels);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " nSamplesPerSec %d", nSamplesPerSec);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " nAvgBytesPerSec %d", nAvgBytesPerSec);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " nBlockAlign %d", nBlockAlign);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " wBitsPerSample %d", wBitsPerSample);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " cbSize %d", cbSize);
|
||||
|
||||
g_hexdump(data, cbSize);
|
||||
|
||||
@ -410,17 +410,17 @@ sound_process_output_format(int aindex, int wFormatTag, int nChannels,
|
||||
switch(wFormatTag)
|
||||
{
|
||||
case WAVE_FORMAT_AAC:
|
||||
LOG(0, ("wFormatTag, fdk aac"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "wFormatTag, fdk aac");
|
||||
g_client_does_fdk_aac = 1;
|
||||
g_client_fdk_aac_index = aindex;
|
||||
break;
|
||||
case WAVE_FORMAT_MPEGLAYER3:
|
||||
LOG(0, ("wFormatTag, mp3"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "wFormatTag, mp3");
|
||||
g_client_does_mp3lame = 1;
|
||||
g_client_mp3lame_index = aindex;
|
||||
break;
|
||||
case WAVE_FORMAT_OPUS:
|
||||
LOG(0, ("wFormatTag, opus"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "wFormatTag, opus");
|
||||
g_client_does_opus = 1;
|
||||
g_client_opus_index = aindex;
|
||||
break;
|
||||
@ -520,12 +520,12 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
if (g_fdk_aac_encoder == 0)
|
||||
{
|
||||
/* init fdk aac encoder */
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: using fdk aac"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: using fdk aac");
|
||||
|
||||
error = aacEncOpen(&g_fdk_aac_encoder, 0, 2);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncOpen() failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_wave_compress_fdk_aac: aacEncOpen() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -533,8 +533,8 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
error = aacEncoder_SetParam(g_fdk_aac_encoder, AACENC_AOT, aot);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_AOT failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_AOT failed");
|
||||
}
|
||||
|
||||
sample_rate = g_fdk_aac_44100.nSamplesPerSec;
|
||||
@ -542,8 +542,8 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
sample_rate);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_SAMPLERATE failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_SAMPLERATE failed");
|
||||
}
|
||||
|
||||
mode = MODE_2;
|
||||
@ -551,8 +551,8 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
AACENC_CHANNELMODE, mode);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_CHANNELMODE failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_CHANNELMODE failed");
|
||||
}
|
||||
|
||||
channel_order = 1; /* WAVE file format channel ordering */
|
||||
@ -560,8 +560,8 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
channel_order);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_CHANNELORDER failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_CHANNELORDER failed");
|
||||
}
|
||||
|
||||
/* bytes rate to bit rate */
|
||||
@ -570,15 +570,15 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
bitrate);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_BITRATE failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_BITRATE failed");
|
||||
}
|
||||
|
||||
error = aacEncoder_SetParam(g_fdk_aac_encoder, AACENC_TRANSMUX, 0);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_TRANSMUX failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_TRANSMUX failed");
|
||||
}
|
||||
|
||||
afterburner = 1;
|
||||
@ -586,39 +586,39 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
afterburner);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_AFTERBURNER failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncoder_SetParam() "
|
||||
"AACENC_AFTERBURNER failed");
|
||||
}
|
||||
|
||||
error = aacEncEncode(g_fdk_aac_encoder, NULL, NULL, NULL, NULL);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: Unable to initialize "
|
||||
"the encoder"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: Unable to initialize "
|
||||
"the encoder");
|
||||
}
|
||||
|
||||
g_memset(&info, 0, sizeof(info));
|
||||
error = aacEncInfo(g_fdk_aac_encoder, &info);
|
||||
if (error != AACENC_OK)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncInfo failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac: aacEncInfo failed");
|
||||
}
|
||||
|
||||
LOG(0, ("sound_wave_compress_fdk_aac:"));
|
||||
LOG(0, (" AACENC_InfoStruct"));
|
||||
LOG(0, (" maxOutBufBytes %d", info.maxOutBufBytes));
|
||||
LOG(0, (" maxAncBytes %d", info.maxAncBytes));
|
||||
LOG(0, (" inBufFillLevel %d", info.inBufFillLevel));
|
||||
LOG(0, (" inputChannels %d", info.inputChannels));
|
||||
LOG(0, (" frameLength %d", info.frameLength));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_fdk_aac:");
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " AACENC_InfoStruct");
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " maxOutBufBytes %d", info.maxOutBufBytes);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " maxAncBytes %d", info.maxAncBytes);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " inBufFillLevel %d", info.inBufFillLevel);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " inputChannels %d", info.inputChannels);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " frameLength %d", info.frameLength);
|
||||
#if AACENCODER_LIB_VER_GTEQ(4, 0, 0)
|
||||
LOG(0, (" nDelay %d", info.nDelay));
|
||||
LOG(0, (" nDelayCore %d", info.nDelayCore));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " nDelay %d", info.nDelay);
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " nDelayCore %d", info.nDelayCore);
|
||||
#else
|
||||
LOG(0, (" encoderDelay %d", info.encoderDelay));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " encoderDelay %d", info.encoderDelay);
|
||||
#endif
|
||||
LOG(0, (" confBuf"));
|
||||
LOG(0, (" confSize %d", info.confSize));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " confBuf");
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " confSize %d", info.confSize);
|
||||
}
|
||||
|
||||
rv = data_bytes;
|
||||
@ -662,15 +662,15 @@ sound_wave_compress_fdk_aac(char *data, int data_bytes, int *format_index)
|
||||
if (error == AACENC_OK)
|
||||
{
|
||||
cdata_bytes = out_args.numOutBytes;
|
||||
LOG(10, ("sound_wave_compress_fdk_aac: aacEncEncode ok "
|
||||
"cdata_bytes %d", cdata_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_wave_compress_fdk_aac: aacEncEncode ok "
|
||||
"cdata_bytes %d", cdata_bytes);
|
||||
*format_index = g_client_fdk_aac_index;
|
||||
g_memcpy(data, cdata, cdata_bytes);
|
||||
rv = cdata_bytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_fdk_aac: aacEncEncode failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_wave_compress_fdk_aac: aacEncEncode failed");
|
||||
}
|
||||
g_free(cdata);
|
||||
|
||||
@ -717,7 +717,7 @@ sound_wave_compress_opus(char *data, int data_bytes, int *format_index)
|
||||
&error);
|
||||
if (g_opus_encoder == 0)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_opus: opus_encoder_create failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_wave_compress_opus: opus_encoder_create failed");
|
||||
return data_bytes;
|
||||
}
|
||||
}
|
||||
@ -783,29 +783,31 @@ sound_wave_compress_mp3lame(char *data, int data_bytes, int *format_index)
|
||||
if (g_lame_encoder == 0)
|
||||
{
|
||||
/* init mp3 lame encoder */
|
||||
LOG(0, ("sound_wave_compress_mp3lame: using mp3lame"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_mp3lame: using mp3lame");
|
||||
|
||||
g_lame_encoder = lame_init();
|
||||
if (g_lame_encoder == 0)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_mp3lame: lame_init() failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_mp3lame: lame_init() failed");
|
||||
return rv;
|
||||
}
|
||||
lame_set_num_channels(g_lame_encoder, g_mp3lame_44100.nChannels);
|
||||
lame_set_in_samplerate(g_lame_encoder, g_mp3lame_44100.nSamplesPerSec);
|
||||
//lame_set_brate(g_lame_encoder, 64);
|
||||
lame_set_quality(g_lame_encoder, 7);
|
||||
if (lame_init_params(g_lame_encoder) == -1)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress_mp3lame: lame_init_params() failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_wave_compress_mp3lame: lame_init_params() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
LOG(0, ("sound_wave_compress_mp3lame: lame config:"));
|
||||
LOG(0, (" brate : %d", lame_get_brate(g_lame_encoder)));
|
||||
LOG(0, (" compression ratio: %f", lame_get_compression_ratio(g_lame_encoder)));
|
||||
LOG(0, (" encoder delay : %d", lame_get_encoder_delay(g_lame_encoder)));
|
||||
LOG(0, (" frame size : %d", lame_get_framesize(g_lame_encoder)));
|
||||
LOG(0, (" encoder padding : %d", lame_get_encoder_padding(g_lame_encoder)));
|
||||
LOG(0, (" mode : %d", lame_get_mode(g_lame_encoder)));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_wave_compress_mp3lame: lame config:");
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " brate : %d", lame_get_brate(g_lame_encoder));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " compression ratio: %f", lame_get_compression_ratio(g_lame_encoder));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " encoder delay : %d", lame_get_encoder_delay(g_lame_encoder));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " frame size : %d", lame_get_framesize(g_lame_encoder));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " encoder padding : %d", lame_get_encoder_padding(g_lame_encoder));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, " mode : %d", lame_get_mode(g_lame_encoder));
|
||||
}
|
||||
|
||||
odata_bytes = data_bytes;
|
||||
@ -823,8 +825,8 @@ sound_wave_compress_mp3lame(char *data, int data_bytes, int *format_index)
|
||||
cdata_bytes);
|
||||
if (cdata_bytes < 0)
|
||||
{
|
||||
LOG(0, ("sound_wave_compress: lame_encode_buffer_interleaved() "
|
||||
"failed, error %d", cdata_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_wave_compress: lame_encode_buffer_interleaved() "
|
||||
"failed, error %d", cdata_bytes);
|
||||
return rv;
|
||||
}
|
||||
if ((cdata_bytes > 0) && (cdata_bytes < odata_bytes))
|
||||
@ -882,11 +884,11 @@ sound_send_wave_data_chunk(char *data, int data_bytes)
|
||||
int format_index;
|
||||
char *size_ptr;
|
||||
|
||||
LOG(10, ("sound_send_wave_data_chunk: data_bytes %d", data_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data_chunk: data_bytes %d", data_bytes);
|
||||
|
||||
if ((data_bytes < 4) || (data_bytes > 128 * 1024))
|
||||
{
|
||||
LOG(0, ("sound_send_wave_data_chunk: bad data_bytes %d", data_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_send_wave_data_chunk: bad data_bytes %d", data_bytes);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -896,7 +898,7 @@ sound_send_wave_data_chunk(char *data, int data_bytes)
|
||||
|
||||
/* part one of 2 PDU wave info */
|
||||
|
||||
LOG(10, ("sound_send_wave_data_chunk: sending %d bytes", data_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data_chunk: sending %d bytes", data_bytes);
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 16 + data_bytes); /* some extra space */
|
||||
@ -910,8 +912,8 @@ sound_send_wave_data_chunk(char *data, int data_bytes)
|
||||
out_uint8(s, g_cBlockNo);
|
||||
g_sent_time[g_cBlockNo & 0xff] = time;
|
||||
|
||||
LOG(10, ("sound_send_wave_data_chunk: sending time %d, g_cBlockNo %d",
|
||||
time & 0xffff, g_cBlockNo & 0xff));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data_chunk: sending time %d, g_cBlockNo %d",
|
||||
time & 0xffff, g_cBlockNo & 0xff);
|
||||
|
||||
out_uint8s(s, 3);
|
||||
out_uint8a(s, data, 4);
|
||||
@ -948,7 +950,7 @@ sound_send_wave_data(char *data, int data_bytes)
|
||||
int error;
|
||||
int res;
|
||||
|
||||
LOG(10, ("sound_send_wave_data: sending %d bytes", data_bytes));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data: sending %d bytes", data_bytes);
|
||||
if (g_time_diff > g_best_time_diff + 250)
|
||||
{
|
||||
data_bytes = data_bytes / 4;
|
||||
@ -964,7 +966,7 @@ sound_send_wave_data(char *data, int data_bytes)
|
||||
chunk_bytes = MIN(space_left, data_bytes);
|
||||
if (chunk_bytes < 1)
|
||||
{
|
||||
LOG(10, ("sound_send_wave_data: error"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data: error");
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
@ -977,12 +979,12 @@ sound_send_wave_data(char *data, int data_bytes)
|
||||
if (res == 2)
|
||||
{
|
||||
/* don't need to error on this */
|
||||
LOG(0, ("sound_send_wave_data: dropped, no room"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_send_wave_data: dropped, no room");
|
||||
break;
|
||||
}
|
||||
else if (res != 0)
|
||||
{
|
||||
LOG(10, ("sound_send_wave_data: error"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_wave_data: error");
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
@ -1003,7 +1005,7 @@ sound_send_close(void)
|
||||
int bytes;
|
||||
char *size_ptr;
|
||||
|
||||
LOG(10, ("sound_send_close:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_close:");
|
||||
|
||||
g_best_time_diff = 0;
|
||||
g_buf_index = 0;
|
||||
@ -1032,7 +1034,7 @@ sound_process_training(struct stream *s, int size)
|
||||
int time_diff;
|
||||
|
||||
time_diff = g_time3() - g_training_sent_time;
|
||||
LOG(0, ("sound_process_training: round trip time %u", time_diff));
|
||||
LOG(LOG_LEVEL_INFO, "sound_process_training: round trip time %u", time_diff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1053,9 +1055,9 @@ sound_process_wave_confirm(struct stream *s, int size)
|
||||
in_uint8(s, cConfirmedBlockNo);
|
||||
time_diff = time - g_sent_time[cConfirmedBlockNo & 0xff];
|
||||
|
||||
LOG(10, ("sound_process_wave_confirm: wTimeStamp %d, "
|
||||
LOG(LOG_LEVEL_DEBUG, "sound_process_wave_confirm: wTimeStamp %d, "
|
||||
"cConfirmedBlockNo %d time diff %d",
|
||||
wTimeStamp, cConfirmedBlockNo, time_diff));
|
||||
wTimeStamp, cConfirmedBlockNo, time_diff);
|
||||
|
||||
acc = 0;
|
||||
list_add_item(g_ack_time_diff, time_diff);
|
||||
@ -1094,7 +1096,7 @@ process_pcm_message(int id, int size, struct stream *s)
|
||||
return sound_send_close();
|
||||
break;
|
||||
default:
|
||||
LOG(10, ("process_pcm_message: unknown id %d", id));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "process_pcm_message: unknown id %d", id);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
@ -1124,11 +1126,11 @@ sound_sndsrvr_sink_data_in(struct trans *trans)
|
||||
|
||||
if ((id & ~3) || (size > 128 * 1024 + 8) || (size < 8))
|
||||
{
|
||||
LOG(0, ("sound_sndsrvr_sink_data_in: bad message id %d size %d", id, size));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_sndsrvr_sink_data_in: bad message id %d size %d", id, size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOG(10, ("sound_sndsrvr_sink_data_in: good message id %d size %d", id, size));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_sndsrvr_sink_data_in: good message id %d size %d", id, size);
|
||||
|
||||
error = trans_force_read(trans, size - 8);
|
||||
|
||||
@ -1148,7 +1150,7 @@ sound_sndsrvr_sink_data_in(struct trans *trans)
|
||||
static int
|
||||
sound_sndsrvr_sink_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
{
|
||||
LOG(0, ("sound_sndsrvr_sink_conn_in:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_sndsrvr_sink_conn_in:");
|
||||
|
||||
if (trans == 0)
|
||||
return 1;
|
||||
@ -1178,7 +1180,7 @@ sound_sndsrvr_sink_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
static int
|
||||
sound_sndsrvr_source_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
{
|
||||
LOG(0, ("sound_sndsrvr_source_conn_in: client connected"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_sndsrvr_source_conn_in: client connected");
|
||||
|
||||
if (trans == 0)
|
||||
return 1;
|
||||
@ -1205,7 +1207,7 @@ sound_sndsrvr_source_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
int
|
||||
sound_init(void)
|
||||
{
|
||||
LOG(0, ("sound_init:"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "sound_init:");
|
||||
|
||||
g_stream_incoming_packet = NULL;
|
||||
|
||||
@ -1242,7 +1244,7 @@ sound_init(void)
|
||||
int
|
||||
sound_deinit(void)
|
||||
{
|
||||
LOG(10, ("sound_deinit:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_deinit:");
|
||||
if (g_audio_l_trans_out != 0)
|
||||
{
|
||||
trans_delete(g_audio_l_trans_out);
|
||||
@ -1327,7 +1329,7 @@ sound_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(10, ("sound_data_in: unknown code %d size %d", code, size));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "sound_data_in: unknown code %d size %d", code, size);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1384,7 +1386,7 @@ sound_check_wait_objs(void)
|
||||
{
|
||||
if (trans_check_wait_objs(g_audio_l_trans_out) != 0)
|
||||
{
|
||||
LOG(10, ("sound_check_wait_objs: g_audio_l_trans_out returned non-zero"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_check_wait_objs: g_audio_l_trans_out returned non-zero");
|
||||
trans_delete(g_audio_l_trans_out);
|
||||
g_audio_l_trans_out = 0;
|
||||
}
|
||||
@ -1394,7 +1396,7 @@ sound_check_wait_objs(void)
|
||||
{
|
||||
if (trans_check_wait_objs(g_audio_c_trans_out) != 0)
|
||||
{
|
||||
LOG(10, ("sound_check_wait_objs: g_audio_c_trans_out returned non-zero"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_check_wait_objs: g_audio_c_trans_out returned non-zero");
|
||||
trans_delete(g_audio_c_trans_out);
|
||||
g_audio_c_trans_out = 0;
|
||||
sound_start_sink_listener();
|
||||
@ -1405,7 +1407,7 @@ sound_check_wait_objs(void)
|
||||
{
|
||||
if (trans_check_wait_objs(g_audio_l_trans_in) != 0)
|
||||
{
|
||||
LOG(10, ("sound_check_wait_objs: g_audio_l_trans_in returned non-zero"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_check_wait_objs: g_audio_l_trans_in returned non-zero");
|
||||
trans_delete(g_audio_l_trans_in);
|
||||
g_audio_l_trans_in = 0;
|
||||
}
|
||||
@ -1415,7 +1417,7 @@ sound_check_wait_objs(void)
|
||||
{
|
||||
if (trans_check_wait_objs(g_audio_c_trans_in) != 0)
|
||||
{
|
||||
LOG(10, ("sound_check_wait_objs: g_audio_c_trans_in returned non-zero"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_check_wait_objs: g_audio_c_trans_in returned non-zero");
|
||||
trans_delete(g_audio_c_trans_in);
|
||||
g_audio_c_trans_in = 0;
|
||||
sound_start_source_listener();
|
||||
@ -1447,7 +1449,7 @@ sound_send_server_input_formats(void)
|
||||
|
||||
num_formats = sizeof(g_wave_inp_formats) /
|
||||
sizeof(g_wave_inp_formats[0]) - 1;
|
||||
LOG(10, ("sound_send_server_input_formats: num_formats %d", num_formats));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_send_server_input_formats: num_formats %d", num_formats);
|
||||
|
||||
make_stream(s);
|
||||
init_stream(s, 8182);
|
||||
@ -1510,14 +1512,14 @@ sound_process_input_format(int aindex, int wFormatTag, int nChannels,
|
||||
int nBlockAlign, int wBitsPerSample,
|
||||
int cbSize, char *data)
|
||||
{
|
||||
LOG(10, ("sound_process_input_format:"));
|
||||
LOG(10, (" wFormatTag %d", wFormatTag));
|
||||
LOG(10, (" nChannels %d", nChannels));
|
||||
LOG(10, (" nSamplesPerSec %d", nSamplesPerSec));
|
||||
LOG(10, (" nAvgBytesPerSec %d", nAvgBytesPerSec));
|
||||
LOG(10, (" nBlockAlign %d", nBlockAlign));
|
||||
LOG(10, (" wBitsPerSample %d", wBitsPerSample));
|
||||
LOG(10, (" cbSize %d", cbSize));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_process_input_format:");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " wFormatTag %d", wFormatTag);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " nChannels %d", nChannels);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " nSamplesPerSec %d", nSamplesPerSec);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " nAvgBytesPerSec %d", nAvgBytesPerSec);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " nBlockAlign %d", nBlockAlign);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " wBitsPerSample %d", wBitsPerSample);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " cbSize %d", cbSize);
|
||||
|
||||
#if 1
|
||||
/* select CD quality audio */
|
||||
@ -1566,7 +1568,7 @@ sound_process_input_formats(struct stream *s, int size)
|
||||
int cbSize;
|
||||
char *data;
|
||||
|
||||
LOG(10, ("sound_process_input_formats: size=%d", size));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_process_input_formats: size=%d", size);
|
||||
|
||||
if (g_getenv("XRDP_NO_RDPSND_REC") == NULL)
|
||||
{
|
||||
@ -1606,7 +1608,7 @@ sound_input_start_recording(void)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
LOG(10, ("sound_input_start_recording:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_input_start_recording:");
|
||||
|
||||
/* if there is any data in FIFO, discard it */
|
||||
while ((s = (struct stream *) fifo_remove(&g_in_fifo)) != NULL)
|
||||
@ -1645,7 +1647,7 @@ sound_input_stop_recording(void)
|
||||
{
|
||||
struct stream* s;
|
||||
|
||||
LOG(10, ("sound_input_stop_recording:"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_input_stop_recording:");
|
||||
|
||||
xstream_new(s, 1024);
|
||||
|
||||
@ -1675,8 +1677,8 @@ sound_process_input_data(struct stream *s, int bytes)
|
||||
{
|
||||
struct stream *ls;
|
||||
|
||||
LOG(10, ("sound_process_input_data: bytes %d g_bytes_in_fifo %d",
|
||||
bytes, g_bytes_in_fifo));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_process_input_data: bytes %d g_bytes_in_fifo %d",
|
||||
bytes, g_bytes_in_fifo);
|
||||
#if 0 /* no need to cap anymore */
|
||||
/* cap data in fifo */
|
||||
if (g_bytes_in_fifo > 8 * 1024)
|
||||
@ -1722,7 +1724,7 @@ sound_sndsrvr_source_data_in(struct trans *trans)
|
||||
ts->p = ts->data + 8;
|
||||
in_uint8(ts, cmd);
|
||||
in_uint16_le(ts, bytes_req);
|
||||
LOG(10, ("sound_sndsrvr_source_data_in: bytes_req %d", bytes_req));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sound_sndsrvr_source_data_in: bytes_req %d", bytes_req);
|
||||
|
||||
xstream_new(s, bytes_req + 2);
|
||||
|
||||
@ -1739,7 +1741,7 @@ sound_sndsrvr_source_data_in(struct trans *trans)
|
||||
if (g_stream_inp != NULL)
|
||||
{
|
||||
g_bytes_in_fifo -= g_stream_inp->size;
|
||||
LOG(10, (" g_bytes_in_fifo %d", g_bytes_in_fifo));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " g_bytes_in_fifo %d", g_bytes_in_fifo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1823,7 +1825,7 @@ 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(0, ("trans_listen failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "trans_listen failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1840,7 +1842,7 @@ 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(0, ("trans_listen failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "trans_listen failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,6 @@
|
||||
#include "rail.h"
|
||||
#include "xcommon.h"
|
||||
|
||||
/*
|
||||
#undef LOG_LEVEL
|
||||
#define LOG_LEVEL 11
|
||||
*/
|
||||
|
||||
extern int g_clip_up; /* in clipboard.c */
|
||||
|
||||
extern int g_rail_up; /* in rail.c */
|
||||
@ -61,9 +56,9 @@ xcommon_error_handler(Display *dis, XErrorEvent *xer)
|
||||
char text[256];
|
||||
|
||||
XGetErrorText(dis, xer->error_code, text, 255);
|
||||
LOGM((LOG_LEVEL_ERROR, "X error [%s](%d) opcodes %d/%d "
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "X error [%s](%d) opcodes %d/%d "
|
||||
"resource 0x%lx", text, xer->error_code,
|
||||
xer->request_code, xer->minor_code, xer->resourceid));
|
||||
xer->request_code, xer->minor_code, xer->resourceid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -108,7 +103,7 @@ xcommon_init(void)
|
||||
{
|
||||
if (g_display != 0)
|
||||
{
|
||||
LOG(10, ("xcommon_init: xcommon_init already called"));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xcommon_init: xcommon_init already called");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -116,11 +111,11 @@ xcommon_init(void)
|
||||
|
||||
if (g_display == 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "xcommon_init: error, XOpenDisplay failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "xcommon_init: error, XOpenDisplay failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
LOG(0, ("xcommon_init: connected to display ok"));
|
||||
LOG_DEVEL(LOG_LEVEL_INFO, "xcommon_init: connected to display ok");
|
||||
|
||||
/* setting the error handlers can cause problem when shutting down
|
||||
chansrv on some xlibs */
|
||||
@ -131,7 +126,7 @@ xcommon_init(void)
|
||||
|
||||
if (g_x_socket == 0)
|
||||
{
|
||||
LOGM((LOG_LEVEL_ERROR, "xcommon_init: XConnectionNumber failed"));
|
||||
LOG_DEVEL(LOG_LEVEL_ERROR, "xcommon_init: XConnectionNumber failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -190,8 +185,8 @@ xcommon_check_wait_objs(void)
|
||||
rail_rv = rail_xevent(&xevent);
|
||||
if ((clip_rv == 1) && (rail_rv == 1))
|
||||
{
|
||||
LOG(10, ("xcommon_check_wait_objs unknown xevent type %d",
|
||||
xevent.type));
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "xcommon_check_wait_objs unknown xevent type %d",
|
||||
xevent.type);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -219,7 +219,7 @@ env_set_user(const char *username, char **passwd_file, int display,
|
||||
|
||||
if (*passwd_file != NULL)
|
||||
{
|
||||
LOG_DBG("pass file: %s", *passwd_file);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "pass file: %s", *passwd_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ scp_lock_fork_release(void)
|
||||
void
|
||||
scp_lock_fork_critical_section_end(int blocking)
|
||||
{
|
||||
//LOG_DBG("lock_fork_critical_section_end()",0);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "lock_fork_critical_section_end()",0);
|
||||
/* lock mutex */
|
||||
pthread_mutex_lock(&lock_fork);
|
||||
|
||||
@ -121,7 +121,7 @@ scp_lock_fork_critical_section_end(int blocking)
|
||||
int
|
||||
scp_lock_fork_critical_section_start(void)
|
||||
{
|
||||
//LOG_DBG("lock_fork_critical_section_start()",0);
|
||||
//LOG_DEVEL(LOG_LEVEL_DEBUG, "lock_fork_critical_section_start()",0);
|
||||
do
|
||||
{
|
||||
pthread_mutex_lock(&lock_fork);
|
||||
|
@ -39,7 +39,7 @@ scp_tcp_force_recv(int sck, char *data, int len)
|
||||
int rcvd;
|
||||
int block;
|
||||
|
||||
LOG_DBG("scp_tcp_force_recv()");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "scp_tcp_force_recv()");
|
||||
block = scp_lock_fork_critical_section_start();
|
||||
|
||||
while (len > 0)
|
||||
@ -82,7 +82,7 @@ scp_tcp_force_send(int sck, char *data, int len)
|
||||
int sent;
|
||||
int block;
|
||||
|
||||
LOG_DBG("scp_tcp_force_send()");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "scp_tcp_force_send()");
|
||||
block = scp_lock_fork_critical_section_start();
|
||||
|
||||
while (len > 0)
|
||||
|
@ -48,19 +48,16 @@ extern struct log_config *s_log;
|
||||
* @param s Input stream
|
||||
* @param [out] Output buffer (must be >= (STRING16_MAX_LEN+1) chars)
|
||||
* @param param Parameter we're reading
|
||||
* @param line Line number reference
|
||||
* @return != 0 if string read OK
|
||||
*/
|
||||
static
|
||||
int in_string16(struct stream *s, char str[], const char *param, int line)
|
||||
int in_string16(struct stream *s, char str[], const char *param)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (!s_check_rem(s, 2))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: %s len missing",
|
||||
line, param);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: %s len missing", param);
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
@ -70,9 +67,8 @@ int in_string16(struct stream *s, char str[], const char *param, int line)
|
||||
in_uint16_be(s, sz);
|
||||
if (sz > STRING16_MAX_LEN)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: %s too long (%u chars)",
|
||||
line, param, sz);
|
||||
LOG(LOG_LEVEL_WARNING,
|
||||
"connection aborted: %s too long (%u chars)", param, sz);
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
@ -80,9 +76,7 @@ int in_string16(struct stream *s, char str[], const char *param, int line)
|
||||
result = s_check_rem(s, sz);
|
||||
if (!result)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: %s data missing",
|
||||
line, param);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: %s data missing", param);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -105,7 +99,7 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
init_stream(c->in_s, c->in_s->size);
|
||||
init_stream(c->out_s, c->in_s->size);
|
||||
|
||||
LOG_DBG("[v0:%d] starting connection", __LINE__);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "starting connection");
|
||||
g_tcp_set_non_blocking(c->in_sck);
|
||||
g_tcp_set_no_delay(c->in_sck);
|
||||
s_push_layer(c->out_s, channel_hdr, 8);
|
||||
@ -125,16 +119,14 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_CLIENT_STATE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
sz = g_strlen(s->username);
|
||||
if (sz > STRING16_MAX_LEN)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: username too long",
|
||||
__LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: username too long");
|
||||
return SCP_CLIENT_STATE_SIZE_ERR;
|
||||
}
|
||||
out_uint16_be(c->out_s, sz);
|
||||
@ -143,9 +135,7 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
sz = g_strlen(s->password);
|
||||
if (sz > STRING16_MAX_LEN)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: password too long",
|
||||
__LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: password too long");
|
||||
return SCP_CLIENT_STATE_SIZE_ERR;
|
||||
}
|
||||
out_uint16_be(c->out_s, sz);
|
||||
@ -164,13 +154,13 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
|
||||
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, c->out_s->end - c->out_s->data))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_CLIENT_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_CLIENT_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
@ -178,7 +168,7 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
|
||||
if (0 != version)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: version error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: version error");
|
||||
return SCP_CLIENT_STATE_VERSION_ERR;
|
||||
}
|
||||
|
||||
@ -186,9 +176,7 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
|
||||
if (size < (8 + 2 + 2 + 2) || size > SCP_MAX_MESSAGE_SIZE)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: msg size = %d",
|
||||
__LINE__, size);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: msg size = %d", size);
|
||||
return SCP_CLIENT_STATE_SIZE_ERR;
|
||||
}
|
||||
|
||||
@ -197,7 +185,7 @@ scp_v0c_connect(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, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_CLIENT_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
@ -208,7 +196,7 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
|
||||
if (3 != sz)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: sequence error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: sequence error");
|
||||
return SCP_CLIENT_STATE_SEQUENCE_ERR;
|
||||
}
|
||||
|
||||
@ -217,14 +205,14 @@ scp_v0c_connect(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
|
||||
if (1 != sz)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: connection denied", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: connection denied");
|
||||
return SCP_CLIENT_STATE_CONNECTION_DENIED;
|
||||
}
|
||||
|
||||
in_uint16_be(c->in_s, sz);
|
||||
s->display = sz;
|
||||
|
||||
LOG_DBG("[v0:%d] connection terminated", __LINE__);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "connection terminated");
|
||||
return SCP_CLIENT_STATE_END;
|
||||
}
|
||||
|
||||
@ -253,9 +241,7 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
in_uint32_be(c->in_s, size);
|
||||
if (size < (8 + 2) || size > SCP_MAX_MESSAGE_SIZE)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: msg size = %d",
|
||||
__LINE__, size);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: msg size = %d", size);
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
|
||||
@ -263,7 +249,7 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
|
||||
if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_SERVER_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
@ -287,33 +273,31 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
}
|
||||
|
||||
/* reading username */
|
||||
if (!in_string16(c->in_s, buf, "username", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "username"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
if (0 != scp_session_set_username(session, buf))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting username", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: error setting username");
|
||||
return SCP_SERVER_STATE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
/* reading password */
|
||||
if (!in_string16(c->in_s, buf, "passwd", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "passwd"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
if (0 != scp_session_set_password(session, buf))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting password", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: error setting password");
|
||||
return SCP_SERVER_STATE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
/* width + height + bpp */
|
||||
if (!s_check_rem(c->in_s, 2 + 2 + 2))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: width+height+bpp missing",
|
||||
__LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: width+height+bpp missing");
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
in_uint16_be(c->in_s, width);
|
||||
@ -323,16 +307,15 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
in_uint16_be(c->in_s, bpp);
|
||||
if (0 != scp_session_set_bpp(session, (tui8)bpp))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: unsupported bpp: %d",
|
||||
__LINE__, (tui8)bpp);
|
||||
LOG(LOG_LEVEL_WARNING,
|
||||
"connection aborted: unsupported bpp: %d", (tui8)bpp);
|
||||
return SCP_SERVER_STATE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
if (s_check_rem(c->in_s, 2))
|
||||
{
|
||||
/* reading domain */
|
||||
if (!in_string16(c->in_s, buf, "domain", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "domain"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
@ -345,7 +328,7 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
if (s_check_rem(c->in_s, 2))
|
||||
{
|
||||
/* reading program */
|
||||
if (!in_string16(c->in_s, buf, "program", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "program"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
@ -359,7 +342,7 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
if (s_check_rem(c->in_s, 2))
|
||||
{
|
||||
/* reading directory */
|
||||
if (!in_string16(c->in_s, buf, "directory", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "directory"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
@ -373,7 +356,7 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
if (s_check_rem(c->in_s, 2))
|
||||
{
|
||||
/* reading client IP address */
|
||||
if (!in_string16(c->in_s, buf, "client IP", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "client IP"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
@ -387,7 +370,7 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
{
|
||||
scp_session_set_type(session, SCP_GW_AUTHENTICATION);
|
||||
/* reading username */
|
||||
if (!in_string16(c->in_s, buf, "username", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "username"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
@ -395,12 +378,12 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
/* g_writeln("Received user name: %s",buf); */
|
||||
if (0 != scp_session_set_username(session, buf))
|
||||
{
|
||||
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting username", __LINE__);*/
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: error setting username");
|
||||
return SCP_SERVER_STATE_INTERNAL_ERR;
|
||||
}
|
||||
|
||||
/* reading password */
|
||||
if (!in_string16(c->in_s, buf, "passwd", __LINE__))
|
||||
if (!in_string16(c->in_s, buf, "passwd"))
|
||||
{
|
||||
return SCP_SERVER_STATE_SIZE_ERR;
|
||||
}
|
||||
@ -408,13 +391,13 @@ scp_v0s_init_session(struct SCP_CONNECTION *c, struct SCP_SESSION *session)
|
||||
/* g_writeln("Received password: %s",buf); */
|
||||
if (0 != scp_session_set_password(session, buf))
|
||||
{
|
||||
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: error setting password", __LINE__); */
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: error setting password");
|
||||
return SCP_SERVER_STATE_INTERNAL_ERR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: sequence error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: sequence error");
|
||||
return SCP_SERVER_STATE_SEQUENCE_ERR;
|
||||
}
|
||||
|
||||
@ -433,7 +416,7 @@ scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk)
|
||||
|
||||
if (!skipVchk)
|
||||
{
|
||||
LOG_DBG("[v0:%d] starting connection", __LINE__);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "starting connection");
|
||||
|
||||
if (0 == scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
|
||||
{
|
||||
@ -442,13 +425,13 @@ scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk)
|
||||
|
||||
if (version != 0)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: version error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: version error");
|
||||
result = SCP_SERVER_STATE_VERSION_ERR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
result = SCP_SERVER_STATE_NETWORK_ERR;
|
||||
}
|
||||
}
|
||||
@ -458,9 +441,7 @@ scp_v0s_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s, int skipVchk)
|
||||
session = scp_session_create();
|
||||
if (NULL == session)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING,
|
||||
"[v0:%d] connection aborted: no memory",
|
||||
__LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: no memory");
|
||||
result = SCP_SERVER_STATE_INTERNAL_ERR;
|
||||
}
|
||||
else
|
||||
@ -499,11 +480,11 @@ scp_v0s_allow_connection(struct SCP_CONNECTION *c, SCP_DISPLAY d, const tui8 *gu
|
||||
|
||||
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, c->out_s->end - c->out_s->data))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_SERVER_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
LOG_DBG("[v0:%d] connection terminated (allowed)", __LINE__);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "connection terminated (allowed)");
|
||||
return SCP_SERVER_STATE_OK;
|
||||
}
|
||||
|
||||
@ -520,11 +501,11 @@ scp_v0s_deny_connection(struct SCP_CONNECTION *c)
|
||||
|
||||
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, c->out_s->end - c->out_s->data))
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__);
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_SERVER_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
LOG_DBG("[v0:%d] connection terminated (denied)", __LINE__);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "connection terminated (denied)");
|
||||
return SCP_SERVER_STATE_OK;
|
||||
}
|
||||
|
||||
@ -543,10 +524,10 @@ scp_v0s_replyauthentication(struct SCP_CONNECTION *c, unsigned short int value)
|
||||
/* g_writeln("Total number of bytes that will be sent %d",c->out_s->end - c->out_s->data);*/
|
||||
if (0 != scp_tcp_force_send(c->in_sck, c->out_s->data, c->out_s->end - c->out_s->data))
|
||||
{
|
||||
/* until syslog merge log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__); */
|
||||
LOG(LOG_LEVEL_WARNING, "connection aborted: network error");
|
||||
return SCP_SERVER_STATE_NETWORK_ERR;
|
||||
}
|
||||
|
||||
/* until syslog merge LOG_DBG(s_log, "[v0:%d] connection terminated (scp_v0s_deny_authentication)", __LINE__);*/
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "connection terminated (scp_v0s_deny_authentication)");
|
||||
return SCP_SERVER_STATE_OK;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
|
||||
(*scount) = sescnt;
|
||||
(*s) = NULL;
|
||||
|
||||
LOG_DBG("[v1c_mng] end list - no session on TS");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "[v1c_mng] end list - no session on TS");
|
||||
return SCP_CLIENT_STATE_LIST_OK;
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
|
||||
(*scount) = sescnt;
|
||||
(*s) = ds;
|
||||
|
||||
LOG_DBG("[v1c_mng] end list");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "[v1c_mng] end list");
|
||||
return SCP_CLIENT_STATE_LIST_OK;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ scp_process_start(void *sck)
|
||||
struct SCP_SESSION *sdata = NULL;
|
||||
|
||||
scon.in_sck = (int)(tintptr)sck;
|
||||
LOG_DBG("started scp thread on socket %d", scon.in_sck);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "started scp thread on socket %d", scon.in_sck);
|
||||
|
||||
make_stream(scon.in_s);
|
||||
make_stream(scon.out_s);
|
||||
@ -58,13 +58,13 @@ scp_process_start(void *sck)
|
||||
if (sdata->version == 0)
|
||||
{
|
||||
/* starts processing an scp v0 connection */
|
||||
LOG_DBG("accept ok, go on with scp v0");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "accept ok, go on with scp v0");
|
||||
scp_v0_process(&scon, sdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DBG("accept ok, go on with scp v1");
|
||||
/*LOG_DBG("user: %s\npass: %s",sdata->username, sdata->password);*/
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "accept ok, go on with scp v1");
|
||||
/*LOG_DEVEL(LOG_LEVEL_DEBUG, "user: %s\npass: %s",sdata->username, sdata->password);*/
|
||||
scp_v1_process(&scon, sdata);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DBG("pre auth");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "pre auth");
|
||||
|
||||
if (1 == access_login_allowed(s->username))
|
||||
{
|
||||
|
@ -56,11 +56,11 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
current_try = retries;
|
||||
|
||||
data = auth_userpass(s->username, s->password,NULL);
|
||||
/*LOG_DBG("user: %s\npass: %s", s->username, s->password);*/
|
||||
/*LOG_DEVEL(LOG_LEVEL_DEBUG, "user: %s\npass: %s", s->username, s->password);*/
|
||||
|
||||
while ((!data) && ((retries == 0) || (current_try > 0)))
|
||||
{
|
||||
LOG_DBG("data %ld - retry %d - currenttry %d - expr %d",
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "data %ld - retry %d - currenttry %d - expr %d",
|
||||
data, retries, current_try,
|
||||
((!data) && ((retries == 0) || (current_try > 0))));
|
||||
|
||||
@ -220,7 +220,7 @@ static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f)
|
||||
switch (e)
|
||||
{
|
||||
case SCP_SERVER_STATE_VERSION_ERR:
|
||||
LOG_DBG("version error")
|
||||
log_message(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) */
|
||||
|
@ -47,7 +47,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
int end = 0;
|
||||
|
||||
data = auth_userpass(s->username, s->password,NULL);
|
||||
/*LOG_DBG("user: %s\npass: %s", s->username, s->password);*/
|
||||
/*LOG_DEVEL(LOG_LEVEL_DEBUG, "user: %s\npass: %s", s->username, s->password);*/
|
||||
|
||||
if (!data)
|
||||
{
|
||||
@ -83,7 +83,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
case SCP_SERVER_STATE_MNG_LISTREQ:
|
||||
/* list disconnected sessions */
|
||||
slist = session_get_byuser(NULL, &scount, SESMAN_SESSION_STATUS_ALL);
|
||||
LOG_DBG("sessions on TS: %d (slist: %p)", scount, slist);
|
||||
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");
|
||||
@ -109,7 +109,7 @@ static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f)
|
||||
switch (e)
|
||||
{
|
||||
case SCP_SERVER_STATE_VERSION_ERR:
|
||||
LOG_DBG("version error")
|
||||
log_message(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) */
|
||||
|
@ -150,7 +150,7 @@ sesman_main_loop(void)
|
||||
else
|
||||
{
|
||||
/* we've got a connection, so we pass it to scp code */
|
||||
LOG_DBG("new connection");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "new connection");
|
||||
scp_process_start((void*)(tintptr)in_sck);
|
||||
g_sck_close(in_sck);
|
||||
}
|
||||
|
@ -64,10 +64,19 @@ IdleTimeLimit=0
|
||||
Policy=Default
|
||||
|
||||
[Logging]
|
||||
; Note: Log levels can be any of: core, error, warning, info, debug, or trace
|
||||
LogFile=xrdp-sesman.log
|
||||
LogLevel=DEBUG
|
||||
EnableSyslog=1
|
||||
SyslogLevel=DEBUG
|
||||
LogLevel=INFO
|
||||
EnableSyslog=true
|
||||
#SyslogLevel=INFO
|
||||
#EnableConsole=false
|
||||
#ConsoleLevel=INFO
|
||||
#EnableProcessId=false
|
||||
|
||||
[LoggingPerLogger]
|
||||
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP.
|
||||
#sesman.c=INFO
|
||||
#main()=INFO
|
||||
|
||||
;
|
||||
; Session definitions - startup command-line parameters for each session type
|
||||
@ -111,5 +120,23 @@ FuseMountName=thinclient_drives
|
||||
; Make this more permissive (e.g. 022) if required.
|
||||
FileUmask=077
|
||||
|
||||
[ChansrvLogging]
|
||||
; Note: one log file is created per display and the LogFile config value
|
||||
; is ignored. The channel server log file names follow the naming convention:
|
||||
; xrdp-chansrv.${DISPLAY}.log
|
||||
;
|
||||
; Note: Log levels can be any of: core, error, warning, info, debug, or trace
|
||||
LogLevel=INFO
|
||||
EnableSyslog=true
|
||||
#SyslogLevel=INFO
|
||||
#EnableConsole=false
|
||||
#ConsoleLevel=INFO
|
||||
#EnableProcessId=false
|
||||
|
||||
[ChansrvLoggingPerLogger]
|
||||
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP.
|
||||
#chansrv.c=INFO
|
||||
#main()=INFO
|
||||
|
||||
[SessionVariables]
|
||||
PULSE_SCRIPT=@sesmansysconfdir@/pulse/default.pa
|
||||
|
@ -1046,11 +1046,11 @@ session_get_byuser(const char *user, int *cnt, unsigned char flags)
|
||||
|
||||
while (tmp != 0)
|
||||
{
|
||||
LOG_DBG("user: %s", user);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "user: %s", user);
|
||||
|
||||
if ((NULL == user) || (!g_strncasecmp(user, tmp->item->name, 256)))
|
||||
{
|
||||
LOG_DBG("session_get_byuser: status=%d, flags=%d, "
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "session_get_byuser: status=%d, flags=%d, "
|
||||
"result=%d", (tmp->item->status), flags,
|
||||
((tmp->item->status) & flags));
|
||||
|
||||
|
16
sesman/sig.c
16
sesman/sig.c
@ -47,11 +47,11 @@ sig_sesman_shutdown(int sig)
|
||||
|
||||
if (g_getpid() != g_pid)
|
||||
{
|
||||
LOG_DBG("g_getpid() [%d] differs from g_pid [%d]", (g_getpid()), g_pid);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "g_getpid() [%d] differs from g_pid [%d]", (g_getpid()), g_pid);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG(" - getting signal %d pid %d", sig, g_getpid());
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, " - getting signal %d pid %d", sig, g_getpid());
|
||||
|
||||
g_set_wait_obj(g_term_event);
|
||||
|
||||
@ -73,7 +73,7 @@ sig_sesman_reload_cfg(int sig)
|
||||
|
||||
if (g_getpid() != g_pid)
|
||||
{
|
||||
LOG_DBG("g_getpid() [%d] differs from g_pid [%d]", g_getpid(), g_pid);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "g_getpid() [%d] differs from g_pid [%d]", g_getpid(), g_pid);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ sig_handler_thread(void *arg)
|
||||
|
||||
do
|
||||
{
|
||||
LOG_DBG("calling sigwait()");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "calling sigwait()");
|
||||
sigwait(&waitmask, &recv_signal);
|
||||
|
||||
switch (recv_signal)
|
||||
@ -179,22 +179,22 @@ sig_handler_thread(void *arg)
|
||||
case SIGHUP:
|
||||
//reload cfg
|
||||
//we must stop & restart logging, or copy logging cfg!!!!
|
||||
LOG_DBG("sesman received SIGHUP");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sesman received SIGHUP");
|
||||
//return 0;
|
||||
break;
|
||||
case SIGCHLD:
|
||||
/* a session died */
|
||||
LOG_DBG("sesman received SIGCHLD");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sesman received SIGCHLD");
|
||||
sig_sesman_session_end(SIGCHLD);
|
||||
break;
|
||||
case SIGINT:
|
||||
/* we die */
|
||||
LOG_DBG("sesman received SIGINT");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sesman received SIGINT");
|
||||
sig_sesman_shutdown(recv_signal);
|
||||
break;
|
||||
case SIGTERM:
|
||||
/* we die */
|
||||
LOG_DBG("sesman received SIGTERM");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "sesman received SIGTERM");
|
||||
sig_sesman_shutdown(recv_signal);
|
||||
break;
|
||||
}
|
||||
|
@ -133,18 +133,18 @@ int main(int argc, char **argv)
|
||||
sock = g_tcp_socket();
|
||||
if (sock < 0)
|
||||
{
|
||||
LOG_DBG("Socket open error, g_tcp_socket() failed");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Socket open error, g_tcp_socket() failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = scp_session_create();
|
||||
c = scp_connection_create(sock);
|
||||
|
||||
LOG_DBG("Connecting to %s:%s with user %s (%s)", serv, port, user, pass);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "Connecting to %s:%s with user %s (%s)", serv, port, user, pass);
|
||||
|
||||
if (0 != g_tcp_connect(sock, serv, port))
|
||||
{
|
||||
LOG_DBG("g_tcp_connect() error");
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "g_tcp_connect() error");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (SCP_CLIENT_STATE_OK != e)
|
||||
{
|
||||
LOG_DBG("libscp error connecting: %s %d", s->errstr, (int)e);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "libscp error connecting: %s %d", s->errstr, (int)e);
|
||||
}
|
||||
|
||||
if (0 == g_strncmp(cmnd, "list", 5))
|
||||
|
@ -312,13 +312,13 @@ auth_account_disabled(struct spwd *stp)
|
||||
|
||||
today = g_time1() / SECS_PER_DAY;
|
||||
|
||||
LOG_DBG("last %d", stp->sp_lstchg);
|
||||
LOG_DBG("min %d", stp->sp_min);
|
||||
LOG_DBG("max %d", stp->sp_max);
|
||||
LOG_DBG("inact %d", stp->sp_inact);
|
||||
LOG_DBG("warn %d", stp->sp_warn);
|
||||
LOG_DBG("expire %d", stp->sp_expire);
|
||||
LOG_DBG("today %d", today);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "last %ld", stp->sp_lstchg);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "min %ld", stp->sp_min);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "max %ld", stp->sp_max);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "inact %ld", stp->sp_inact);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "warn %ld", stp->sp_warn);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "expire %ld", stp->sp_expire);
|
||||
LOG_DEVEL(LOG_LEVEL_DEBUG, "today %d", today);
|
||||
|
||||
if ((stp->sp_expire != -1) && (today >= stp->sp_expire))
|
||||
{
|
||||
|
@ -149,11 +149,19 @@ ls_btn_cancel_width=85
|
||||
ls_btn_cancel_height=30
|
||||
|
||||
[Logging]
|
||||
; Note: Log levels can be any of: core, error, warning, info, debug, or trace
|
||||
LogFile=xrdp.log
|
||||
LogLevel=DEBUG
|
||||
LogLevel=INFO
|
||||
EnableSyslog=true
|
||||
SyslogLevel=DEBUG
|
||||
; LogLevel and SysLogLevel could by any of: core, error, warning, info or debug
|
||||
#SyslogLevel=INFO
|
||||
#EnableConsole=false
|
||||
#ConsoleLevel=INFO
|
||||
#EnableProcessId=false
|
||||
|
||||
[LoggingPerLogger]
|
||||
; Note: per logger configuration is only used in XRDP_DEBUG builds of XRDP.
|
||||
#xrdp.c=INFO
|
||||
#main()=INFO
|
||||
|
||||
[Channels]
|
||||
; Channel names not listed here will be blocked by XRDP.
|
||||
|
@ -589,7 +589,8 @@ xrdp_wm_login_fill_in_combo(struct xrdp_wm *self, struct xrdp_bitmap *b)
|
||||
|
||||
if ((g_strncasecmp(p, "globals", 255) == 0)
|
||||
|| (g_strncasecmp(p, "channels", 255) == 0)
|
||||
|| (g_strncasecmp(p, "Logging", 255) == 0))
|
||||
|| (g_strncasecmp(p, "Logging", 255) == 0)
|
||||
|| (g_strncasecmp(p, "LoggingPerLogger", 255) == 0))
|
||||
{
|
||||
}
|
||||
else
|
||||
|
@ -664,6 +664,7 @@ xrdp_wm_init(struct xrdp_wm *self)
|
||||
q = (char *)list_get_item(names, index);
|
||||
if ((g_strncasecmp("globals", q, 8) != 0) &&
|
||||
(g_strncasecmp("Logging", q, 8) != 0) &&
|
||||
(g_strncasecmp("LoggingPerLogger", q, 17) != 0) &&
|
||||
(g_strncasecmp("channels", q, 9) != 0))
|
||||
{
|
||||
g_strncpy(default_section_name, q, 255);
|
||||
|
Loading…
Reference in New Issue
Block a user