Merge pull request #390 from proski/june21
Cleanups and C++ compatibility
This commit is contained in:
commit
8353baab3d
@ -19,6 +19,10 @@
|
||||
#if !defined(ARCH_H)
|
||||
#define ARCH_H
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config_ac.h"
|
||||
#endif
|
||||
|
||||
/* you can define L_ENDIAN or B_ENDIAN and NEED_ALIGN or NO_NEED_ALIGN
|
||||
in the makefile to override */
|
||||
|
||||
@ -109,7 +113,6 @@ typedef __int64 tbus;
|
||||
#else
|
||||
typedef long tbus;
|
||||
#endif
|
||||
typedef tbus thandle;
|
||||
typedef tbus tintptr;
|
||||
/* wide char, socket */
|
||||
#if defined(_WIN32)
|
||||
@ -125,4 +128,22 @@ typedef signed long long tsi64;
|
||||
#endif
|
||||
#endif /* DEFINED_Ts */
|
||||
|
||||
/* format string verification */
|
||||
#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
|
||||
#define printflike(arg_format, arg_first_check) \
|
||||
__attribute__((__format__(__printf__, arg_format, arg_first_check)))
|
||||
#else
|
||||
#define printflike(arg_format, arg_first_check)
|
||||
#endif
|
||||
|
||||
/* module interface */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
tintptr mod_init();
|
||||
int mod_exit(tintptr);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
12
common/log.c
12
common/log.c
@ -212,12 +212,6 @@ internal_log_end(struct log_config *l_cfg)
|
||||
l_cfg->log_file = 0;
|
||||
}
|
||||
|
||||
if (0 != l_cfg->program_name)
|
||||
{
|
||||
g_free(l_cfg->program_name);
|
||||
l_cfg->program_name = 0;
|
||||
}
|
||||
|
||||
ret = LOG_STARTUP_OK;
|
||||
return ret;
|
||||
}
|
||||
@ -336,7 +330,7 @@ internal_config_read_logging(int file, struct log_config *lc,
|
||||
list_clear(param_n);
|
||||
|
||||
/* setting defaults */
|
||||
lc->program_name = g_strdup(applicationName);
|
||||
lc->program_name = applicationName;
|
||||
lc->log_file = 0;
|
||||
lc->fd = 0;
|
||||
lc->log_level = LOG_LEVEL_DEBUG;
|
||||
@ -401,7 +395,7 @@ enum logReturns DEFAULT_CC
|
||||
internalInitAndAllocStruct(void)
|
||||
{
|
||||
enum logReturns ret = LOG_GENERAL_ERROR;
|
||||
g_staticLogConfig = g_malloc(sizeof(struct log_config), 1);
|
||||
g_staticLogConfig = g_new0(struct log_config, 1);
|
||||
|
||||
if (g_staticLogConfig != NULL)
|
||||
{
|
||||
@ -455,7 +449,7 @@ log_start_from_param(const struct log_config *iniParams)
|
||||
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 = g_strdup(iniParams->program_name);
|
||||
g_staticLogConfig->program_name = iniParams->program_name;
|
||||
g_staticLogConfig->syslog_level = iniParams->syslog_level;
|
||||
ret = internal_log_start(g_staticLogConfig);
|
||||
|
||||
|
@ -65,12 +65,12 @@ enum logReturns
|
||||
|
||||
struct log_config
|
||||
{
|
||||
char *program_name;
|
||||
const char *program_name;
|
||||
char *log_file;
|
||||
int fd;
|
||||
unsigned int log_level;
|
||||
enum logLevels log_level;
|
||||
int enable_syslog;
|
||||
unsigned int syslog_level;
|
||||
enum logLevels syslog_level;
|
||||
pthread_mutex_t log_lock;
|
||||
pthread_mutexattr_t log_lock_attr;
|
||||
};
|
||||
@ -171,7 +171,7 @@ log_end(void);
|
||||
* @return
|
||||
*/
|
||||
enum logReturns DEFAULT_CC
|
||||
log_message(const enum logLevels lvl, const char *msg, ...);
|
||||
log_message(const enum logLevels lvl, const char *msg, ...) printflike(2, 3);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -402,7 +402,7 @@ g_tcp_set_keepalive(int sck)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns a newly created socket or -1 on error */
|
||||
/* in win32 a socket is an unsigned int, in linux, its an int */
|
||||
/* in win32 a socket is an unsigned int, in linux, it's an int */
|
||||
int APP_CC
|
||||
g_tcp_socket(void)
|
||||
{
|
||||
@ -671,7 +671,6 @@ int APP_CC
|
||||
g_tcp_connect(int sck, const char *address, const char *port)
|
||||
{
|
||||
int res = 0;
|
||||
char errorMsg[256];
|
||||
struct addrinfo p;
|
||||
struct addrinfo *h = (struct addrinfo *)NULL;
|
||||
struct addrinfo *rp = (struct addrinfo *)NULL;
|
||||
@ -699,9 +698,8 @@ g_tcp_connect(int sck, const char *address, const char *port)
|
||||
}
|
||||
if (res != 0)
|
||||
{
|
||||
snprintf(errorMsg, 255, "g_tcp_connect: getaddrinfo() failed: %s",
|
||||
log_message(LOG_LEVEL_ERROR, "g_tcp_connect: getaddrinfo() failed: %s",
|
||||
gai_strerror(res));
|
||||
log_message(LOG_LEVEL_ERROR, errorMsg);
|
||||
}
|
||||
if (res > -1)
|
||||
{
|
||||
@ -991,7 +989,7 @@ g_tcp_accept(int sck)
|
||||
{
|
||||
snprintf(ipAddr, 255, "A connection received from: %s port %d",
|
||||
inet_ntoa(s.sin_addr), ntohs(s.sin_port));
|
||||
log_message(LOG_LEVEL_INFO,ipAddr);
|
||||
log_message(LOG_LEVEL_INFO, "%s", ipAddr);
|
||||
}
|
||||
return ret ;
|
||||
}
|
||||
@ -1016,7 +1014,7 @@ g_sck_accept(int sck, char *addr, int addr_bytes, char *port, int port_bytes)
|
||||
{
|
||||
g_snprintf(ipAddr, 255, "A connection received from: %s port %d",
|
||||
inet_ntoa(s.sin_addr), ntohs(s.sin_port));
|
||||
log_message(LOG_LEVEL_INFO,ipAddr);
|
||||
log_message(LOG_LEVEL_INFO, "%s", ipAddr);
|
||||
if (s.sin_family == AF_INET)
|
||||
{
|
||||
g_snprintf(addr, addr_bytes, "%s", inet_ntoa(s.sin_addr));
|
||||
@ -1815,7 +1813,7 @@ g_file_read(int fd, char *ptr, int len)
|
||||
/*****************************************************************************/
|
||||
/* write to file, returns the number of bytes written or -1 on error */
|
||||
int APP_CC
|
||||
g_file_write(int fd, char *ptr, int len)
|
||||
g_file_write(int fd, const char *ptr, int len)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
||||
@ -1952,7 +1950,7 @@ g_get_current_dir(char *dirname, int maxlen)
|
||||
/*****************************************************************************/
|
||||
/* returns error, zero on success and -1 on failure */
|
||||
int APP_CC
|
||||
g_set_current_dir(char *dirname)
|
||||
g_set_current_dir(const char *dirname)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
||||
@ -2121,7 +2119,7 @@ g_strlen(const char *text)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* locates char in text */
|
||||
char* APP_CC
|
||||
const char *APP_CC
|
||||
g_strchr(const char* text, int c)
|
||||
{
|
||||
if (text == NULL)
|
||||
@ -2218,7 +2216,7 @@ g_strdup(const char *in)
|
||||
char *APP_CC
|
||||
g_strndup(const char *in, const unsigned int maxlen)
|
||||
{
|
||||
int len;
|
||||
unsigned int len;
|
||||
char *p;
|
||||
|
||||
if (in == 0)
|
||||
@ -2400,7 +2398,7 @@ g_htoi(char *str)
|
||||
int APP_CC
|
||||
g_pos(const char *str, const char *to_find)
|
||||
{
|
||||
char *pp;
|
||||
const char *pp;
|
||||
|
||||
pp = strstr(str, to_find);
|
||||
|
||||
@ -3269,7 +3267,7 @@ g_save_to_bmp(const char* filename, char* data, int stride_bytes,
|
||||
data -= stride_bytes;
|
||||
if ((depth == 24) && (bits_per_pixel == 32))
|
||||
{
|
||||
line = malloc(file_stride_bytes);
|
||||
line = (char *) malloc(file_stride_bytes);
|
||||
memset(line, 0, file_stride_bytes);
|
||||
for (index = 0; index < height; index++)
|
||||
{
|
||||
|
@ -21,14 +21,11 @@
|
||||
#if !defined(OS_CALLS_H)
|
||||
#define OS_CALLS_H
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config_ac.h"
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "arch.h"
|
||||
|
||||
#define g_tcp_can_recv g_sck_can_recv
|
||||
@ -45,13 +42,6 @@
|
||||
#define g_tcp_select g_sck_select
|
||||
#define g_close_wait_obj g_delete_wait_obj
|
||||
|
||||
#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
|
||||
#define printflike(arg_format, arg_first_check) \
|
||||
__attribute__((__format__(__printf__, arg_format, arg_first_check)))
|
||||
#else
|
||||
#define printflike(arg_format, arg_first_check)
|
||||
#endif
|
||||
|
||||
int APP_CC g_rm_temp_dir(void);
|
||||
int APP_CC g_mk_temp_dir(const char* app_name);
|
||||
void APP_CC g_init(const char* app_name);
|
||||
@ -115,14 +105,14 @@ int APP_CC g_file_open_ex(const char *file_name, int aread, int awrite,
|
||||
int acreate, int atrunc);
|
||||
int APP_CC g_file_close(int fd);
|
||||
int APP_CC g_file_read(int fd, char* ptr, int len);
|
||||
int APP_CC g_file_write(int fd, char* ptr, int len);
|
||||
int APP_CC g_file_write(int fd, const char *ptr, int len);
|
||||
int APP_CC g_file_seek(int fd, int offset);
|
||||
int APP_CC g_file_lock(int fd, int start, int len);
|
||||
int APP_CC g_chmod_hex(const char* filename, int flags);
|
||||
int APP_CC g_chown(const char* name, int uid, int gid);
|
||||
int APP_CC g_mkdir(const char* dirname);
|
||||
char* APP_CC g_get_current_dir(char* dirname, int maxlen);
|
||||
int APP_CC g_set_current_dir(char* dirname);
|
||||
int APP_CC g_set_current_dir(const char *dirname);
|
||||
int APP_CC g_file_exist(const char* filename);
|
||||
int APP_CC g_directory_exist(const char* dirname);
|
||||
int APP_CC g_create_dir(const char* dirname);
|
||||
@ -131,7 +121,7 @@ int APP_CC g_remove_dir(const char* dirname);
|
||||
int APP_CC g_file_delete(const char* filename);
|
||||
int APP_CC g_file_get_size(const char* filename);
|
||||
int APP_CC g_strlen(const char* text);
|
||||
char* APP_CC g_strchr(const char* text, int c);
|
||||
const char *APP_CC g_strchr(const char *text, int c);
|
||||
char* APP_CC g_strcpy(char* dest, const char* src);
|
||||
char* APP_CC g_strncpy(char* dest, const char* src, int len);
|
||||
char* APP_CC g_strcat(char* dest, const char* src);
|
||||
@ -194,4 +184,10 @@ int APP_CC g_shmdt(const void *shmaddr);
|
||||
int APP_CC g_gethostname(char *name, int len);
|
||||
int APP_CC g_mirror_memcpy(void *dst, const void *src, int len);
|
||||
|
||||
/* glib-style wrappers */
|
||||
#define g_new(struct_type, n_structs) \
|
||||
(struct_type *) malloc(sizeof(struct_type) * (n_structs))
|
||||
#define g_new0(struct_type, n_structs) \
|
||||
(struct_type *) calloc((n_structs), sizeof(struct_type))
|
||||
|
||||
#endif
|
||||
|
@ -111,7 +111,7 @@ ssl_sha1_clear(void *sha1_info)
|
||||
|
||||
/*****************************************************************************/
|
||||
void APP_CC
|
||||
ssl_sha1_transform(void *sha1_info, char *data, int len)
|
||||
ssl_sha1_transform(void *sha1_info, const char *data, int len)
|
||||
{
|
||||
SHA1_Update((SHA_CTX *)sha1_info, data, len);
|
||||
}
|
||||
@ -187,7 +187,7 @@ ssl_des3_decrypt_info_create(const char *key, const char* ivec)
|
||||
const tui8 *lkey;
|
||||
const tui8 *livec;
|
||||
|
||||
des3_ctx = g_malloc(sizeof(EVP_CIPHER_CTX), 1);
|
||||
des3_ctx = g_new0(EVP_CIPHER_CTX, 1);
|
||||
EVP_CIPHER_CTX_init(des3_ctx);
|
||||
lkey = (const tui8 *) key;
|
||||
livec = (const tui8 *) ivec;
|
||||
@ -560,7 +560,7 @@ ssl_tls_create(struct trans *trans, const char *key, const char *cert)
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
ssl_tls_print_error(char *func, SSL *connection, int value)
|
||||
ssl_tls_print_error(const char *func, SSL *connection, int value)
|
||||
{
|
||||
switch (SSL_get_error(connection, value))
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ ssl_sha1_info_delete(void* sha1_info);
|
||||
void APP_CC
|
||||
ssl_sha1_clear(void* sha1_info);
|
||||
void APP_CC
|
||||
ssl_sha1_transform(void* sha1_info, char* data, int len);
|
||||
ssl_sha1_transform(void* sha1_info, const char *data, int len);
|
||||
void APP_CC
|
||||
ssl_sha1_complete(void* sha1_info, char* data);
|
||||
void* APP_CC
|
||||
@ -84,8 +84,8 @@ ssl_gen_key_xrdp1(int key_size_in_bits, char* exp, int exp_len,
|
||||
/* ssl_tls */
|
||||
struct ssl_tls
|
||||
{
|
||||
void *ssl; /* SSL * */
|
||||
void *ctx; /* SSL_CTX * */
|
||||
struct ssl_st *ssl; /* SSL * */
|
||||
struct ssl_ctx_st *ctx; /* SSL_CTX * */
|
||||
char *cert;
|
||||
char *key;
|
||||
struct trans *trans;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
trans_tls_recv(struct trans *self, void *ptr, int len)
|
||||
trans_tls_recv(struct trans *self, char *ptr, int len)
|
||||
{
|
||||
if (self->tls == NULL)
|
||||
{
|
||||
@ -39,7 +39,7 @@ trans_tls_recv(struct trans *self, void *ptr, int len)
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
trans_tls_send(struct trans *self, const void *data, int len)
|
||||
trans_tls_send(struct trans *self, const char *data, int len)
|
||||
{
|
||||
if (self->tls == NULL)
|
||||
{
|
||||
@ -61,14 +61,14 @@ trans_tls_can_recv(struct trans *self, int sck, int millis)
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
trans_tcp_recv(struct trans *self, void *ptr, int len)
|
||||
trans_tcp_recv(struct trans *self, char *ptr, int len)
|
||||
{
|
||||
return g_tcp_recv(self->sck, ptr, len, 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
trans_tcp_send(struct trans *self, const void *data, int len)
|
||||
trans_tcp_send(struct trans *self, const char *data, int len)
|
||||
{
|
||||
return g_tcp_send(self->sck, data, len, 0);
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ typedef int (DEFAULT_CC *ttrans_data_in)(struct trans* self);
|
||||
typedef int (DEFAULT_CC *ttrans_conn_in)(struct trans* self,
|
||||
struct trans* new_self);
|
||||
typedef int (DEFAULT_CC *tis_term)(void);
|
||||
typedef int (APP_CC *trans_recv_proc) (struct trans *self, void *ptr, int len);
|
||||
typedef int (APP_CC *trans_send_proc) (struct trans *self, const void *data, int len);
|
||||
typedef int (APP_CC *trans_recv_proc) (struct trans *self, char *ptr, int len);
|
||||
typedef int (APP_CC *trans_send_proc) (struct trans *self, const char *data, int len);
|
||||
typedef int (APP_CC *trans_can_recv_proc) (struct trans *self, int sck, int millis);
|
||||
|
||||
/* optional source info */
|
||||
|
@ -14,6 +14,7 @@ PKG_PROG_PKG_CONFIG
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
AX_CFLAGS_WARN_ALL
|
||||
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
|
||||
AX_GCC_FUNC_ATTRIBUTE([format])
|
||||
|
||||
case $host_os in
|
||||
|
@ -1,127 +1,145 @@
|
||||
.\"
|
||||
.TH "sesman.ini" "5" "0.1.0" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBsesman.ini\fR \- Configuration file for \fBsesman\fR(8)
|
||||
\fBsesman.ini\fR \- Configuration file for \fBxrdp-sesman\fR(8)
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
This is the man page for \fBsesman.ini\fR, \fBsesman\fR(8) configuration file.
|
||||
It is composed by a number of sections, each one composed by a section name, enclosed by square brackets, folowed by a list of \fI<parameter>\fR=\fI<value>\fR lines.
|
||||
|
||||
\fBsesman.ini\fR supports the following sections:
|
||||
\fBsesman.ini\fR consists of several sections. Each section starts with
|
||||
the section name in square brackets, followed by a list of
|
||||
\fIparameter\fR=\fIvalue\fR lines. Following sections are recognized:
|
||||
|
||||
.TP
|
||||
\fB[Globals]\fR \- sesman global configuration section,
|
||||
\fB[Globals]\fR
|
||||
Global configuration
|
||||
|
||||
.TP
|
||||
\fB[Logging]\fR \- logging subsystem parameters
|
||||
\fB[Logging]\fR
|
||||
Logging subsystem
|
||||
|
||||
.TP
|
||||
\fB[Security]\fR \- Access control parameters
|
||||
\fB[Sessions]\fR
|
||||
Session management
|
||||
|
||||
.TP
|
||||
\fB[Sessions]\fR \- Session management parameters
|
||||
\fB[Security]\fR
|
||||
Access control
|
||||
|
||||
.TP
|
||||
\fB[X11rdp]\fR, \fB[Xvnc]\fR, \fB[Xorg]\fR
|
||||
X11 server settings for supported servers
|
||||
|
||||
.TP
|
||||
\fB[Chansrv]\fR
|
||||
Settings for xrdp-chansrv(8)
|
||||
|
||||
.TP
|
||||
\fB[SessionVariables]\fR
|
||||
Environment variables for the session
|
||||
|
||||
.LP
|
||||
All options and values (except for file names and paths) are case insensitive, and are described in detail below.
|
||||
|
||||
.LP
|
||||
For any of the following parameter, if it's specified more than one time the last entry encountered will be used.
|
||||
|
||||
\fBNOTE\fR: if any of these options is specified outside its section, it will be \fIignored\fR.
|
||||
All parameters and values (except for file names and paths) are case
|
||||
insensitive, and are described in detail below. If any parameter is
|
||||
specified more than once, the last entry will be used. Options specified
|
||||
outside their proper section will be \fIignored\fR.
|
||||
|
||||
.SH "GLOBALS"
|
||||
The options to be specified in the \fB[globals]\fR section are the following:
|
||||
Following parameters can be used in the \fB[Globals]\fR section.
|
||||
|
||||
.TP
|
||||
\fBListenAddress\fR=\fIip address\fR
|
||||
Specifies sesman listening address. Default is 0.0.0.0 (all interfaces)
|
||||
xrdp-sesman listening address. Default is 0.0.0.0 (all interfaces).
|
||||
|
||||
.TP
|
||||
\fBListenPort\fR=\fIport number\fR
|
||||
Specifies sesman listening port. Default is 3350
|
||||
xrdp-sesman listening port. Default is 3350.
|
||||
|
||||
.TP
|
||||
\fBEnableUserWindowManager\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables user specific window manager, that is, anyone can define it's own script executed by sesman when starting a new session, specified by \fBUserWindowManager\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables user
|
||||
specific startup script. That is, xrdp-sesman will execute the script
|
||||
specified by \fBUserWindowManager\fR if it exists.
|
||||
|
||||
.TP
|
||||
\fBUserWindowManager\fR=\fIstartwm.sh\fR
|
||||
This option specifies the script run by sesman when starting a session and per\-user window manager is enabled.
|
||||
.br
|
||||
The path is relative to user's HOME directory
|
||||
\fBUserWindowManager\fR=\fIfilename\fR
|
||||
Name of the startup script relative to the user's home directory. If
|
||||
present and enabled by \fBEnableUserWindowManager\fR, that script is
|
||||
executed instead of \fBDefaultWindowManager\fR.
|
||||
|
||||
.TP
|
||||
\fBDefaultWindowManager\fR=\fI${SESMAN_BIN_DIR}/startwm.sh\fR
|
||||
This contains full path to the default window manager startup script used by sesman to start a session
|
||||
\fBDefaultWindowManager\fR=\fIfilename\fR
|
||||
Full path to the default startup script used by xrdp-sesman to start a
|
||||
session if the user script is disabled or missing.
|
||||
|
||||
.SH "LOGGING"
|
||||
The following parameters can be used in the \fB[logging]\fR section:
|
||||
Following parameters can be used in the \fB[Logging]\fR section.
|
||||
|
||||
.TP
|
||||
\fBLogFile\fR=\fI${SESMAN_LOG_DIR}/sesman.log\fR
|
||||
This options contains the path to logfile. It can be either absolute or relative, and the default is \fI${SESMAN_LOG_DIR}/sesman.log\fR
|
||||
\fBLogFile\fR=\fIfilename\fR
|
||||
Log file path. It can be either absolute or relative. The default is
|
||||
\fI./sesman.log\fR
|
||||
|
||||
.TP
|
||||
\fBLogLevel\fR=\fIlevel\fR
|
||||
This option can have one of the following values:
|
||||
|
||||
\fBCORE\fR or \fB0\fR \- Log only core messages. these messages are _always_ logged, regardless the logging level selected.
|
||||
\fBCORE\fR or \fB0\fR \- Log only core messages. Those messages are
|
||||
logged \fIregardless\fR of the selected logging level.
|
||||
|
||||
\fBERROR\fR or \fB1\fR \- Log only error messages
|
||||
\fBERROR\fR or \fB1\fR \- Log only error messages.
|
||||
|
||||
\fBWARNING\fR, \fBWARN\fR or \fB2\fR \- Logs warnings and error messages
|
||||
\fBWARNING\fR, \fBWARN\fR or \fB2\fR \- Logs warnings and error messages.
|
||||
|
||||
\fBINFO\fR or \fB3\fR \- Logs errors, warnings and informational messages
|
||||
\fBINFO\fR or \fB3\fR \- Log errors, warnings and informational messages.
|
||||
|
||||
\fBDEBUG\fR or \fB4\fR \- Log everything. If \fBsesman\fR is compiled in debug mode, this options will output many more low\-level message, useful for developers
|
||||
\fBDEBUG\fR or \fB4\fR \- Log everything. If xrdp-sesman is compiled in
|
||||
debug mode, this options will output many more low\-level messages.
|
||||
|
||||
.TP
|
||||
\fBEnableSyslog\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables logging to syslog. Otherwise syslog is disabled.
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging to
|
||||
syslog.
|
||||
|
||||
.TP
|
||||
\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.
|
||||
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.
|
||||
|
||||
.SH "SESSIONS"
|
||||
The following parameters can be used in the \fB[Sessions]\fR section:
|
||||
Following parameters can be used in the \fB[Sessions]\fR section.
|
||||
|
||||
.TP
|
||||
\fBX11DisplayOffset\fR=\fI<number>\fR
|
||||
Specifies the first X display number available for \fBsesman\fP(8). This prevents sesman from interfering with real X11 servers. The default is 10.
|
||||
\fBX11DisplayOffset\fR=\fInumber\fR
|
||||
The first X display number available for xrdp-sesman. This prevents
|
||||
xrdp-sesman from interfering with real X11 servers. The default is 10.
|
||||
|
||||
.TP
|
||||
\fBMaxSessions\fR=\fI<number>\fR
|
||||
Sets the maximum number of simultaneous session on terminal server.
|
||||
.br
|
||||
If unset or set to \fI0\fR, unlimited session are allowed.
|
||||
\fBMaxSessions\fR=\fInumber\fR
|
||||
Sets the maximum number of simultaneous sessions. If not set or set to
|
||||
\fI0\fR, unlimited session are allowed.
|
||||
|
||||
.TP
|
||||
\fBKillDisconnected\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, every session will be killed within 60 seconds when the user disconnects.
|
||||
.br
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, every session will be killed
|
||||
within 60 seconds after the user disconnects.
|
||||
|
||||
.TP
|
||||
\fBIdleTimeLimit\fR=\fI<number>\fR
|
||||
Sets the the time limit before an idle session is disconnected.
|
||||
.br
|
||||
If set to \fI0\fR, automatic disconnection is disabled.
|
||||
.br
|
||||
\fI\-this option is currently ignored!\-\fR
|
||||
\fBIdleTimeLimit\fR=\fInumber\fR
|
||||
\fI\This option is currently ignored!\fR Time limit before an idle
|
||||
session is disconnected. If set to \fI0\fR, automatic disconnection is
|
||||
disabled.
|
||||
|
||||
.TP
|
||||
\fBDisconnectedTimeLimit\fR=\fI<number>\fR
|
||||
Sets the time(in seconds) limit before a disconnected session is killed.
|
||||
.br
|
||||
\fBDisconnectedTimeLimit\fR=\fInumber\fR
|
||||
Sets the time limit (in seconds) before a disconnected session is killed.
|
||||
If set to \fI0\fR, automatic killing is disabled.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBPolicy\fR=\fI[Default|UBD|UBI|UBC|UBDI|UBDC]\fR
|
||||
Session allocation policy. By Default, a new session is created
|
||||
Session allocation policy. By default, a new session is created
|
||||
for the combination <User,BitPerPixel> when using Xrdp, and
|
||||
for the combination <User,BitPerPixel,DisplaySize> when using Xvnc.
|
||||
This behaviour can be changed by setting session policy to:
|
||||
This behavior can be changed by setting session policy to:
|
||||
.br
|
||||
|
||||
.br
|
||||
@ -137,70 +155,71 @@ This behaviour can be changed by setting session policy to:
|
||||
.br
|
||||
|
||||
.br
|
||||
Note that the criteria <User,BitPerPixel> can not be turned off
|
||||
and <DisplaySize> will always be checkt when for Xvnc connections.
|
||||
Note that the \fBUser\fR and \fBBitPerPixel\fR criteria cannot be turned
|
||||
off. For Xvnc connections, \fBDisplaySize\fR is always enabled as well.
|
||||
.br
|
||||
|
||||
.SH "SECURITY"
|
||||
The following parameters can be used in the \fB[Sessions]\fR section:
|
||||
Following parameters can be used in the \fB[Security]\fR section.
|
||||
|
||||
.TP
|
||||
\fBAllowRootLogin\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR enables root login on the terminal server
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, enables root login on the
|
||||
terminal server.
|
||||
|
||||
.TP
|
||||
\fBMaxLoginRetry\fR=\fI[0|1]\fR
|
||||
The number of login attempts that are allowed on terminal server. If set to \fI0\fR, unlimited attempts are allowed. The default value for this field is \fI3\fR.
|
||||
\fBMaxLoginRetry\fR=\fInumber\fR
|
||||
The number of login attempts that are allowed on terminal server. If set
|
||||
to \fI0\fR, unlimited attempts are allowed. The default value for this
|
||||
field is \fI3\fR.
|
||||
|
||||
.TP
|
||||
\fBTerminalServerUsers\fR=\fItsusers\fR
|
||||
Only the users belonging to the group \fItsusers\fR are allowed to login on terminal server.
|
||||
.br
|
||||
If unset or set to an invalid or non\-existent group, login for all users is enabled.
|
||||
\fBTerminalServerUsers\fR=\fIgroup\fR
|
||||
Only the users belonging to the specified group are allowed to login on
|
||||
terminal server. If unset or set to an invalid or non\-existent group,
|
||||
login for all users is enabled.
|
||||
|
||||
.TP
|
||||
\fBTerminalServerAdmins\fR=\fItsadmins\fR
|
||||
Sets the group which a user shall belong to have session management rights.
|
||||
.br
|
||||
\fI\-this option is currently ignored!\-\fR
|
||||
\fBTerminalServerAdmins\fR=\fIgroup\fR
|
||||
\fIThis option is currently ignored!\fR Only members of this group can
|
||||
have session management rights.
|
||||
|
||||
.SH "EXAMPLES"
|
||||
This is an example \fBsesman.ini\fR:
|
||||
.TP
|
||||
\fBAlwaysGroupCheck\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, require group membership even
|
||||
if the group specified in \fBTerminalServerUsers\fR doesn't exist.
|
||||
|
||||
.nf
|
||||
[Globals]
|
||||
ListenAddress=127.0.0.1
|
||||
ListenPort=3350
|
||||
EnableUserWindowManager=1
|
||||
UserWindowManager=startwm.sh
|
||||
DefaultWindowManager=startwm.sh
|
||||
.SH "X11 SERVER"
|
||||
Following parameters can be used in the \fB[X11rdp]\fR, \fB[Xvnc]\fR and
|
||||
\fB[Xorg]\fR sections.
|
||||
|
||||
[Logging]
|
||||
LogFile=/usr/local/xrdp/sesman.log
|
||||
LogLevel=DEBUG
|
||||
EnableSyslog=0
|
||||
SyslogLevel=DEBUG
|
||||
.TP
|
||||
\fBparam0\fR=\fIfilename\fR
|
||||
Path to the X11 server executable
|
||||
|
||||
[Sessions]
|
||||
MaxSessions=10
|
||||
KillDisconnected=0
|
||||
IdleTimeLimit=0
|
||||
DisconnectedTimeLimit=0
|
||||
.TP
|
||||
\fBparam\fR\fIN\fR=\fIstring\fR
|
||||
Nth command line argument
|
||||
|
||||
[Security]
|
||||
AllowRootLogin=1
|
||||
MaxLoginRetry=3
|
||||
TerminalServerUsers=tsusers
|
||||
TerminalServerAdmins=tsadmins
|
||||
.fi
|
||||
.SH "CHANSRV"
|
||||
Following parameters can be used in the \fB[Chansrv]\fR section.
|
||||
|
||||
.TP
|
||||
\fBFuseMountName\fR=\fIstring\fR
|
||||
Directory for drive redirection, relative to the user home directory.
|
||||
Created if it doesn't exist. Defaults to \fIxrdp_client\fR
|
||||
|
||||
.SH "SESSIONS VARIABLES"
|
||||
All entries it the \fB[SessionVariables]\fR section are set as
|
||||
environment variables in the user's session.
|
||||
|
||||
.SH "FILES"
|
||||
${SESMAN_CFG_DIR}/sesman.ini
|
||||
/etc/xrdp/sesman.ini
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR sesman (8),
|
||||
.BR sesrun (8),
|
||||
.BR xrdp-sesman (8),
|
||||
.BR xrdp-sesrun (8),
|
||||
.BR xrdp (8),
|
||||
.BR xrdp.ini (5)
|
||||
|
||||
for more info on \fBxrdp\fR see http://xrdp.sf.net
|
||||
For more info on \fBxrdp\fR see http://xrdp.sf.net
|
||||
|
@ -7,7 +7,7 @@ xrdp\-dis \- xrdp disconnect utility
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBxrdp\-dix\fP is run with no parameters to disconnect your xrdp session.
|
||||
\fBxrdp\-dis\fP is run with no parameters to disconnect your xrdp session.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
|
@ -158,13 +158,13 @@ This option sets the logging level for syslog. It can have the same values of \f
|
||||
.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.
|
||||
Not all channels are supported in all cases, so setting a value to \fItrue\fP is a pre-requisite, but does not force it's use.
|
||||
Not all channels are supported in all cases, so setting a value to \fItrue\fP is a prerequisite, but does not force its use.
|
||||
.br
|
||||
Channels can also be enabled or disabled on a per connection basis by prefixing each setting with \fBchannel.\fP in the channel section.
|
||||
|
||||
.TP
|
||||
\fBrdpdr\fP=\fI[0|1]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for device re-direction is allowed.
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for device redirection is allowed.
|
||||
|
||||
.TP
|
||||
\fBrdpsnd\fP=\fI[0|1]\fP
|
||||
@ -176,7 +176,7 @@ If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel to initiate add
|
||||
|
||||
.TP
|
||||
\fBcliprdr\fP=\fI[0|1]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for clipboard re-direction is allowed.
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for clipboard redirection is allowed.
|
||||
|
||||
.TP
|
||||
\fBrail\fP=\fI[0|1]\fP
|
||||
|
@ -2,17 +2,17 @@ General FAQ
|
||||
|
||||
Q. What is RDP?
|
||||
|
||||
A. RDP stands for Remote Desktop Protocol. Its the protocol used by Windows
|
||||
A. RDP stands for Remote Desktop Protocol. It's the protocol used by Windows
|
||||
terminal servers to talk to the terminal server clients.
|
||||
|
||||
|
||||
Q. What is xrdp?
|
||||
|
||||
A. xrdp, usually spell lower case, is as open source implementation of the RDP
|
||||
protocol.
|
||||
A. xrdp, usually spelled in lower case, is as open source implementation of the
|
||||
RDP protocol.
|
||||
|
||||
|
||||
Q. I can't get it to compile in Ubuntu. What can I do?
|
||||
Q. I can't get xrdp to compile in Ubuntu. What can I do?
|
||||
|
||||
A. See faq-compile.txt.
|
||||
|
||||
|
@ -48,7 +48,10 @@ int main(int argc, char **argv)
|
||||
char text[256];
|
||||
char *displayname = NULL;
|
||||
char *outfname;
|
||||
char *sections[8] = {"noshift", "shift", "altgr", "shiftaltgr", "capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr"};
|
||||
const char *sections[8] = {
|
||||
"noshift", "shift", "altgr", "shiftaltgr",
|
||||
"capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr"
|
||||
};
|
||||
int states[8] = {0, 1, 0x80, 0x81, 2, 0x82, 3, 0x83};
|
||||
int i;
|
||||
int idx;
|
||||
|
@ -282,7 +282,7 @@ sign_key(char *e_data, int e_len, char *n_data, int n_len,
|
||||
|
||||
/*****************************************************************************/
|
||||
static int APP_CC
|
||||
write_out_line(int fd, char *name, char *data, int len)
|
||||
write_out_line(int fd, const char *name, char *data, int len)
|
||||
{
|
||||
int max;
|
||||
int error;
|
||||
|
@ -485,12 +485,12 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
||||
|
||||
if (j > 32768)
|
||||
{
|
||||
g_writeln("error, decompressed size too big, its %d", j);
|
||||
g_writeln("error, decompressed size too big: %d bytes", j);
|
||||
}
|
||||
|
||||
if (bufsize > 8192)
|
||||
{
|
||||
g_writeln("error, compressed size too big, its %d", bufsize);
|
||||
g_writeln("error, compressed size too big: %d bytes", bufsize);
|
||||
}
|
||||
|
||||
s->p = s->end;
|
||||
@ -504,7 +504,7 @@ libxrdp_send_bitmap(struct xrdp_session *session, int width, int height,
|
||||
|
||||
if (total_bufsize > 8192)
|
||||
{
|
||||
g_writeln("error, total compressed size too big, its %d",
|
||||
g_writeln("error, total compressed size too big: %d bytes",
|
||||
total_bufsize);
|
||||
}
|
||||
}
|
||||
@ -1077,7 +1077,7 @@ libxrdp_query_channel(struct xrdp_session *session, int index,
|
||||
/* returns a zero based index of the channel, -1 if error or it doesn't
|
||||
exist */
|
||||
int EXPORT_CC
|
||||
libxrdp_get_channel_id(struct xrdp_session *session, char *name)
|
||||
libxrdp_get_channel_id(struct xrdp_session *session, const char *name)
|
||||
{
|
||||
int index = 0;
|
||||
int count = 0;
|
||||
|
@ -189,7 +189,7 @@ int DEFAULT_CC
|
||||
libxrdp_query_channel(struct xrdp_session *session, int index,
|
||||
char *channel_name, int *channel_flags);
|
||||
int DEFAULT_CC
|
||||
libxrdp_get_channel_id(struct xrdp_session *session, char *name);
|
||||
libxrdp_get_channel_id(struct xrdp_session *session, const char *name);
|
||||
int DEFAULT_CC
|
||||
libxrdp_send_to_channel(struct xrdp_session *session, int channel_id,
|
||||
char *data, int data_len,
|
||||
|
@ -1023,7 +1023,7 @@ xrdp_mcs_send(struct xrdp_mcs *self, struct stream *s, int chan)
|
||||
|
||||
if (len > 8192 * 2)
|
||||
{
|
||||
g_writeln("error in xrdp_mcs_send, size too big, its %d", len);
|
||||
g_writeln("error in xrdp_mcs_send, size too big: %d bytes", len);
|
||||
}
|
||||
|
||||
//if (len > max_len)
|
||||
|
@ -236,7 +236,7 @@ xrdp_orders_check(struct xrdp_orders *self, int max_size)
|
||||
size = (int)(self->out_s->p - self->order_count_ptr);
|
||||
if (size < 0)
|
||||
{
|
||||
g_writeln("error in xrdp_orders_check, size too small, its %d", size);
|
||||
g_writeln("error in xrdp_orders_check, size too small: %d bytes", size);
|
||||
return 1;
|
||||
}
|
||||
if (size > max_packet_size)
|
||||
@ -244,7 +244,7 @@ xrdp_orders_check(struct xrdp_orders *self, int max_size)
|
||||
/* this suggests someone calls this function without passing the
|
||||
correct max_size so we end up putting more into the buffer
|
||||
than we indicate we can */
|
||||
g_writeln("error in xrdp_orders_check, size too big, its %d", size);
|
||||
g_writeln("error in xrdp_orders_check, size too big: %d bytes", size);
|
||||
/* We where getting called with size already greater than
|
||||
max_packet_size
|
||||
Which I suspect was because the sending of text did not include
|
||||
@ -507,7 +507,7 @@ xrdp_orders_rect(struct xrdp_orders *self, int x, int y, int cx, int cy,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (x < rect->left || y < rect->top ||
|
||||
x + cx > rect->right || y + cy > rect->bottom)
|
||||
{
|
||||
@ -678,7 +678,7 @@ xrdp_orders_screen_blt(struct xrdp_orders *self, int x, int y,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (x < rect->left || y < rect->top ||
|
||||
x + cx > rect->right || y + cy > rect->bottom)
|
||||
{
|
||||
@ -870,7 +870,7 @@ xrdp_orders_pat_blt(struct xrdp_orders *self, int x, int y,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (x < rect->left || y < rect->top ||
|
||||
x + cx > rect->right || y + cy > rect->bottom)
|
||||
{
|
||||
@ -1087,7 +1087,7 @@ xrdp_orders_dest_blt(struct xrdp_orders *self, int x, int y,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (x < rect->left || y < rect->top ||
|
||||
x + cx > rect->right || y + cy > rect->bottom)
|
||||
{
|
||||
@ -1258,7 +1258,7 @@ xrdp_orders_line(struct xrdp_orders *self, int mix_mode,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (MIN(endx, startx) < rect->left ||
|
||||
MIN(endy, starty) < rect->top ||
|
||||
MAX(endx, startx) >= rect->right ||
|
||||
@ -1460,7 +1460,7 @@ xrdp_orders_mem_blt(struct xrdp_orders *self, int cache_id,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (x < rect->left || y < rect->top ||
|
||||
x + cx > rect->right || y + cy > rect->bottom)
|
||||
{
|
||||
@ -1667,7 +1667,7 @@ xrdp_orders_composite_blt(struct xrdp_orders* self, int srcidx, int srcformat,
|
||||
self->orders_state.last_order = RDP_ORDER_COMPOSITE;
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if (dstx < rect->left || dsty < rect->top ||
|
||||
dstx + width > rect->right || dsty + height > rect->bottom)
|
||||
{
|
||||
@ -1999,7 +1999,7 @@ xrdp_orders_text(struct xrdp_orders *self,
|
||||
|
||||
if (rect != 0)
|
||||
{
|
||||
/* if clip is present, still check if its needed */
|
||||
/* if clip is present, still check if it's needed */
|
||||
if ((box_right - box_left > 1 &&
|
||||
(box_left < rect->left ||
|
||||
box_top < rect->top ||
|
||||
|
@ -2101,7 +2101,7 @@ xrdp_sec_in_mcs_data(struct xrdp_sec *self)
|
||||
|
||||
client_info = &(self->rdp_layer->client_info);
|
||||
s = &(self->client_mcs_data);
|
||||
/* get hostname, its unicode */
|
||||
/* get hostname, it's unicode */
|
||||
s->p = s->data;
|
||||
if (!s_check_rem(s, 47))
|
||||
{
|
||||
|
67
m4/ax_append_compile_flags.m4
Normal file
67
m4/ax_append_compile_flags.m4
Normal file
@ -0,0 +1,67 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# For every FLAG1, FLAG2 it is checked whether the compiler works with the
|
||||
# flag. If it does, the flag is added FLAGS-VARIABLE
|
||||
#
|
||||
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||
# CFLAGS) is used. During the check the flag is always added to the
|
||||
# current language's flags.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: This macro depends on the AX_APPEND_FLAG and
|
||||
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
|
||||
# AX_APPEND_LINK_FLAGS.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 5
|
||||
|
||||
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
|
||||
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
for flag in $1; do
|
||||
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
|
||||
done
|
||||
])dnl AX_APPEND_COMPILE_FLAGS
|
74
m4/ax_check_compile_flag.m4
Normal file
74
m4/ax_check_compile_flag.m4
Normal file
@ -0,0 +1,74 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 4
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
12
mc/mc.c
12
mc/mc.c
@ -75,13 +75,13 @@ lib_mod_end(struct mod *mod)
|
||||
/******************************************************************************/
|
||||
/* return error */
|
||||
int DEFAULT_CC
|
||||
lib_mod_set_param(struct mod *mod, char *name, char *value)
|
||||
lib_mod_set_param(struct mod *mod, const char *name, char *value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct mod *EXPORT_CC
|
||||
tintptr EXPORT_CC
|
||||
mod_init(void)
|
||||
{
|
||||
struct mod *mod;
|
||||
@ -89,20 +89,22 @@ mod_init(void)
|
||||
mod = (struct mod *)g_malloc(sizeof(struct mod), 1);
|
||||
mod->size = sizeof(struct mod);
|
||||
mod->version = CURRENT_MOD_VER;
|
||||
mod->handle = (long)mod;
|
||||
mod->handle = (tintptr) mod;
|
||||
mod->mod_connect = lib_mod_connect;
|
||||
mod->mod_start = lib_mod_start;
|
||||
mod->mod_event = lib_mod_event;
|
||||
mod->mod_signal = lib_mod_signal;
|
||||
mod->mod_end = lib_mod_end;
|
||||
mod->mod_set_param = lib_mod_set_param;
|
||||
return mod;
|
||||
return (tintptr) mod;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int EXPORT_CC
|
||||
mod_exit(struct mod *mod)
|
||||
mod_exit(tintptr handle)
|
||||
{
|
||||
struct mod *mod = (struct mod *) handle;
|
||||
|
||||
if (mod == 0)
|
||||
{
|
||||
return 0;
|
||||
|
4
mc/mc.h
4
mc/mc.h
@ -37,7 +37,7 @@ struct mod
|
||||
long param3, long param4);
|
||||
int (*mod_signal)(struct mod* v);
|
||||
int (*mod_end)(struct mod* v);
|
||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||
int (*mod_set_param)(struct mod* v, const char *name, char* value);
|
||||
int (*mod_session_change)(struct mod* v, int, int);
|
||||
int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount,
|
||||
tbus* write_objs, int* wcount, int* timeout);
|
||||
@ -80,7 +80,7 @@ struct mod
|
||||
int (*server_query_channel)(struct mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||
int (*server_get_channel_id)(struct mod* v, const char *name);
|
||||
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||
char* data, int data_len,
|
||||
int total_data_len, int flags);
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "xrdp_rail.h"
|
||||
#include "log.h"
|
||||
#include <freerdp/settings.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#ifdef XRDP_DEBUG
|
||||
#define LOG_LEVEL 99
|
||||
@ -230,7 +229,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 17: /* Synchronize */
|
||||
LLOGLN(11, ("Synchronized event handled : %d", param1));
|
||||
LLOGLN(11, ("Synchronized event handled : %ld", param1));
|
||||
/* In some situations the Synchronize event come to early.
|
||||
Therefore we store this information and use it when we
|
||||
receive the first keyboard event
|
||||
@ -246,7 +245,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 100: /* mouse move */
|
||||
LLOGLN(12, ("mouse move %d %d", param1, param2));
|
||||
LLOGLN(12, ("mouse move %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_MOVE;
|
||||
@ -254,7 +253,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 101: /* left button up */
|
||||
LLOGLN(12, ("left button up %d %d", param1, param2));
|
||||
LLOGLN(12, ("left button up %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_BUTTON1;
|
||||
@ -262,7 +261,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 102: /* left button down */
|
||||
LLOGLN(12, ("left button down %d %d", param1, param2));
|
||||
LLOGLN(12, ("left button down %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_BUTTON1 | PTR_FLAGS_DOWN;
|
||||
@ -270,7 +269,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 103: /* right button up */
|
||||
LLOGLN(12, ("right button up %d %d", param1, param2));
|
||||
LLOGLN(12, ("right button up %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_BUTTON2;
|
||||
@ -278,7 +277,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 104: /* right button down */
|
||||
LLOGLN(12, ("right button down %d %d", param1, param2));
|
||||
LLOGLN(12, ("right button down %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_BUTTON2 | PTR_FLAGS_DOWN;
|
||||
@ -286,7 +285,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 105: /* middle button up */
|
||||
LLOGLN(12, ("middle button up %d %d", param1, param2));
|
||||
LLOGLN(12, ("middle button up %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_BUTTON3;
|
||||
@ -294,7 +293,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
|
||||
break;
|
||||
|
||||
case 106: /* middle button down */
|
||||
LLOGLN(12, ("middle button down %d %d", param1, param2));
|
||||
LLOGLN(12, ("middle button down %ld %ld", param1, param2));
|
||||
x = param1;
|
||||
y = param2;
|
||||
flags = PTR_FLAGS_BUTTON3 | PTR_FLAGS_DOWN;
|
||||
@ -428,7 +427,7 @@ lxrdp_end(struct mod *mod)
|
||||
/******************************************************************************/
|
||||
/* return error */
|
||||
static int DEFAULT_CC
|
||||
lxrdp_set_param(struct mod *mod, char *name, char *value)
|
||||
lxrdp_set_param(struct mod *mod, const char *name, char *value)
|
||||
{
|
||||
rdpSettings *settings;
|
||||
|
||||
@ -1368,7 +1367,9 @@ lfreerdp_polygon_sc(rdpContext *context, POLYGON_SC_ORDER *polygon_sc)
|
||||
{
|
||||
struct mod *mod;
|
||||
int i, npoints;
|
||||
XPoint points[4];
|
||||
struct {
|
||||
short x, y;
|
||||
} points[4];
|
||||
int fgcolor;
|
||||
int server_bpp, client_bpp;
|
||||
|
||||
@ -1954,7 +1955,7 @@ lfreerdp_verify_certificate(freerdp *instance, char *subject, char *issuer,
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct mod *EXPORT_CC
|
||||
tintptr EXPORT_CC
|
||||
mod_init(void)
|
||||
{
|
||||
struct mod *mod;
|
||||
@ -1967,7 +1968,7 @@ mod_init(void)
|
||||
mod->vmaj, mod->vmin, mod->vrev));
|
||||
mod->size = sizeof(struct mod);
|
||||
mod->version = CURRENT_MOD_VER;
|
||||
mod->handle = (tbus)mod;
|
||||
mod->handle = (tintptr) mod;
|
||||
mod->mod_connect = lxrdp_connect;
|
||||
mod->mod_start = lxrdp_start;
|
||||
mod->mod_event = lxrdp_event;
|
||||
@ -1994,13 +1995,15 @@ mod_init(void)
|
||||
lcon->modi = mod;
|
||||
LLOGLN(10, ("mod_init: mod %p", mod));
|
||||
|
||||
return mod;
|
||||
return (tintptr) mod;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int EXPORT_CC
|
||||
mod_exit(struct mod *mod)
|
||||
mod_exit(tintptr handle)
|
||||
{
|
||||
struct mod *mod = (struct mod *) handle;
|
||||
|
||||
LLOGLN(0, ("mod_exit:"));
|
||||
|
||||
if (mod == 0)
|
||||
|
@ -71,7 +71,7 @@ struct mod
|
||||
long param3, long param4);
|
||||
int (*mod_signal)(struct mod *v);
|
||||
int (*mod_end)(struct mod *v);
|
||||
int (*mod_set_param)(struct mod *v, char *name, char *value);
|
||||
int (*mod_set_param)(struct mod *v, const char *name, char *value);
|
||||
int (*mod_session_change)(struct mod *v, int, int);
|
||||
int (*mod_get_wait_objs)(struct mod *v, tbus *read_objs, int *rcount,
|
||||
tbus *write_objs, int *wcount, int *timeout);
|
||||
@ -114,7 +114,7 @@ struct mod
|
||||
int (*server_query_channel)(struct mod *v, int index,
|
||||
char *channel_name,
|
||||
int *channel_flags);
|
||||
int (*server_get_channel_id)(struct mod *v, char *name);
|
||||
int (*server_get_channel_id)(struct mod *v, const char *name);
|
||||
int (*server_send_to_channel)(struct mod *v, int channel_id,
|
||||
char *data, int data_len,
|
||||
int total_data_len, int flags);
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
This is an attempt to explain my odd programming standard used for this project.
|
||||
Not to defend any of these but its my default standard and make it easy
|
||||
for me to read.
|
||||
Not to defend any of these but it's my default standard and it makes it easy
|
||||
for me to read code.
|
||||
|
||||
Some files break these rules, they will be updated eventually.
|
||||
|
||||
try to make any file compile with c++ compilers
|
||||
@ -30,7 +31,7 @@ don't use tabs, use spaces
|
||||
|
||||
no line should exceed 80 chars
|
||||
|
||||
always use {} in if and while, even if its only one line
|
||||
always use {} in if and while, even if it's only one line
|
||||
while (p != 0)
|
||||
{
|
||||
p = p->next;
|
||||
|
12
rdp/rdp.c
12
rdp/rdp.c
@ -242,7 +242,7 @@ lib_mod_end(struct mod *mod)
|
||||
/******************************************************************************/
|
||||
/* return error */
|
||||
int DEFAULT_CC
|
||||
lib_mod_set_param(struct mod *mod, char *name, char *value)
|
||||
lib_mod_set_param(struct mod *mod, const char *name, char *value)
|
||||
{
|
||||
if (g_strncasecmp(name, "ip", 255) == 0)
|
||||
{
|
||||
@ -318,7 +318,7 @@ lib_mod_check_wait_objs(struct mod *mod)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct mod *EXPORT_CC
|
||||
tintptr EXPORT_CC
|
||||
mod_init(void)
|
||||
{
|
||||
struct mod *mod;
|
||||
@ -327,7 +327,7 @@ mod_init(void)
|
||||
mod = (struct mod *)g_malloc(sizeof(struct mod), 1);
|
||||
mod->size = sizeof(struct mod);
|
||||
mod->version = CURRENT_MOD_VER;
|
||||
mod->handle = (long)mod;
|
||||
mod->handle = (tintptr) mod;
|
||||
mod->mod_connect = lib_mod_connect;
|
||||
mod->mod_start = lib_mod_start;
|
||||
mod->mod_event = lib_mod_event;
|
||||
@ -338,13 +338,15 @@ mod_init(void)
|
||||
mod->mod_check_wait_objs = lib_mod_check_wait_objs;
|
||||
mod->rdp_layer = rdp_rdp_create(mod);
|
||||
DEBUG(("out mod_init"));
|
||||
return mod;
|
||||
return (tintptr) mod;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int EXPORT_CC
|
||||
mod_exit(struct mod *mod)
|
||||
mod_exit(tintptr handle)
|
||||
{
|
||||
struct mod *mod = (struct mod *) handle;
|
||||
|
||||
DEBUG(("in mod_exit"));
|
||||
g_free(mod);
|
||||
DEBUG(("out mod_exit"));
|
||||
|
@ -262,7 +262,7 @@ struct mod
|
||||
long param3, long param4);
|
||||
int (*mod_signal)(struct mod* v);
|
||||
int (*mod_end)(struct mod* v);
|
||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||
int (*mod_set_param)(struct mod* v, const char *name, char* value);
|
||||
int (*mod_session_change)(struct mod* v, int, int);
|
||||
int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount,
|
||||
tbus* write_objs, int* wcount, int* timeout);
|
||||
@ -305,7 +305,7 @@ struct mod
|
||||
int (*server_query_channel)(struct mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||
int (*server_get_channel_id)(struct mod* v, const char *name);
|
||||
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||
char* data, int data_len,
|
||||
int total_data_len, int flags);
|
||||
|
@ -312,7 +312,7 @@ rdp_rdp_out_colcache_caps(struct rdp_rdp *self, struct stream *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char caps_0x0d[] =
|
||||
static const unsigned char caps_0x0d[] =
|
||||
{
|
||||
0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00,
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@ -327,11 +327,11 @@ static char caps_0x0d[] =
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static char caps_0x0c[] = { 0x01, 0x00, 0x00, 0x00 };
|
||||
static const unsigned char caps_0x0c[] = { 0x01, 0x00, 0x00, 0x00 };
|
||||
|
||||
static char caps_0x0e[] = { 0x01, 0x00, 0x00, 0x00 };
|
||||
static const unsigned char caps_0x0e[] = { 0x01, 0x00, 0x00, 0x00 };
|
||||
|
||||
static char caps_0x10[] =
|
||||
static const unsigned char caps_0x10[] =
|
||||
{
|
||||
0xFE, 0x00, 0x04, 0x00, 0xFE, 0x00, 0x04, 0x00,
|
||||
0xFE, 0x00, 0x08, 0x00, 0xFE, 0x00, 0x08, 0x00,
|
||||
@ -345,7 +345,7 @@ static char caps_0x10[] =
|
||||
/* Output unknown capability sets */
|
||||
static int APP_CC
|
||||
rdp_rdp_out_unknown_caps(struct rdp_rdp *self, struct stream *s, int id,
|
||||
int length, char *caps)
|
||||
int length, const unsigned char *caps)
|
||||
{
|
||||
out_uint16_le(s, id);
|
||||
out_uint16_le(s, length);
|
||||
@ -415,9 +415,9 @@ rdp_rdp_send_confirm_active(struct rdp_rdp *self, struct stream *s)
|
||||
static int APP_CC
|
||||
rdp_rdp_process_color_pointer_pdu(struct rdp_rdp *self, struct stream *s)
|
||||
{
|
||||
int cache_idx;
|
||||
int dlen;
|
||||
int mlen;
|
||||
unsigned int cache_idx;
|
||||
unsigned int dlen;
|
||||
unsigned int mlen;
|
||||
struct rdp_cursor *cursor;
|
||||
|
||||
in_uint16_le(s, cache_idx);
|
||||
|
@ -55,7 +55,7 @@ static tbus g_thread_done_event = 0;
|
||||
|
||||
static int g_use_unix_socket = 0;
|
||||
|
||||
static char g_xrdpapi_magic[12] =
|
||||
static const unsigned char g_xrdpapi_magic[12] =
|
||||
{ 0x78, 0x32, 0x10, 0x67, 0x00, 0x92, 0x30, 0x56, 0xff, 0xd8, 0xa9, 0x1f };
|
||||
|
||||
int g_display_num = 0;
|
||||
@ -97,7 +97,7 @@ add_timeout(int msoffset, void (*callback)(void *data), void *data)
|
||||
|
||||
LOG(10, ("add_timeout:"));
|
||||
now = g_time3();
|
||||
tobj = g_malloc(sizeof(struct timeout_obj), 1);
|
||||
tobj = g_new0(struct timeout_obj, 1);
|
||||
tobj->mstime = now + msoffset;
|
||||
tobj->callback = callback;
|
||||
tobj->data = data;
|
||||
@ -734,8 +734,7 @@ process_message(void)
|
||||
rv = process_message_channel_data_response(s);
|
||||
break;
|
||||
default:
|
||||
LOGM((LOG_LEVEL_ERROR, "process_message: error in process_message ",
|
||||
"unknown msg %d", id));
|
||||
LOGM((LOG_LEVEL_ERROR, "process_message: unknown msg %d", id));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1402,8 +1401,8 @@ get_log_path()
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static unsigned int APP_CC
|
||||
get_log_level(const char* level_str, unsigned int default_level)
|
||||
static enum logLevels APP_CC
|
||||
get_log_level(const char* level_str, enum logLevels default_level)
|
||||
{
|
||||
static const char* levels[] = {
|
||||
"LOG_LEVEL_ALWAYS",
|
||||
@ -1422,7 +1421,7 @@ get_log_level(const char* level_str, unsigned int default_level)
|
||||
{
|
||||
if (g_strcasecmp(levels[i], level_str) == 0)
|
||||
{
|
||||
return i;
|
||||
return (enum logLevels) i;
|
||||
}
|
||||
}
|
||||
return default_level;
|
||||
@ -1467,7 +1466,7 @@ main(int argc, char **argv)
|
||||
char log_file[256];
|
||||
enum logReturns error;
|
||||
struct log_config logconfig;
|
||||
unsigned int log_level;
|
||||
enum logLevels log_level;
|
||||
|
||||
g_init("xrdp-chansrv"); /* os_calls */
|
||||
|
||||
@ -1499,7 +1498,7 @@ main(int argc, char **argv)
|
||||
logconfig.fd = -1;
|
||||
logconfig.log_level = log_level;
|
||||
logconfig.enable_syslog = 0;
|
||||
logconfig.syslog_level = 0;
|
||||
logconfig.syslog_level = LOG_LEVEL_ALWAYS;
|
||||
error = log_start_from_param(&logconfig);
|
||||
|
||||
if (error != LOG_STARTUP_OK)
|
||||
@ -1629,7 +1628,8 @@ struct_from_dvc_chan_id(tui32 dvc_chan_id)
|
||||
|
||||
for (i = 0; i < MAX_DVC_CHANNELS; i++)
|
||||
{
|
||||
if (g_dvc_channels[i]->dvc_chan_id == dvc_chan_id)
|
||||
if (g_dvc_channels[i]->dvc_chan_id >= 0 &&
|
||||
(tui32) g_dvc_channels[i]->dvc_chan_id == dvc_chan_id)
|
||||
{
|
||||
return g_dvc_channels[i];
|
||||
}
|
||||
@ -1645,7 +1645,8 @@ remove_struct_with_chan_id(tui32 dvc_chan_id)
|
||||
|
||||
for (i = 0; i < MAX_DVC_CHANNELS; i++)
|
||||
{
|
||||
if (g_dvc_channels[i]->dvc_chan_id == dvc_chan_id)
|
||||
if (g_dvc_channels[i]->dvc_chan_id >= 0 &&
|
||||
(tui32) g_dvc_channels[i]->dvc_chan_id == dvc_chan_id)
|
||||
{
|
||||
g_dvc_channels[i] = NULL;
|
||||
return 0;
|
||||
|
@ -295,7 +295,7 @@ int devredir_file_read(void *fusep, tui32 device_id, tui32 FileId,
|
||||
tui32 Length, tui64 Offset);
|
||||
|
||||
int dev_redir_file_write(void *fusep, tui32 device_id, tui32 FileId,
|
||||
const char *buf, tui32 Length, tui64 Offset);
|
||||
const char *buf, int Length, tui64 Offset);
|
||||
|
||||
int devredir_file_close(void *fusep, tui32 device_id, tui32 FileId);
|
||||
|
||||
|
@ -582,7 +582,7 @@ clipboard_send_format_ack(void)
|
||||
/*****************************************************************************/
|
||||
/* returns number of bytes written */
|
||||
int APP_CC
|
||||
clipboard_out_unicode(struct stream *s, char *text, int num_chars)
|
||||
clipboard_out_unicode(struct stream *s, const char *text, int num_chars)
|
||||
{
|
||||
int index;
|
||||
int lnum_chars;
|
||||
@ -1920,7 +1920,8 @@ clipboard_event_selection_notify(XEvent *xevent)
|
||||
for (index = 0; index < n_items; index++)
|
||||
{
|
||||
atom = atoms[index];
|
||||
LOGM((LOG_LEVEL_DEBUG, "clipboard_event_selection_notify: %d %s %d",
|
||||
LOGM((LOG_LEVEL_DEBUG,
|
||||
"clipboard_event_selection_notify: 0x%lx %s 0x%lx",
|
||||
atom, get_atom_text(atom), XA_STRING));
|
||||
log_debug("clipboard_event_selection_notify: 0x%lx %s",
|
||||
atom, get_atom_text(atom));
|
||||
|
@ -127,7 +127,8 @@ struct clip_file_desc /* CLIPRDR_FILEDESCRIPTOR */
|
||||
char cFileName[256];
|
||||
};
|
||||
|
||||
int APP_CC clipboard_out_unicode(struct stream *s, char *text, int num_chars);
|
||||
int APP_CC clipboard_out_unicode(struct stream *s, const char *text,
|
||||
int num_chars);
|
||||
int APP_CC clipboard_in_unicode(struct stream *s, char *text, int *num_chars);
|
||||
|
||||
#endif
|
||||
|
@ -636,7 +636,7 @@ void dev_redir_proc_client_core_cap_resp(struct stream *s)
|
||||
|
||||
void devredir_proc_client_devlist_announce_req(struct stream *s)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
int j;
|
||||
tui32 device_count;
|
||||
tui32 device_type;
|
||||
@ -899,7 +899,7 @@ dev_redir_proc_query_dir_response(IRP *irp,
|
||||
tui32 status;
|
||||
|
||||
char filename[256];
|
||||
int i = 0;
|
||||
unsigned int i = 0;
|
||||
|
||||
xstream_rd_u32_le(s_in, Length);
|
||||
|
||||
@ -962,7 +962,8 @@ dev_redir_proc_query_dir_response(IRP *irp,
|
||||
//log_debug("FileNameLength: %d", FileNameLength);
|
||||
log_debug("FileName: %s", filename);
|
||||
|
||||
if ((xinode = calloc(1, sizeof(struct xrdp_inode))) == NULL)
|
||||
xinode = g_new0(struct xrdp_inode, 1);
|
||||
if (xinode == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
fuse_data = devredir_fuse_data_peek(irp);
|
||||
@ -1255,7 +1256,7 @@ devredir_file_read(void *fusep, tui32 DeviceId, tui32 FileId,
|
||||
|
||||
int APP_CC
|
||||
dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
|
||||
const char *buf, tui32 Length, tui64 Offset)
|
||||
const char *buf, int Length, tui64 Offset)
|
||||
{
|
||||
struct stream *s;
|
||||
IRP *irp;
|
||||
@ -1320,7 +1321,7 @@ dev_redir_file_write(void *fusep, tui32 DeviceId, tui32 FileId,
|
||||
* @return FUSE_DATA on success, or NULL on failure
|
||||
*****************************************************************************/
|
||||
|
||||
void * APP_CC
|
||||
FUSE_DATA *APP_CC
|
||||
devredir_fuse_data_peek(IRP *irp)
|
||||
{
|
||||
log_debug("returning %p", irp->fd_head);
|
||||
@ -1333,7 +1334,7 @@ devredir_fuse_data_peek(IRP *irp)
|
||||
* @return FUSE_DATA on success, NULL on failure
|
||||
*****************************************************************************/
|
||||
|
||||
void * APP_CC
|
||||
FUSE_DATA *APP_CC
|
||||
devredir_fuse_data_dequeue(IRP *irp)
|
||||
{
|
||||
FUSE_DATA *head;
|
||||
@ -1378,7 +1379,8 @@ devredir_fuse_data_enqueue(IRP *irp, void *vp)
|
||||
if (irp == NULL)
|
||||
return -1;
|
||||
|
||||
if ((fd = calloc(1, sizeof(FUSE_DATA))) == NULL)
|
||||
fd = g_new0(FUSE_DATA, 1);
|
||||
if (fd == NULL)
|
||||
return -1;
|
||||
|
||||
fd->data_ptr = vp;
|
||||
@ -1481,7 +1483,7 @@ devredir_cvt_from_unicode_len(char *path, char *unicode, int len)
|
||||
bytes_to_alloc = (((len / 2) * sizeof(twchar)) + sizeof(twchar));
|
||||
|
||||
src = unicode;
|
||||
dest = g_malloc(bytes_to_alloc, 1);
|
||||
dest = g_new0(char, bytes_to_alloc);
|
||||
dest_saved = dest;
|
||||
|
||||
for (i = 0; i < len; i += 2)
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#define USE_SHORT_NAMES_IN_DIR_LISTING
|
||||
|
||||
void *devredir_fuse_data_peek(IRP *irp);
|
||||
void *devredir_fuse_data_dequeue(IRP *irp);
|
||||
FUSE_DATA *devredir_fuse_data_peek(IRP *irp);
|
||||
FUSE_DATA *devredir_fuse_data_dequeue(IRP *irp);
|
||||
int devredir_fuse_data_enqueue(IRP *irp, void *vp);
|
||||
|
||||
int APP_CC dev_redir_init(void);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "drdynvc.h"
|
||||
|
||||
int g_drdynvc_chan_id;
|
||||
extern int g_drdynvc_chan_id; /* in chansrv.c */
|
||||
int g_drdynvc_inited = 0;
|
||||
|
||||
static int APP_CC drdynvc_send_capability_request(uint16_t version);
|
||||
|
@ -77,7 +77,8 @@ IRP * devredir_irp_new()
|
||||
log_debug("entered");
|
||||
|
||||
/* create new IRP */
|
||||
if ((irp = g_malloc(sizeof(IRP), 1)) == NULL)
|
||||
irp = g_new0(IRP, 1);
|
||||
if (irp == NULL)
|
||||
{
|
||||
log_error("system out of memory!");
|
||||
return NULL;
|
||||
|
@ -184,7 +184,7 @@ rail_send_key_esc(int window_id)
|
||||
static struct rail_window_data* APP_CC
|
||||
rail_get_window_data(Window window)
|
||||
{
|
||||
int bytes;
|
||||
unsigned int bytes;
|
||||
Atom actual_type_return;
|
||||
int actual_format_return;
|
||||
unsigned long nitems_return;
|
||||
@ -238,7 +238,7 @@ rail_get_window_data_safe(Window window)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
rv = g_malloc(sizeof(struct rail_window_data), 1);
|
||||
rv = g_new0(struct rail_window_data, 1);
|
||||
rail_set_window_data(window, rv);
|
||||
g_free(rv);
|
||||
return rail_get_window_data(window);
|
||||
@ -557,7 +557,7 @@ my_timeout(void* data)
|
||||
static int APP_CC
|
||||
rail_process_activate(struct stream *s, int size)
|
||||
{
|
||||
int window_id;
|
||||
unsigned int window_id;
|
||||
int enabled;
|
||||
int index;
|
||||
XWindowAttributes window_attributes;
|
||||
@ -1148,8 +1148,8 @@ rail_data_in(struct stream *s, int chan_id, int chan_flags, int length,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int g_crc_seed = 0xffffffff;
|
||||
static int g_crc_table[256] =
|
||||
static const unsigned int g_crc_seed = 0xffffffff;
|
||||
static const unsigned int g_crc_table[256] =
|
||||
{
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
|
@ -900,7 +900,8 @@ scard_add_new_device(tui32 device_id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((sc = g_malloc(sizeof(SMARTCARD), 1)) == NULL)
|
||||
sc = g_new0(SMARTCARD, 1);
|
||||
if (sc == NULL)
|
||||
{
|
||||
log_error("system out of memory");
|
||||
return -1;
|
||||
@ -1255,7 +1256,7 @@ scard_send_GetStatusChange(IRP* irp, char *context, int context_bytes,
|
||||
struct stream *s;
|
||||
tui32 ioctl;
|
||||
int bytes;
|
||||
int i;
|
||||
unsigned int i;
|
||||
int num_chars;
|
||||
int index;
|
||||
twchar w_reader_name[100];
|
||||
|
@ -97,7 +97,7 @@ create_uds_client(struct trans *con)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
uds_client = g_malloc(sizeof(struct pcsc_uds_client), 1);
|
||||
uds_client = g_new0(struct pcsc_uds_client, 1);
|
||||
if (uds_client == 0)
|
||||
{
|
||||
return 0;
|
||||
@ -145,7 +145,7 @@ get_uds_client_by_id(int uds_client_id)
|
||||
/*****************************************************************************/
|
||||
struct pcsc_context *
|
||||
get_pcsc_context_by_app_context(struct pcsc_uds_client *uds_client,
|
||||
int app_context)
|
||||
tui32 app_context)
|
||||
{
|
||||
struct pcsc_context *rv;
|
||||
int index;
|
||||
@ -173,7 +173,7 @@ get_pcsc_context_by_app_context(struct pcsc_uds_client *uds_client,
|
||||
/*****************************************************************************/
|
||||
struct pcsc_card *
|
||||
get_pcsc_card_by_app_card(struct pcsc_uds_client *uds_client,
|
||||
int app_card, struct pcsc_context **acontext)
|
||||
tui32 app_card, struct pcsc_context **acontext)
|
||||
{
|
||||
struct pcsc_card *lcard;
|
||||
struct pcsc_context *lcontext;
|
||||
@ -606,7 +606,7 @@ scard_process_list_readers(struct trans *con, struct stream *in_s)
|
||||
g_free(groups);
|
||||
return 1;
|
||||
}
|
||||
pcscListReaders = g_malloc(sizeof(struct pcsc_list_readers), 1);
|
||||
pcscListReaders = g_new0(struct pcsc_list_readers, 1);
|
||||
pcscListReaders->uds_client_id = uds_client->uds_client_id;
|
||||
pcscListReaders->cchReaders = cchReaders;
|
||||
scard_send_list_readers(pcscListReaders, lcontext->context,
|
||||
|
@ -182,61 +182,6 @@ config_read_globals(int file, struct config_sesman *cf, struct list *param_n,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
int DEFAULT_CC
|
||||
config_read_logging(int file, struct log_config* lc, struct list* param_n,
|
||||
struct list* param_v)
|
||||
{
|
||||
int i;
|
||||
char* buf;
|
||||
|
||||
list_clear(param_v);
|
||||
list_clear(param_n);
|
||||
|
||||
// setting defaults
|
||||
lc->program_name = g_strdup("sesman");
|
||||
lc->log_file = 0;
|
||||
lc->fd = 0;
|
||||
lc->log_level = LOG_LEVEL_DEBUG;
|
||||
lc->enable_syslog = 0;
|
||||
lc->syslog_level = LOG_LEVEL_DEBUG;
|
||||
|
||||
file_read_section(file, SESMAN_CFG_LOGGING, param_n, param_v);
|
||||
for (i = 0; i < param_n->count; i++)
|
||||
{
|
||||
buf = (char*)list_get_item(param_n, i);
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_FILE))
|
||||
{
|
||||
lc->log_file = g_strdup((char*)list_get_item(param_v, i));
|
||||
}
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_LEVEL))
|
||||
{
|
||||
lc->log_level = log_text2level((char*)list_get_item(param_v, i));
|
||||
}
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_SYSLOG))
|
||||
{
|
||||
lc->enable_syslog = g_text2bool((char*)list_get_item(param_v, i));
|
||||
}
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_SYSLOG_LEVEL))
|
||||
{
|
||||
lc->syslog_level = log_text2level((char*)list_get_item(param_v, i));
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == lc->log_file)
|
||||
{
|
||||
lc->log_file=g_strdup("./sesman.log");
|
||||
}
|
||||
|
||||
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 0;
|
||||
}
|
||||
*/
|
||||
/******************************************************************************/
|
||||
int DEFAULT_CC
|
||||
config_read_security(int file, struct config_security *sc,
|
||||
@ -347,7 +292,7 @@ config_read_sessions(int file, struct config_sessions *se, struct list *param_n,
|
||||
{
|
||||
buf = (char *)list_get_item(param_n, i);
|
||||
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_X11DISPLAYOFFSET))
|
||||
if (0 == g_strcasecmp(buf, SESMAN_CFG_SESS_X11DISPLAYOFFSET))
|
||||
{
|
||||
se->x11_display_offset = g_atoi((char *)list_get_item(param_v, i));
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
#define SESMAN_CFG_PORT "ListenPort"
|
||||
#define SESMAN_CFG_ENABLE_USERWM "EnableUserWindowManager"
|
||||
#define SESMAN_CFG_USERWM "UserWindowManager"
|
||||
#define SESMAN_CFG_X11DISPLAYOFFSET "X11DisplayOffset"
|
||||
#define SESMAN_CFG_MAX_SESSION "MaxSessions"
|
||||
#define SESMAN_CFG_AUTH_FILE_PATH "AuthFilePath"
|
||||
|
||||
@ -66,6 +65,7 @@
|
||||
#define SESMAN_CFG_SESS_KILL_DISC "KillDisconnected"
|
||||
#define SESMAN_CFG_SESS_IDLE_LIMIT "IdleTimeLimit"
|
||||
#define SESMAN_CFG_SESS_DISC_LIMIT "DisconnectedTimeLimit"
|
||||
#define SESMAN_CFG_SESS_X11DISPLAYOFFSET "X11DisplayOffset"
|
||||
|
||||
#define SESMAN_CFG_SESS_POLICY_S "Policy"
|
||||
#define SESMAN_CFG_SESS_POLICY_DFLT_S "Default"
|
||||
|
@ -33,7 +33,7 @@ scp_connection_create(int sck)
|
||||
{
|
||||
struct SCP_CONNECTION *conn;
|
||||
|
||||
conn = g_malloc(sizeof(struct SCP_CONNECTION), 0);
|
||||
conn = g_new(struct SCP_CONNECTION, 1);
|
||||
|
||||
if (0 == conn)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ scp_init()
|
||||
|
||||
scp_lock_init();
|
||||
|
||||
log_message(LOG_LEVEL_WARNING, "[init:%d] libscp initialized", __LINE__);
|
||||
log_message(LOG_LEVEL_DEBUG, "libscp initialized");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ scp_session_set_rsr(struct SCP_SESSION *s, tui8 rsr)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_locale(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_locale(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -180,7 +180,7 @@ scp_session_set_locale(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_username(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_username(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -206,7 +206,7 @@ scp_session_set_username(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_password(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_password(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -232,7 +232,7 @@ scp_session_set_password(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_domain(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_domain(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -258,7 +258,7 @@ scp_session_set_domain(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_program(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_program(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -284,7 +284,7 @@ scp_session_set_program(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_directory(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_directory(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -310,7 +310,7 @@ scp_session_set_directory(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_client_ip(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_client_ip(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -336,7 +336,7 @@ scp_session_set_client_ip(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_hostname(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_hostname(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -362,7 +362,7 @@ scp_session_set_hostname(struct SCP_SESSION *s, char *str)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_errstr(struct SCP_SESSION *s, char *str)
|
||||
scp_session_set_errstr(struct SCP_SESSION *s, const char *str)
|
||||
{
|
||||
if (0 == str)
|
||||
{
|
||||
@ -396,49 +396,15 @@ scp_session_set_display(struct SCP_SESSION *s, SCP_DISPLAY display)
|
||||
|
||||
/*******************************************************************/
|
||||
int
|
||||
scp_session_set_addr(struct SCP_SESSION *s, int type, void *addr)
|
||||
scp_session_set_addr(struct SCP_SESSION *s, int type, const void *addr)
|
||||
{
|
||||
struct in_addr ip4;
|
||||
#ifdef IN6ADDR_ANY_INIT
|
||||
struct in6_addr ip6;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case SCP_ADDRESS_TYPE_IPV4:
|
||||
/* convert from char to 32bit*/
|
||||
ret = inet_pton(AF_INET, addr, &ip4);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[session:%d] set_addr: invalid address", __LINE__);
|
||||
inet_pton(AF_INET, "127.0.0.1", &ip4);
|
||||
g_memcpy(&(s->ipv4addr), &(ip4.s_addr), 4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_memcpy(&(s->ipv4addr), &(ip4.s_addr), 4);
|
||||
break;
|
||||
case SCP_ADDRESS_TYPE_IPV4_BIN:
|
||||
g_memcpy(&(s->ipv4addr), addr, 4);
|
||||
break;
|
||||
#ifdef IN6ADDR_ANY_INIT
|
||||
case SCP_ADDRESS_TYPE_IPV6:
|
||||
/* convert from char to 128bit*/
|
||||
ret = inet_pton(AF_INET6, addr, &ip6);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
log_message(LOG_LEVEL_WARNING, "[session:%d] set_addr: invalid address", __LINE__);
|
||||
inet_pton(AF_INET, "::1", &ip6);
|
||||
g_memcpy(s->ipv6addr, &(ip6.s6_addr), 16);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_memcpy(s->ipv6addr, &(ip6.s6_addr), 16);
|
||||
break;
|
||||
case SCP_ADDRESS_TYPE_IPV6_BIN:
|
||||
g_memcpy(s->ipv6addr, addr, 16);
|
||||
break;
|
||||
#endif
|
||||
|
@ -59,37 +59,37 @@ int
|
||||
scp_session_set_rsr(struct SCP_SESSION* s, tui8 rsr);
|
||||
|
||||
int
|
||||
scp_session_set_locale(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_locale(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_username(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_username(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_password(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_password(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_domain(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_domain(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_program(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_program(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_directory(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_directory(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_client_ip(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_client_ip(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_hostname(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_hostname(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
int
|
||||
scp_session_set_addr(struct SCP_SESSION* s, int type, void* addr);
|
||||
scp_session_set_addr(struct SCP_SESSION* s, int type, const void* addr);
|
||||
|
||||
int
|
||||
scp_session_set_display(struct SCP_SESSION* s, SCP_DISPLAY display);
|
||||
|
||||
int
|
||||
scp_session_set_errstr(struct SCP_SESSION* s, char* str);
|
||||
scp_session_set_errstr(struct SCP_SESSION* s, const char *str);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,10 +51,6 @@
|
||||
#define SCP_ADDRESS_TYPE_IPV4 0x00
|
||||
#define SCP_ADDRESS_TYPE_IPV6 0x01
|
||||
|
||||
/* used in scp_session_set_addr() */
|
||||
#define SCP_ADDRESS_TYPE_IPV4_BIN 0x80
|
||||
#define SCP_ADDRESS_TYPE_IPV6_BIN 0x81
|
||||
|
||||
#define SCP_COMMAND_SET_DEFAULT 0x0000
|
||||
#define SCP_COMMAND_SET_MANAGE 0x0001
|
||||
#define SCP_COMMAND_SET_RSR 0x0002
|
||||
|
@ -224,7 +224,7 @@ scp_v1c_get_session_list(struct SCP_CONNECTION *c, int *scount,
|
||||
in_uint32_be(c->in_s, sescnt);
|
||||
sestmp = sescnt;
|
||||
|
||||
ds = g_malloc(sizeof(struct SCP_DISCONNECTED_SESSION) * sescnt, 0);
|
||||
ds = g_new(struct SCP_DISCONNECTED_SESSION, sescnt);
|
||||
|
||||
if (ds == 0)
|
||||
{
|
||||
@ -429,7 +429,7 @@ _scp_v1c_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
g_free(s->errstr);
|
||||
}
|
||||
|
||||
s->errstr = g_malloc(dim + 1, 0);
|
||||
s->errstr = g_new(char, dim + 1);
|
||||
|
||||
if (s->errstr == 0)
|
||||
{
|
||||
@ -450,7 +450,7 @@ _scp_v1c_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
g_free(s->errstr);
|
||||
}
|
||||
|
||||
s->errstr = g_malloc(dim + 1, 0);
|
||||
s->errstr = g_new(char, dim + 1);
|
||||
|
||||
if (s->errstr == 0)
|
||||
{
|
||||
@ -471,7 +471,7 @@ _scp_v1c_check_response(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
g_free(s->errstr);
|
||||
}
|
||||
|
||||
s->errstr = g_malloc(dim + 1, 0);
|
||||
s->errstr = g_new(char, dim + 1);
|
||||
|
||||
if (s->errstr == 0)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ scp_v1c_mng_get_session_list(struct SCP_CONNECTION *c, int *scount,
|
||||
return SCP_CLIENT_STATE_LIST_OK;
|
||||
}
|
||||
|
||||
ds = g_malloc(sizeof(struct SCP_DISCONNECTED_SESSION) * sescnt, 0);
|
||||
ds = g_new(struct SCP_DISCONNECTED_SESSION, sescnt);
|
||||
|
||||
if (ds == 0)
|
||||
{
|
||||
|
@ -150,12 +150,12 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
|
||||
if (sz == SCP_ADDRESS_TYPE_IPV4)
|
||||
{
|
||||
in_uint32_be(c->in_s, size);
|
||||
scp_session_set_addr(session, SCP_ADDRESS_TYPE_IPV4_BIN, &size);
|
||||
scp_session_set_addr(session, sz, &size);
|
||||
}
|
||||
else if (sz == SCP_ADDRESS_TYPE_IPV6)
|
||||
{
|
||||
in_uint8a(c->in_s, buf, 16);
|
||||
scp_session_set_addr(session, SCP_ADDRESS_TYPE_IPV6_BIN, buf);
|
||||
scp_session_set_addr(session, sz, buf);
|
||||
}
|
||||
|
||||
buf[256] = '\0';
|
||||
@ -202,7 +202,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION *c, struct SCP_SES
|
||||
}
|
||||
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_deny_connection(struct SCP_CONNECTION *c, char *reason)
|
||||
scp_v1s_deny_connection(struct SCP_CONNECTION *c, const char *reason)
|
||||
{
|
||||
int rlen;
|
||||
|
||||
@ -235,7 +235,8 @@ scp_v1s_deny_connection(struct SCP_CONNECTION *c, char *reason)
|
||||
}
|
||||
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s, char *reason)
|
||||
scp_v1s_request_password(struct SCP_CONNECTION *c, struct SCP_SESSION *s,
|
||||
const char *reason)
|
||||
{
|
||||
tui8 sz;
|
||||
tui32 version;
|
||||
@ -392,7 +393,7 @@ scp_v1s_connect_new_session(struct SCP_CONNECTION *c, SCP_DISPLAY d)
|
||||
|
||||
/* 032 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_connection_error(struct SCP_CONNECTION *c, char *error)
|
||||
scp_v1s_connection_error(struct SCP_CONNECTION *c, const char *error)
|
||||
{
|
||||
tui16 len;
|
||||
|
||||
|
@ -53,10 +53,11 @@ scp_v1s_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s, int skipVchk);
|
||||
*/
|
||||
/* 002 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_deny_connection(struct SCP_CONNECTION* c, char* reason);
|
||||
scp_v1s_deny_connection(struct SCP_CONNECTION* c, const char *reason);
|
||||
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_request_password(struct SCP_CONNECTION* c, struct SCP_SESSION* s, char* reason);
|
||||
scp_v1s_request_password(struct SCP_CONNECTION* c, struct SCP_SESSION* s,
|
||||
const char *reason);
|
||||
|
||||
/* 020 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
@ -72,7 +73,7 @@ scp_v1s_connect_new_session(struct SCP_CONNECTION* c, SCP_DISPLAY d);
|
||||
|
||||
/* 032 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_connection_error(struct SCP_CONNECTION* c, char* error);
|
||||
scp_v1s_connection_error(struct SCP_CONNECTION* c, const char *error);
|
||||
|
||||
/* 040 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
|
@ -90,12 +90,12 @@ scp_v1s_mng_accept(struct SCP_CONNECTION *c, struct SCP_SESSION **s)
|
||||
if (sz == SCP_ADDRESS_TYPE_IPV4)
|
||||
{
|
||||
in_uint32_be(c->in_s, ipaddr);
|
||||
scp_session_set_addr(session, SCP_ADDRESS_TYPE_IPV4_BIN, &ipaddr);
|
||||
scp_session_set_addr(session, sz, &ipaddr);
|
||||
}
|
||||
else if (sz == SCP_ADDRESS_TYPE_IPV6)
|
||||
{
|
||||
in_uint8a(c->in_s, buf, 16);
|
||||
scp_session_set_addr(session, SCP_ADDRESS_TYPE_IPV6_BIN, buf);
|
||||
scp_session_set_addr(session, sz, buf);
|
||||
}
|
||||
|
||||
/* reading hostname */
|
||||
@ -138,7 +138,7 @@ scp_v1s_mng_allow_connection(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
|
||||
/* 003 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_mng_deny_connection(struct SCP_CONNECTION *c, char *reason)
|
||||
scp_v1s_mng_deny_connection(struct SCP_CONNECTION *c, const char *reason)
|
||||
{
|
||||
int rlen;
|
||||
|
||||
|
@ -61,7 +61,7 @@ scp_v1s_mng_allow_connection(struct SCP_CONNECTION* c, struct SCP_SESSION* s);
|
||||
*/
|
||||
/* 003 */
|
||||
enum SCP_SERVER_STATES_E
|
||||
scp_v1s_mng_deny_connection(struct SCP_CONNECTION* c, char* reason);
|
||||
scp_v1s_mng_deny_connection(struct SCP_CONNECTION* c, const char *reason);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
extern struct config_sesman *g_cfg; /* in sesman.c */
|
||||
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f);
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f);
|
||||
|
||||
/******************************************************************************/
|
||||
void DEFAULT_CC
|
||||
@ -209,7 +209,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
g_free(slist);
|
||||
}
|
||||
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f)
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f)
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
extern struct config_sesman *g_cfg; /* in sesman.c */
|
||||
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f);
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f);
|
||||
|
||||
/******************************************************************************/
|
||||
void DEFAULT_CC
|
||||
@ -109,7 +109,7 @@ scp_v1_mng_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
|
||||
auth_end(data);
|
||||
}
|
||||
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char *f)
|
||||
static void parseCommonStates(enum SCP_SERVER_STATES_E e, const char *f)
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
|
@ -49,9 +49,6 @@ sesman_main_loop(void)
|
||||
tbus sck_obj;
|
||||
tbus robjs[8];
|
||||
|
||||
/*main program loop*/
|
||||
log_message(LOG_LEVEL_INFO, "listening...");
|
||||
|
||||
g_sck = g_tcp_socket();
|
||||
if (g_sck < 0)
|
||||
{
|
||||
@ -68,6 +65,8 @@ sesman_main_loop(void)
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
log_message(LOG_LEVEL_INFO, "listening to port %s on %s",
|
||||
g_cfg->listen_port, g_cfg->listen_address);
|
||||
sck_obj = g_create_wait_obj_from_socket(g_sck, 0);
|
||||
cont = 1;
|
||||
|
||||
@ -248,7 +247,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* reading config */
|
||||
g_cfg = g_malloc(sizeof(struct config_sesman), 1);
|
||||
g_cfg = g_new0(struct config_sesman, 1);
|
||||
|
||||
if (0 == g_cfg)
|
||||
{
|
||||
@ -359,8 +358,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* start program main loop */
|
||||
log_message(LOG_LEVEL_ALWAYS,
|
||||
"starting sesman with pid %d", g_pid);
|
||||
log_message(LOG_LEVEL_INFO,
|
||||
"starting xrdp-sesman with pid %d", g_pid);
|
||||
|
||||
/* make sure the /tmp/.X11-unix directory exist */
|
||||
if (!g_directory_exist("/tmp/.X11-unix"))
|
||||
|
@ -89,7 +89,9 @@ session_get_bydata(char *name, int width, int height, int bpp, int type, char *c
|
||||
{
|
||||
case SCP_SESSION_TYPE_XVNC: /* 0 */
|
||||
type = SESMAN_SESSION_TYPE_XVNC; /* 2 */
|
||||
policy |= SESMAN_CFG_SESS_POLICY_D; /* Xvnc cannot resize */
|
||||
/* Xvnc cannot resize */
|
||||
policy = (enum SESMAN_CFG_SESS_POLICY)
|
||||
(policy | SESMAN_CFG_SESS_POLICY_D);
|
||||
break;
|
||||
case SCP_SESSION_TYPE_XRDP: /* 1 */
|
||||
type = SESMAN_SESSION_TYPE_XRDP; /* 1 */
|
||||
@ -978,11 +980,11 @@ session_get_bypid(int pid)
|
||||
struct session_chain *tmp;
|
||||
struct session_item *dummy;
|
||||
|
||||
dummy = g_malloc(sizeof(struct session_item), 1);
|
||||
dummy = g_new0(struct session_item, 1);
|
||||
|
||||
if (0 == dummy)
|
||||
{
|
||||
log_message(LOG_LEVEL_ERROR, "internal error", pid);
|
||||
log_message(LOG_LEVEL_ERROR, "session_get_bypid: out of memory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1052,7 +1054,7 @@ session_get_byuser(char *user, int *cnt, unsigned char flags)
|
||||
}
|
||||
|
||||
/* malloc() an array of disconnected sessions */
|
||||
sess = g_malloc(count *sizeof(struct SCP_DISCONNECTED_SESSION), 1);
|
||||
sess = g_new0(struct SCP_DISCONNECTED_SESSION, count);
|
||||
|
||||
if (sess == 0)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ nil_signal_handler(int sig)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* chansrv can exit at any time without cleaning up, its an xlib app */
|
||||
/* chansrv can exit at any time without cleaning up, it's an xlib app */
|
||||
int APP_CC
|
||||
chansrv_cleanup(int pid)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ sig_sesman_reload_cfg(int sig)
|
||||
return;
|
||||
}
|
||||
|
||||
cfg = g_malloc(sizeof(struct config_sesman), 1);
|
||||
cfg = g_new0(struct config_sesman, 1);
|
||||
|
||||
if (0 == cfg)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ int main(int argc, char **argv)
|
||||
serv[0] = '\0';
|
||||
port[0] = '\0';
|
||||
|
||||
logging.program_name = g_strdup("sesadmin");
|
||||
logging.program_name = "sesadmin";
|
||||
logging.log_file = g_strdup("xrdp-sesadmin.log");
|
||||
logging.log_level = LOG_LEVEL_DEBUG;
|
||||
logging.enable_syslog = 0;
|
||||
@ -124,7 +124,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
scp_init(&logging);
|
||||
scp_init();
|
||||
|
||||
sock = g_tcp_socket();
|
||||
if (sock < 0)
|
||||
|
@ -44,11 +44,11 @@ int main(int argc, char **argv)
|
||||
int sock;
|
||||
|
||||
log.enable_syslog = 0;
|
||||
log.log_level = 99;
|
||||
log.program_name = g_strdup("sestest");
|
||||
log.log_level = LOG_LEVEL_DEBUG;
|
||||
log.program_name = "sestest";
|
||||
log.log_file = g_strdup("sestest.log");
|
||||
log_start_from_param(&log);
|
||||
scp_init(&log);
|
||||
scp_init();
|
||||
|
||||
sock = g_tcp_socket();
|
||||
if (sock < 0)
|
||||
|
@ -54,19 +54,19 @@ verify_pam_conv(int num_msg, const struct pam_message **msg,
|
||||
struct pam_response *reply;
|
||||
struct t_user_pass *user_pass;
|
||||
|
||||
reply = g_malloc(sizeof(struct pam_response) * num_msg, 1);
|
||||
reply = g_new0(struct pam_response, num_msg);
|
||||
|
||||
for (i = 0; i < num_msg; i++)
|
||||
{
|
||||
switch (msg[i]->msg_style)
|
||||
{
|
||||
case PAM_PROMPT_ECHO_ON: /* username */
|
||||
user_pass = appdata_ptr;
|
||||
user_pass = (struct t_user_pass *) appdata_ptr;
|
||||
reply[i].resp = g_strdup(user_pass->user);
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
break;
|
||||
case PAM_PROMPT_ECHO_OFF: /* password */
|
||||
user_pass = appdata_ptr;
|
||||
user_pass = (struct t_user_pass *) appdata_ptr;
|
||||
reply[i].resp = g_strdup(user_pass->pass);
|
||||
reply[i].resp_retcode = PAM_SUCCESS;
|
||||
break;
|
||||
@ -109,7 +109,7 @@ auth_userpass(char *user, char *pass, int *errorcode)
|
||||
char service_name[256];
|
||||
|
||||
get_service_name(service_name);
|
||||
auth_info = g_malloc(sizeof(struct t_auth_info), 1);
|
||||
auth_info = g_new0(struct t_auth_info, 1);
|
||||
g_strncpy(auth_info->user_pass.user, user, 255);
|
||||
g_strncpy(auth_info->user_pass.pass, pass, 255);
|
||||
auth_info->pamc.conv = &verify_pam_conv;
|
||||
|
@ -33,7 +33,7 @@ int tcp_socket_create(void)
|
||||
unsigned int option_len;
|
||||
#endif
|
||||
|
||||
/* in win32 a socket is an unsigned int, in linux, its an int */
|
||||
/* in win32 a socket is an unsigned int, in linux, it's an int */
|
||||
if ((rv = (int) socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
@ -193,7 +193,7 @@ int tcp_socket(void)
|
||||
unsigned int option_len;
|
||||
#endif
|
||||
|
||||
/* in win32 a socket is an unsigned int, in linux, its an int */
|
||||
/* in win32 a socket is an unsigned int, in linux, it's an int */
|
||||
if ((rv = (int) socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
|
15
vnc/vnc.c
15
vnc/vnc.c
@ -233,7 +233,7 @@ lib_process_channel_data(struct vnc *v, int chanid, int flags, int size,
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message(LOG_LEVEL_DEBUG, "lib_process_channel_data: unknown chanid:",
|
||||
log_message(LOG_LEVEL_DEBUG, "lib_process_channel_data: unknown chanid: "
|
||||
"%d :(v->clip_chanid) %d", chanid, v->clip_chanid);
|
||||
}
|
||||
|
||||
@ -587,7 +587,7 @@ lib_framebuffer_update(struct vnc *v)
|
||||
int cy;
|
||||
int srcx;
|
||||
int srcy;
|
||||
int encoding;
|
||||
unsigned int encoding;
|
||||
int Bpp;
|
||||
int pixel;
|
||||
int r;
|
||||
@ -1396,7 +1396,7 @@ lib_mod_end(struct vnc *v)
|
||||
|
||||
/******************************************************************************/
|
||||
int DEFAULT_CC
|
||||
lib_mod_set_param(struct vnc *v, char *name, char *value)
|
||||
lib_mod_set_param(struct vnc *v, const char *name, char *value)
|
||||
{
|
||||
if (g_strcasecmp(name, "username") == 0)
|
||||
{
|
||||
@ -1465,7 +1465,7 @@ lib_mod_check_wait_objs(struct vnc *v)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct vnc *EXPORT_CC
|
||||
tintptr EXPORT_CC
|
||||
mod_init(void)
|
||||
{
|
||||
struct vnc *v;
|
||||
@ -1474,7 +1474,7 @@ mod_init(void)
|
||||
/* set client functions */
|
||||
v->size = sizeof(struct vnc);
|
||||
v->version = CURRENT_MOD_VER;
|
||||
v->handle = (long)v;
|
||||
v->handle = (tintptr) v;
|
||||
v->mod_connect = lib_mod_connect;
|
||||
v->mod_start = lib_mod_start;
|
||||
v->mod_event = lib_mod_event;
|
||||
@ -1483,13 +1483,14 @@ mod_init(void)
|
||||
v->mod_set_param = lib_mod_set_param;
|
||||
v->mod_get_wait_objs = lib_mod_get_wait_objs;
|
||||
v->mod_check_wait_objs = lib_mod_check_wait_objs;
|
||||
return v;
|
||||
return (tintptr) v;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int EXPORT_CC
|
||||
mod_exit(struct vnc *v)
|
||||
mod_exit(tintptr handle)
|
||||
{
|
||||
struct vnc *v = (struct vnc *) handle;
|
||||
log_message(LOG_LEVEL_DEBUG, "VNC mod_exit");
|
||||
|
||||
if (v == 0)
|
||||
|
@ -37,7 +37,7 @@ struct vnc
|
||||
long param3, long param4);
|
||||
int (*mod_signal)(struct vnc* v);
|
||||
int (*mod_end)(struct vnc* v);
|
||||
int (*mod_set_param)(struct vnc* v, char* name, char* value);
|
||||
int (*mod_set_param)(struct vnc* v, const char *name, char* value);
|
||||
int (*mod_session_change)(struct vnc* v, int, int);
|
||||
int (*mod_get_wait_objs)(struct vnc* v, tbus* read_objs, int* rcount,
|
||||
tbus* write_objs, int* wcount, int* timeout);
|
||||
@ -54,7 +54,7 @@ struct vnc
|
||||
char* data, int width, int height, int srcx, int srcy);
|
||||
int (*server_set_cursor)(struct vnc* v, int x, int y, char* data, char* mask);
|
||||
int (*server_palette)(struct vnc* v, int* palette);
|
||||
int (*server_msg)(struct vnc* v, char* msg, int code);
|
||||
int (*server_msg)(struct vnc* v, const char *msg, int code);
|
||||
int (*server_is_term)(struct vnc* v);
|
||||
int (*server_set_clip)(struct vnc* v, int x, int y, int cx, int cy);
|
||||
int (*server_reset_clip)(struct vnc* v);
|
||||
@ -80,7 +80,7 @@ struct vnc
|
||||
int (*server_query_channel)(struct vnc* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct vnc* v, char* name);
|
||||
int (*server_get_channel_id)(struct vnc* v, const char *name);
|
||||
int (*server_send_to_channel)(struct vnc* v, int channel_id,
|
||||
char* data, int data_len,
|
||||
int total_data_len, int flags);
|
||||
|
@ -27,7 +27,7 @@ keyboard and mouse stuff
|
||||
num lock */
|
||||
/* this should be fixed in rdesktop */
|
||||
/* g_pause_spe flag for special control sent by ms client before scan code
|
||||
69 is sent to tell that its pause, not num lock. both pause and num
|
||||
69 is sent to tell that it's pause, not num lock. both pause and num
|
||||
lock use scan code 69 */
|
||||
|
||||
/* tab notes */
|
||||
|
@ -443,8 +443,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_writeln("problem opening to xrdp.pid [%s]", pid_file);
|
||||
g_writeln("maybe its not running");
|
||||
g_writeln("cannot open %s, maybe xrdp is not running", pid_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -598,6 +597,7 @@ main(int argc, char **argv)
|
||||
g_sync_mutex = tc_mutex_create();
|
||||
g_sync1_mutex = tc_mutex_create();
|
||||
pid = g_getpid();
|
||||
log_message(LOG_LEVEL_INFO, "starting xrdp with pid %d", pid);
|
||||
g_snprintf(text, 255, "xrdp_%8.8x_main_term", pid);
|
||||
g_term_event = g_create_wait_obj(text);
|
||||
|
||||
|
10
xrdp/xrdp.h
10
xrdp/xrdp.h
@ -37,6 +37,7 @@
|
||||
#include "file.h"
|
||||
#include "file_loc.h"
|
||||
#include "xrdp_client_info.h"
|
||||
#include "log.h"
|
||||
|
||||
/* xrdp.c */
|
||||
long APP_CC
|
||||
@ -140,7 +141,8 @@ xrdp_wm_delete_all_children(struct xrdp_wm* self);
|
||||
int APP_CC
|
||||
xrdp_wm_show_log(struct xrdp_wm *self);
|
||||
int APP_CC
|
||||
xrdp_wm_log_msg(struct xrdp_wm* self, char* msg);
|
||||
xrdp_wm_log_msg(struct xrdp_wm *self, enum logLevels loglevel,
|
||||
const char *fmt, ...) printflike(3, 4);
|
||||
int APP_CC
|
||||
xrdp_wm_get_wait_objs(struct xrdp_wm* self, tbus* robjs, int* rc,
|
||||
tbus* wobjs, int* wc, int* timeout);
|
||||
@ -264,9 +266,9 @@ xrdp_painter_draw_bitmap(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* to_draw,
|
||||
int x, int y, int cx, int cy);
|
||||
int APP_CC
|
||||
xrdp_painter_text_width(struct xrdp_painter* self, char* text);
|
||||
xrdp_painter_text_width(struct xrdp_painter* self, const char *text);
|
||||
int APP_CC
|
||||
xrdp_painter_text_height(struct xrdp_painter* self, char* text);
|
||||
xrdp_painter_text_height(struct xrdp_painter* self, const char *text);
|
||||
int APP_CC
|
||||
xrdp_painter_draw_text(struct xrdp_painter* self,
|
||||
struct xrdp_bitmap* bitmap,
|
||||
@ -464,7 +466,7 @@ int DEFAULT_CC
|
||||
server_query_channel(struct xrdp_mod* mod, int index, char* channel_name,
|
||||
int* channel_flags);
|
||||
int DEFAULT_CC
|
||||
server_get_channel_id(struct xrdp_mod* mod, char* name);
|
||||
server_get_channel_id(struct xrdp_mod* mod, const char *name);
|
||||
int DEFAULT_CC
|
||||
server_send_to_channel(struct xrdp_mod* mod, int channel_id,
|
||||
char* data, int data_len,
|
||||
|
@ -38,7 +38,7 @@
|
||||
while (0)
|
||||
|
||||
|
||||
static const int g_crc_table[256] =
|
||||
static const unsigned int g_crc_table[256] =
|
||||
{
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
|
@ -167,7 +167,7 @@ xrdp_encoder_delete(struct xrdp_encoder *self)
|
||||
{
|
||||
while (!fifo_is_empty(fifo))
|
||||
{
|
||||
enc = fifo_remove_item(fifo);
|
||||
enc = (XRDP_ENC_DATA *) fifo_remove_item(fifo);
|
||||
if (enc == 0)
|
||||
{
|
||||
continue;
|
||||
@ -185,7 +185,7 @@ xrdp_encoder_delete(struct xrdp_encoder *self)
|
||||
{
|
||||
while (!fifo_is_empty(fifo))
|
||||
{
|
||||
enc_done = fifo_remove_item(fifo);
|
||||
enc_done = (XRDP_ENC_DATA_DONE *) fifo_remove_item(fifo);
|
||||
if (enc_done == 0)
|
||||
{
|
||||
continue;
|
||||
|
@ -370,6 +370,8 @@ xrdp_listen_main_loop(struct xrdp_listen *self)
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
log_message(LOG_LEVEL_INFO, "listening to port %s on %s",
|
||||
port, address);
|
||||
if (tcp_nodelay)
|
||||
{
|
||||
if (g_tcp_set_no_delay(self->listen_trans->sck))
|
||||
|
@ -273,7 +273,6 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax,
|
||||
int pos;
|
||||
int comboxindex;
|
||||
char index[2];
|
||||
char debugstr[256];
|
||||
|
||||
/* If the first char in the domain name is '_' we use the domain
|
||||
name as IP*/
|
||||
@ -300,11 +299,9 @@ xrdp_wm_parse_domain_information(char *originalDomainInfo, int comboMax,
|
||||
/* we just accept values 0-9 (one figure) */
|
||||
g_strncpy(index, &originalDomainInfo[pos + 3], 1);
|
||||
comboxindex = g_htoi(index);
|
||||
g_snprintf(debugstr, 255, "Value of index (as char): %s "
|
||||
"(converted) : %d (max) : %d", index, comboxindex,
|
||||
comboMax - 1);
|
||||
debugstr[255] = 0;
|
||||
log_message(LOG_LEVEL_DEBUG, debugstr);
|
||||
log_message(LOG_LEVEL_DEBUG,
|
||||
"index value as string: %s, as int: %d, max: %d",
|
||||
index, comboxindex, comboMax - 1);
|
||||
/* limit to max number of items in combo box */
|
||||
if ((comboxindex > 0) && (comboxindex < comboMax))
|
||||
{
|
||||
|
109
xrdp/xrdp_mm.c
109
xrdp/xrdp_mm.c
@ -176,8 +176,8 @@ xrdp_mm_send_login(struct xrdp_mm *self)
|
||||
char *name;
|
||||
char *value;
|
||||
|
||||
xrdp_wm_log_msg(self->wm, "sending login info to session manager, "
|
||||
"please wait...");
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_DEBUG,
|
||||
"sending login info to session manager, please wait...");
|
||||
username = 0;
|
||||
password = 0;
|
||||
self->code = 0;
|
||||
@ -210,7 +210,8 @@ xrdp_mm_send_login(struct xrdp_mm *self)
|
||||
|
||||
if ((username == 0) || (password == 0))
|
||||
{
|
||||
xrdp_wm_log_msg(self->wm, "Error finding username and password");
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"Error finding username and password");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -277,7 +278,8 @@ xrdp_mm_send_login(struct xrdp_mm *self)
|
||||
|
||||
if (rv != 0)
|
||||
{
|
||||
xrdp_wm_log_msg(self->wm, "xrdp_mm_send_login: xrdp_mm_send_login failed");
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_WARNING,
|
||||
"xrdp_mm_send_login: xrdp_mm_send_login failed");
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -289,7 +291,8 @@ xrdp_mm_send_login(struct xrdp_mm *self)
|
||||
then it copies the corresponding login_values item into 'dest'
|
||||
'dest' must be at least 'dest_len' + 1 bytes in size */
|
||||
static int APP_CC
|
||||
xrdp_mm_get_value(struct xrdp_mm *self, char *aname, char *dest, int dest_len)
|
||||
xrdp_mm_get_value(struct xrdp_mm *self, const char *aname, char *dest,
|
||||
int dest_len)
|
||||
{
|
||||
char *name;
|
||||
char *value;
|
||||
@ -339,18 +342,18 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
|
||||
|
||||
if (xrdp_mm_get_value(self, "lib", lib, 255) != 0)
|
||||
{
|
||||
g_snprintf(text, 255, "no library name specified in xrdp.ini, please add "
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"no library name specified in xrdp.ini, please add "
|
||||
"lib=libxrdp-vnc.so or similar");
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lib[0] == 0)
|
||||
{
|
||||
g_snprintf(text, 255, "empty library name specified in xrdp.ini, please "
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"empty library name specified in xrdp.ini, please "
|
||||
"add lib=libxrdp-vnc.so or similar");
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -372,10 +375,9 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
|
||||
|
||||
if (func == 0)
|
||||
{
|
||||
g_snprintf(text, 255, "error finding proc mod_init in %s, not a valid "
|
||||
"xrdp backend", lib);
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
log_message(LOG_LEVEL_ERROR,text);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"error finding proc mod_init in %s, "
|
||||
"not a valid xrdp backend", lib);
|
||||
}
|
||||
|
||||
self->mod_init = (struct xrdp_mod * ( *)(void))func;
|
||||
@ -388,10 +390,9 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
|
||||
|
||||
if (func == 0)
|
||||
{
|
||||
g_snprintf(text, 255, "error finding proc mod_exit in %s, not a valid "
|
||||
"xrdp backend", lib);
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
log_message(LOG_LEVEL_ERROR,text);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"error finding proc mod_exit in %s, "
|
||||
"not a valid xrdp backend", lib);
|
||||
}
|
||||
|
||||
self->mod_exit = (int ( *)(struct xrdp_mod *))func;
|
||||
@ -413,10 +414,10 @@ xrdp_mm_setup_mod1(struct xrdp_mm *self)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf(text, 255, "error loading %s specified in xrdp.ini, please "
|
||||
"add a valid entry like lib=libxrdp-vnc.so or similar", lib);
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
log_message(LOG_LEVEL_ERROR,text);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"error loading %s specified in xrdp.ini, please "
|
||||
"add a valid entry like lib=libxrdp-vnc.so or "
|
||||
"similar", lib);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -763,7 +764,7 @@ xrdp_mm_process_rail_create_window(struct xrdp_mm* self, struct stream* s)
|
||||
in_uint16_le(s, title_bytes);
|
||||
if (title_bytes > 0)
|
||||
{
|
||||
rwso.title_info = g_malloc(title_bytes + 1, 0);
|
||||
rwso.title_info = g_new(char, title_bytes + 1);
|
||||
in_uint8a(s, rwso.title_info, title_bytes);
|
||||
rwso.title_info[title_bytes] = 0;
|
||||
}
|
||||
@ -946,7 +947,7 @@ xrdp_mm_process_rail_update_window_text(struct xrdp_mm* self, struct stream* s)
|
||||
|
||||
g_memset(&rwso, 0, sizeof(rwso));
|
||||
in_uint32_le(s, size); /* title size */
|
||||
rwso.title_info = g_malloc(size + 1, 0);
|
||||
rwso.title_info = g_new(char, size + 1);
|
||||
in_uint8a(s, rwso.title_info, size);
|
||||
rwso.title_info[size] = 0;
|
||||
g_writeln(" set window title %s size %d 0x%8.8x", rwso.title_info, size, flags);
|
||||
@ -1111,7 +1112,7 @@ xrdp_mm_chan_send_init(struct xrdp_mm *self)
|
||||
/*****************************************************************************/
|
||||
/* connect to chansrv */
|
||||
static int APP_CC
|
||||
xrdp_mm_connect_chansrv(struct xrdp_mm *self, char *ip, char *port)
|
||||
xrdp_mm_connect_chansrv(struct xrdp_mm *self, const char *ip, const char *port)
|
||||
{
|
||||
int index;
|
||||
|
||||
@ -1192,7 +1193,6 @@ xrdp_mm_process_login_response(struct xrdp_mm *self, struct stream *s)
|
||||
int ok;
|
||||
int display;
|
||||
int rv;
|
||||
char text[256];
|
||||
char ip[256];
|
||||
char port[256];
|
||||
|
||||
@ -1203,9 +1203,8 @@ xrdp_mm_process_login_response(struct xrdp_mm *self, struct stream *s)
|
||||
if (ok)
|
||||
{
|
||||
self->display = display;
|
||||
g_snprintf(text, 255, "xrdp_mm_process_login_response: login successful "
|
||||
"for display %d", display);
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO,
|
||||
"login successful for display %d", display);
|
||||
|
||||
if (xrdp_mm_setup_mod1(self) == 0)
|
||||
{
|
||||
@ -1231,10 +1230,8 @@ xrdp_mm_process_login_response(struct xrdp_mm *self, struct stream *s)
|
||||
}
|
||||
else
|
||||
{
|
||||
xrdp_wm_log_msg(self->wm, "xrdp_mm_process_login_response: "
|
||||
"login failed");
|
||||
log_message(LOG_LEVEL_INFO,"xrdp_mm_process_login_response: "
|
||||
"login failed");
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO,
|
||||
"login failed for display %d", display);
|
||||
xrdp_wm_show_log(self->wm);
|
||||
if (self->wm->hide_log_window)
|
||||
{
|
||||
@ -1398,8 +1395,9 @@ xrdp_mm_sesman_data_in(struct trans *trans)
|
||||
error = xrdp_mm_process_login_response(self, s);
|
||||
break;
|
||||
default:
|
||||
xrdp_wm_log_msg(self->wm, "An undefined reply code was received from sesman");
|
||||
log_message(LOG_LEVEL_ERROR,"Fatal xrdp_mm_sesman_data_in: unknown cmd code %d", code);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"Undefined reply code %d received from sesman",
|
||||
code);
|
||||
cleanup_sesman_connection(self);
|
||||
break;
|
||||
}
|
||||
@ -1489,7 +1487,7 @@ access_control(char *username, char *password, char *srv)
|
||||
else
|
||||
{
|
||||
log_message(LOG_LEVEL_ERROR, "Corrupt reply size or "
|
||||
"version from sesman: %d", size);
|
||||
"version from sesman: %ld", size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1801,8 +1799,6 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
char *name;
|
||||
char *value;
|
||||
char ip[256];
|
||||
char errstr[256];
|
||||
char text[256];
|
||||
char port[8];
|
||||
char chansrvport[256];
|
||||
#ifdef ACCESS
|
||||
@ -1820,8 +1816,6 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
/* make sure we start in correct state */
|
||||
cleanup_states(self);
|
||||
g_memset(ip, 0, sizeof(ip));
|
||||
g_memset(errstr, 0, sizeof(errstr));
|
||||
g_memset(text, 0, sizeof(text));
|
||||
g_memset(port, 0, sizeof(port));
|
||||
g_memset(chansrvport, 0, sizeof(chansrvport));
|
||||
rv = 0; /* success */
|
||||
@ -1884,10 +1878,10 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
if (use_pam_auth)
|
||||
{
|
||||
int reply;
|
||||
char replytxt[128];
|
||||
char pam_error[128];
|
||||
const char *additionalError;
|
||||
xrdp_wm_log_msg(self->wm, "Please wait, we now perform access control...");
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_DEBUG,
|
||||
"Please wait, we now perform access control...");
|
||||
|
||||
/* g_writeln("we use pam modules to check if we can approve this user"); */
|
||||
if (!g_strncmp(pam_auth_username, "same", 255))
|
||||
@ -1905,19 +1899,14 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
/* access_control return 0 on success */
|
||||
reply = access_control(pam_auth_username, pam_auth_password, pam_auth_sessionIP);
|
||||
|
||||
g_sprintf(replytxt, "Reply from access control: %s",
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO,
|
||||
"Reply from access control: %s",
|
||||
getPAMError(reply, pam_error, 127));
|
||||
|
||||
xrdp_wm_log_msg(self->wm, replytxt);
|
||||
log_message(LOG_LEVEL_INFO, replytxt);
|
||||
additionalError = getPAMAdditionalErrorInfo(reply, self);
|
||||
if (additionalError)
|
||||
if (additionalError && additionalError[0])
|
||||
{
|
||||
g_snprintf(replytxt, 127, "%s", additionalError);
|
||||
if (replytxt[0])
|
||||
{
|
||||
xrdp_wm_log_msg(self->wm, replytxt);
|
||||
}
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO, "%s", additionalError);
|
||||
}
|
||||
|
||||
if (reply != 0)
|
||||
@ -1936,8 +1925,8 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
self->sesman_trans = trans_create(TRANS_MODE_TCP, 8192, 8192);
|
||||
self->sesman_trans->is_term = g_is_term;
|
||||
xrdp_mm_get_sesman_port(port, sizeof(port));
|
||||
g_snprintf(text, 255, "connecting to sesman ip %s port %s", ip, port);
|
||||
xrdp_wm_log_msg(self->wm, text);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_DEBUG,
|
||||
"connecting to sesman ip %s port %s", ip, port);
|
||||
/* xrdp_mm_sesman_data_in is the callback that is called when data arrives */
|
||||
self->sesman_trans->trans_data_in = xrdp_mm_sesman_data_in;
|
||||
self->sesman_trans->header_size = 8;
|
||||
@ -1961,16 +1950,15 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
if (ok)
|
||||
{
|
||||
/* fully connect */
|
||||
xrdp_wm_log_msg(self->wm, "sesman connect ok");
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_INFO, "sesman connect ok");
|
||||
self->connected_state = 1;
|
||||
rv = xrdp_mm_send_login(self);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_snprintf(errstr, 255, "Failure to connect to sesman: %s port: %s",
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"Error connecting to sesman: %s port: %s",
|
||||
ip, port);
|
||||
xrdp_wm_log_msg(self->wm, errstr);
|
||||
log_message(LOG_LEVEL_ERROR,errstr);
|
||||
trans_delete(self->sesman_trans);
|
||||
self->sesman_trans = 0;
|
||||
self->sesman_trans_up = 0;
|
||||
@ -1989,9 +1977,8 @@ xrdp_mm_connect(struct xrdp_mm *self)
|
||||
else
|
||||
{
|
||||
/* connect error */
|
||||
g_snprintf(errstr, 255, "Failure to connect to: %s", ip);
|
||||
log_message(LOG_LEVEL_ERROR,errstr);
|
||||
xrdp_wm_log_msg(self->wm, errstr);
|
||||
xrdp_wm_log_msg(self->wm, LOG_LEVEL_ERROR,
|
||||
"Error connecting to: %s", ip);
|
||||
rv = 1; /* failure */
|
||||
}
|
||||
}
|
||||
@ -2664,7 +2651,7 @@ server_msg(struct xrdp_mod *mod, char *msg, int code)
|
||||
}
|
||||
|
||||
wm = (struct xrdp_wm *)(mod->wm);
|
||||
return xrdp_wm_log_msg(wm, msg);
|
||||
return xrdp_wm_log_msg(wm, LOG_LEVEL_DEBUG, "%s", msg);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -3159,7 +3146,7 @@ server_query_channel(struct xrdp_mod *mod, int index, char *channel_name,
|
||||
/*****************************************************************************/
|
||||
/* returns -1 on error */
|
||||
int DEFAULT_CC
|
||||
server_get_channel_id(struct xrdp_mod *mod, char *name)
|
||||
server_get_channel_id(struct xrdp_mod *mod, const char *name)
|
||||
{
|
||||
struct xrdp_wm *wm;
|
||||
|
||||
|
@ -262,7 +262,7 @@ xrdp_painter_rop(int rop, int src, int dst)
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
xrdp_painter_text_width(struct xrdp_painter *self, char *text)
|
||||
xrdp_painter_text_width(struct xrdp_painter *self, const char *text)
|
||||
{
|
||||
int index;
|
||||
int rv;
|
||||
@ -299,7 +299,7 @@ xrdp_painter_text_width(struct xrdp_painter *self, char *text)
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
xrdp_painter_text_height(struct xrdp_painter *self, char *text)
|
||||
xrdp_painter_text_height(struct xrdp_painter *self, const char *text)
|
||||
{
|
||||
int index;
|
||||
int rv;
|
||||
|
@ -42,7 +42,7 @@ struct xrdp_mod
|
||||
long param3, long param4);
|
||||
int (*mod_signal)(struct xrdp_mod* v);
|
||||
int (*mod_end)(struct xrdp_mod* v);
|
||||
int (*mod_set_param)(struct xrdp_mod* v, char* name, char* value);
|
||||
int (*mod_set_param)(struct xrdp_mod* v, const char *name, char* value);
|
||||
int (*mod_session_change)(struct xrdp_mod* v, int, int);
|
||||
int (*mod_get_wait_objs)(struct xrdp_mod* v, tbus* read_objs, int* rcount,
|
||||
tbus* write_objs, int* wcount, int* timeout);
|
||||
@ -88,7 +88,7 @@ struct xrdp_mod
|
||||
int (*server_query_channel)(struct xrdp_mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct xrdp_mod* v, char* name);
|
||||
int (*server_get_channel_id)(struct xrdp_mod* v, const char *name);
|
||||
int (*server_send_to_channel)(struct xrdp_mod* v, int channel_id,
|
||||
char* data, int data_len,
|
||||
int total_data_len, int flags);
|
||||
@ -216,7 +216,7 @@ struct xrdp_brush_item
|
||||
{
|
||||
int stamp;
|
||||
/* expand this to a structure to handle more complicated brushes
|
||||
for now its 8x8 1bpp brushes only */
|
||||
for now it's 8x8 1bpp brushes only */
|
||||
char pattern[8];
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
* simple window manager
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "xrdp.h"
|
||||
#include "log.h"
|
||||
|
||||
@ -45,7 +47,7 @@ xrdp_wm_create(struct xrdp_process *owner,
|
||||
pid = g_getpid();
|
||||
g_snprintf(event_name, 255, "xrdp_%8.8x_wm_login_mode_event_%8.8x",
|
||||
pid, owner->session_id);
|
||||
log_message(LOG_LEVEL_DEBUG,event_name);
|
||||
log_message(LOG_LEVEL_DEBUG, "%s", event_name);
|
||||
self->login_mode_event = g_create_wait_obj(event_name);
|
||||
self->painter = xrdp_painter_create(self, self->session);
|
||||
self->cache = xrdp_cache_create(self, self->session, self->client_info);
|
||||
@ -60,7 +62,7 @@ xrdp_wm_create(struct xrdp_process *owner,
|
||||
self->current_surface_index = 0xffff; /* screen */
|
||||
|
||||
/* to store configuration from xrdp.ini */
|
||||
self->xrdp_config = g_malloc(sizeof(struct xrdp_config), 1);
|
||||
self->xrdp_config = g_new0(struct xrdp_config, 1);
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -546,7 +548,7 @@ xrdp_wm_init(struct xrdp_wm *self)
|
||||
struct list *names;
|
||||
struct list *values;
|
||||
char *q;
|
||||
char *r;
|
||||
const char *r;
|
||||
char param[256];
|
||||
char section_name[256];
|
||||
char cfg_file[256];
|
||||
@ -677,9 +679,9 @@ xrdp_wm_init(struct xrdp_wm *self)
|
||||
else
|
||||
{
|
||||
/* requested module name not found in xrdp.ini */
|
||||
g_writeln(" xrdp_wm_init: file_read_section returned non-zero, requested section not found in xrdp.ini");
|
||||
xrdp_wm_log_msg(self, "ERROR: The requested xrdp module not found in xrdp.ini,"
|
||||
" falling back to login window");
|
||||
xrdp_wm_log_msg(self, LOG_LEVEL_ERROR,
|
||||
"Section \"%s\" not configured in xrdp.ini",
|
||||
section_name);
|
||||
}
|
||||
|
||||
list_delete(names);
|
||||
@ -1725,8 +1727,8 @@ callback(long id, int msg, long param1, long param2, long param3, long param4)
|
||||
rv = xrdp_wm_process_input_mousex(wm, param3, param1, param2);
|
||||
break;
|
||||
case 0x4444: /* invalidate, this is not from RDP_DATA_PDU_INPUT */
|
||||
/* like the rest, its from RDP_PDU_DATA with code 33 */
|
||||
/* its the rdp client asking for a screen update */
|
||||
/* like the rest, it's from RDP_PDU_DATA with code 33 */
|
||||
/* it's the rdp client asking for a screen update */
|
||||
MAKERECT(rect, param1, param2, param3, param4);
|
||||
rv = xrdp_bitmap_invalidate(wm->screen, &rect);
|
||||
break;
|
||||
@ -1857,22 +1859,21 @@ xrdp_wm_log_wnd_notify(struct xrdp_bitmap *wnd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void add_string_to_logwindow(char *msg, struct list *log)
|
||||
static void
|
||||
add_string_to_logwindow(const char *msg, struct list *log)
|
||||
{
|
||||
|
||||
char *new_part_message;
|
||||
char *current_pointer = msg ;
|
||||
int processedlen = 0;
|
||||
const char *new_part_message;
|
||||
const char *current_pointer = msg;
|
||||
int len_done = 0;
|
||||
|
||||
do
|
||||
{
|
||||
new_part_message = g_strndup(current_pointer, LOG_WINDOW_CHAR_PER_LINE) ;
|
||||
g_writeln("%s",new_part_message);
|
||||
list_add_item(log, (long)new_part_message);
|
||||
processedlen = processedlen + g_strlen(new_part_message);
|
||||
current_pointer = current_pointer + g_strlen(new_part_message) ;
|
||||
}
|
||||
while ((processedlen < g_strlen(msg)) && (processedlen < DEFAULT_STRING_LEN));
|
||||
new_part_message = g_strndup(current_pointer, LOG_WINDOW_CHAR_PER_LINE);
|
||||
g_writeln("%s", new_part_message);
|
||||
list_add_item(log, (tintptr) new_part_message);
|
||||
len_done += g_strlen(new_part_message);
|
||||
current_pointer += g_strlen(new_part_message);
|
||||
} while ((len_done < g_strlen(msg)) && (len_done < DEFAULT_STRING_LEN));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -1966,8 +1967,17 @@ xrdp_wm_show_log(struct xrdp_wm *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
xrdp_wm_log_msg(struct xrdp_wm *self, char *msg)
|
||||
xrdp_wm_log_msg(struct xrdp_wm *self, enum logLevels loglevel,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char msg[256];
|
||||
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
log_message(loglevel, "xrdp_wm_log_msg: %s", msg);
|
||||
add_string_to_logwindow(msg, self->log);
|
||||
return 0;
|
||||
}
|
||||
|
@ -466,8 +466,8 @@ main(int argc, char **argv)
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
g_writeln("problem opening to xrdp.pid");
|
||||
g_writeln("maybe its not running");
|
||||
g_writeln("cannot open %s, maybe xrdp is not running",
|
||||
pid_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,8 +53,10 @@ static int send_init(struct wts_obj *wts);
|
||||
static int can_send(int sck, int millis);
|
||||
static int can_recv(int sck, int millis);
|
||||
|
||||
static char g_xrdpapi_magic[12] =
|
||||
{ 0x78, 0x32, 0x10, 0x67, 0x00, 0x92, 0x30, 0x56, 0xff, 0xd8, 0xa9, 0x1f };
|
||||
static const unsigned char g_xrdpapi_magic[12] =
|
||||
{
|
||||
0x78, 0x32, 0x10, 0x67, 0x00, 0x92, 0x30, 0x56, 0xff, 0xd8, 0xa9, 0x1f
|
||||
};
|
||||
|
||||
/*
|
||||
* Opens a handle to the server end of a specified virtual channel - this
|
||||
|
18
xup/xup.c
18
xup/xup.c
@ -697,7 +697,7 @@ process_server_window_new_update(struct mod *mod, struct stream *s)
|
||||
|
||||
if (title_bytes > 0)
|
||||
{
|
||||
rwso.title_info = g_malloc(title_bytes + 1, 0);
|
||||
rwso.title_info = g_new(char, title_bytes + 1);
|
||||
in_uint8a(s, rwso.title_info, title_bytes);
|
||||
rwso.title_info[title_bytes] = 0;
|
||||
}
|
||||
@ -1088,7 +1088,7 @@ process_server_paint_rect_shmem(struct mod *amod, struct stream *s)
|
||||
if (amod->screen_shmem_id_mapped == 0)
|
||||
{
|
||||
amod->screen_shmem_id = shmem_id;
|
||||
amod->screen_shmem_pixels = g_shmat(amod->screen_shmem_id);
|
||||
amod->screen_shmem_pixels = (char *) g_shmat(amod->screen_shmem_id);
|
||||
if (amod->screen_shmem_pixels == (void*)-1)
|
||||
{
|
||||
/* failed */
|
||||
@ -1199,7 +1199,7 @@ process_server_paint_rect_shmem_ex(struct mod *amod, struct stream *s)
|
||||
if (amod->screen_shmem_id_mapped == 0)
|
||||
{
|
||||
amod->screen_shmem_id = shmem_id;
|
||||
amod->screen_shmem_pixels = g_shmat(amod->screen_shmem_id);
|
||||
amod->screen_shmem_pixels = (char *) g_shmat(amod->screen_shmem_id);
|
||||
if (amod->screen_shmem_pixels == (void*)-1)
|
||||
{
|
||||
/* failed */
|
||||
@ -1479,7 +1479,7 @@ lib_mod_end(struct mod *mod)
|
||||
/******************************************************************************/
|
||||
/* return error */
|
||||
int DEFAULT_CC
|
||||
lib_mod_set_param(struct mod *mod, char *name, char *value)
|
||||
lib_mod_set_param(struct mod *mod, const char *name, char *value)
|
||||
{
|
||||
if (g_strcasecmp(name, "username") == 0)
|
||||
{
|
||||
@ -1552,7 +1552,7 @@ lib_mod_frame_ack(struct mod *amod, int flags, int frame_id)
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct mod *EXPORT_CC
|
||||
tintptr EXPORT_CC
|
||||
mod_init(void)
|
||||
{
|
||||
struct mod *mod;
|
||||
@ -1560,7 +1560,7 @@ mod_init(void)
|
||||
mod = (struct mod *)g_malloc(sizeof(struct mod), 1);
|
||||
mod->size = sizeof(struct mod);
|
||||
mod->version = CURRENT_MOD_VER;
|
||||
mod->handle = (tbus)mod;
|
||||
mod->handle = (tintptr) mod;
|
||||
mod->mod_connect = lib_mod_connect;
|
||||
mod->mod_start = lib_mod_start;
|
||||
mod->mod_event = lib_mod_event;
|
||||
@ -1570,13 +1570,15 @@ mod_init(void)
|
||||
mod->mod_get_wait_objs = lib_mod_get_wait_objs;
|
||||
mod->mod_check_wait_objs = lib_mod_check_wait_objs;
|
||||
mod->mod_frame_ack = lib_mod_frame_ack;
|
||||
return mod;
|
||||
return (tintptr) mod;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int EXPORT_CC
|
||||
mod_exit(struct mod *mod)
|
||||
mod_exit(tintptr handle)
|
||||
{
|
||||
struct mod *mod = (struct mod *) handle;
|
||||
|
||||
if (mod == 0)
|
||||
{
|
||||
return 0;
|
||||
|
@ -39,7 +39,7 @@ struct mod
|
||||
tbus param3, tbus param4);
|
||||
int (*mod_signal)(struct mod* v);
|
||||
int (*mod_end)(struct mod* v);
|
||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||
int (*mod_set_param)(struct mod* v, const char *name, char* value);
|
||||
int (*mod_session_change)(struct mod* v, int, int);
|
||||
int (*mod_get_wait_objs)(struct mod* v, tbus* read_objs, int* rcount,
|
||||
tbus* write_objs, int* wcount, int* timeout);
|
||||
@ -58,7 +58,7 @@ struct mod
|
||||
int srcx, int srcy);
|
||||
int (*server_set_cursor)(struct mod* v, int x, int y, char* data, char* mask);
|
||||
int (*server_palette)(struct mod* v, int* palette);
|
||||
int (*server_msg)(struct mod* v, char* msg, int code);
|
||||
int (*server_msg)(struct mod* v, const char *msg, int code);
|
||||
int (*server_is_term)(struct mod* v);
|
||||
int (*server_set_clip)(struct mod* v, int x, int y, int cx, int cy);
|
||||
int (*server_reset_clip)(struct mod* v);
|
||||
@ -84,7 +84,7 @@ struct mod
|
||||
int (*server_query_channel)(struct mod* v, int index,
|
||||
char* channel_name,
|
||||
int* channel_flags);
|
||||
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||
int (*server_get_channel_id)(struct mod* v, const char *name);
|
||||
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||
char* data, int data_len,
|
||||
int total_data_len, int flags);
|
||||
|
Loading…
Reference in New Issue
Block a user