|
|
|
@ -40,7 +40,7 @@ xrdp_mm_create(struct xrdp_wm* owner)
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* called from main thread */
|
|
|
|
|
static long DEFAULT_CC
|
|
|
|
|
sync_unload(long param1, long param2)
|
|
|
|
|
xrdp_mm_sync_unload(long param1, long param2)
|
|
|
|
|
{
|
|
|
|
|
return g_free_library(param1);
|
|
|
|
|
}
|
|
|
|
@ -48,7 +48,7 @@ sync_unload(long param1, long param2)
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* called from main thread */
|
|
|
|
|
static long DEFAULT_CC
|
|
|
|
|
sync_load(long param1, long param2)
|
|
|
|
|
xrdp_mm_sync_load(long param1, long param2)
|
|
|
|
|
{
|
|
|
|
|
long rv;
|
|
|
|
|
char* libname;
|
|
|
|
@ -66,14 +66,18 @@ xrdp_mm_module_cleanup(struct xrdp_mm* self)
|
|
|
|
|
{
|
|
|
|
|
if (self->mod_exit != 0)
|
|
|
|
|
{
|
|
|
|
|
/* let the module cleanup */
|
|
|
|
|
self->mod_exit(self->mod);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (self->mod_handle != 0)
|
|
|
|
|
{
|
|
|
|
|
g_xrdp_sync(sync_unload, self->mod_handle, 0);
|
|
|
|
|
/* main thread unload */
|
|
|
|
|
g_xrdp_sync(xrdp_mm_sync_unload, self->mod_handle, 0);
|
|
|
|
|
}
|
|
|
|
|
trans_delete(self->chan_trans);
|
|
|
|
|
self->chan_trans = 0;
|
|
|
|
|
self->chan_trans_up = 0;
|
|
|
|
|
self->mod_init = 0;
|
|
|
|
|
self->mod_exit = 0;
|
|
|
|
|
self->mod = 0;
|
|
|
|
@ -90,107 +94,14 @@ xrdp_mm_delete(struct xrdp_mm* self)
|
|
|
|
|
}
|
|
|
|
|
/* free any module stuff */
|
|
|
|
|
xrdp_mm_module_cleanup(self);
|
|
|
|
|
if (self->sck_obj != 0)
|
|
|
|
|
{
|
|
|
|
|
g_delete_wait_obj_from_socket(self->sck_obj);
|
|
|
|
|
self->sck_obj = 0;
|
|
|
|
|
}
|
|
|
|
|
if (self->sck != 0)
|
|
|
|
|
{
|
|
|
|
|
g_tcp_close(self->sck);
|
|
|
|
|
self->sck = 0;
|
|
|
|
|
}
|
|
|
|
|
trans_delete(self->sesman_trans);
|
|
|
|
|
self->sesman_trans = 0;
|
|
|
|
|
self->sesman_trans_up = 0;
|
|
|
|
|
list_delete(self->login_names);
|
|
|
|
|
list_delete(self->login_values);
|
|
|
|
|
g_free(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
/* returns error */
|
|
|
|
|
static int APP_CC
|
|
|
|
|
xrdp_mm_recv(struct xrdp_mm* self, char* data, int len)
|
|
|
|
|
{
|
|
|
|
|
int rcvd;
|
|
|
|
|
|
|
|
|
|
if (self->sck_closed)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
while (len > 0)
|
|
|
|
|
{
|
|
|
|
|
rcvd = g_tcp_recv(self->sck, data, len, 0);
|
|
|
|
|
if (rcvd == -1)
|
|
|
|
|
{
|
|
|
|
|
if (g_tcp_last_error_would_block(self->sck))
|
|
|
|
|
{
|
|
|
|
|
if (g_is_term())
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
g_tcp_can_recv(self->sck, 10);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (rcvd == 0)
|
|
|
|
|
{
|
|
|
|
|
self->sck_closed = 1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
data += rcvd;
|
|
|
|
|
len -= rcvd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* returns error */
|
|
|
|
|
static int APP_CC
|
|
|
|
|
xrdp_mm_send(struct xrdp_mm* self, char* data, int len)
|
|
|
|
|
{
|
|
|
|
|
int sent;
|
|
|
|
|
|
|
|
|
|
if (self->sck_closed)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
while (len > 0)
|
|
|
|
|
{
|
|
|
|
|
sent = g_tcp_send(self->sck, data, len, 0);
|
|
|
|
|
if (sent == -1)
|
|
|
|
|
{
|
|
|
|
|
if (g_tcp_last_error_would_block(self->sck))
|
|
|
|
|
{
|
|
|
|
|
if (g_is_term())
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
g_tcp_can_send(self->sck, 10);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (sent == 0)
|
|
|
|
|
{
|
|
|
|
|
self->sck_closed = 1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
data += sent;
|
|
|
|
|
len -= sent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
static int APP_CC
|
|
|
|
|
xrdp_mm_send_login(struct xrdp_mm* self)
|
|
|
|
@ -235,8 +146,7 @@ xrdp_mm_send_login(struct xrdp_mm* self)
|
|
|
|
|
xrdp_wm_log_msg(self->wm, "error finding username and password");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
make_stream(s);
|
|
|
|
|
init_stream(s, 8192);
|
|
|
|
|
s = trans_get_out_s(self->sesman_trans, 8192);
|
|
|
|
|
s_push_layer(s, channel_hdr, 8);
|
|
|
|
|
/* this code is either 0 for Xvnc or 10 for X11rdp */
|
|
|
|
|
out_uint16_be(s, self->code);
|
|
|
|
@ -264,14 +174,13 @@ xrdp_mm_send_login(struct xrdp_mm* self)
|
|
|
|
|
s_mark_end(s);
|
|
|
|
|
s_pop_layer(s, channel_hdr);
|
|
|
|
|
out_uint32_be(s, 0); /* version */
|
|
|
|
|
index = s->end - s->data;
|
|
|
|
|
index = (int)(s->end - s->data);
|
|
|
|
|
out_uint32_be(s, index); /* size */
|
|
|
|
|
rv = xrdp_mm_send(self, s->data, index);
|
|
|
|
|
rv = trans_force_write(self->sesman_trans);
|
|
|
|
|
if (rv != 0)
|
|
|
|
|
{
|
|
|
|
|
xrdp_wm_log_msg(self->wm, "xrdp_mm_send_login: xrdp_mm_send failed");
|
|
|
|
|
}
|
|
|
|
|
free_stream(s);
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -339,7 +248,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm* self)
|
|
|
|
|
}
|
|
|
|
|
if (self->mod_handle == 0)
|
|
|
|
|
{
|
|
|
|
|
self->mod_handle = g_xrdp_sync(sync_load, (long)lib, 0);
|
|
|
|
|
self->mod_handle = g_xrdp_sync(xrdp_mm_sync_load, (long)lib, 0);
|
|
|
|
|
if (self->mod_handle != 0)
|
|
|
|
|
{
|
|
|
|
|
func = g_get_proc_address(self->mod_handle, "mod_init");
|
|
|
|
@ -795,11 +704,7 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s)
|
|
|
|
|
{
|
|
|
|
|
xrdp_wm_log_msg(self->wm, "xrdp_mm_process_login_response: login failed");
|
|
|
|
|
}
|
|
|
|
|
/* close socket */
|
|
|
|
|
g_delete_wait_obj_from_socket(self->sck_obj);
|
|
|
|
|
self->sck_obj = 0;
|
|
|
|
|
g_tcp_close(self->sck);
|
|
|
|
|
self->sck = 0;
|
|
|
|
|
self->delete_sesman_trans = 1;
|
|
|
|
|
self->connected_state = 0;
|
|
|
|
|
if (self->wm->login_mode != 10)
|
|
|
|
|
{
|
|
|
|
@ -859,6 +764,93 @@ xrdp_mm_get_sesman_port(char* port, int port_bytes)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* returns error
|
|
|
|
|
data coming from client that need to go to channel handler */
|
|
|
|
|
int APP_CC
|
|
|
|
|
xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2,
|
|
|
|
|
tbus param3, tbus param4)
|
|
|
|
|
{
|
|
|
|
|
struct stream* s;
|
|
|
|
|
int rv;
|
|
|
|
|
int length;
|
|
|
|
|
int total_length;
|
|
|
|
|
int flags;
|
|
|
|
|
int id;
|
|
|
|
|
char* data;
|
|
|
|
|
|
|
|
|
|
rv = 0;
|
|
|
|
|
if ((self->chan_trans != 0) && self->chan_trans_up)
|
|
|
|
|
{
|
|
|
|
|
s = trans_get_out_s(self->chan_trans, 8192);
|
|
|
|
|
if (s != 0)
|
|
|
|
|
{
|
|
|
|
|
id = LOWORD(param1);
|
|
|
|
|
flags = HIWORD(param1);
|
|
|
|
|
length = param2;
|
|
|
|
|
data = (char*)param3;
|
|
|
|
|
total_length = param4;
|
|
|
|
|
if (total_length < length)
|
|
|
|
|
{
|
|
|
|
|
g_writeln("warning in xrdp_mm_process_channel_data total_len < length");
|
|
|
|
|
total_length = length;
|
|
|
|
|
}
|
|
|
|
|
out_uint32_le(s, 0); /* version */
|
|
|
|
|
out_uint32_le(s, 8 + 8 + 2 + 2 + 2 + 4 + length);
|
|
|
|
|
out_uint32_le(s, 5); /* msg id */
|
|
|
|
|
out_uint32_le(s, 8 + 2 + 2 + 2 + 4 + length);
|
|
|
|
|
out_uint16_le(s, id);
|
|
|
|
|
out_uint16_le(s, flags);
|
|
|
|
|
out_uint16_le(s, length);
|
|
|
|
|
out_uint32_le(s, total_length);
|
|
|
|
|
out_uint8a(s, data, length);
|
|
|
|
|
s_mark_end(s);
|
|
|
|
|
rv = trans_force_write(self->chan_trans);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
static int APP_CC
|
|
|
|
|
xrdp_mm_sesman_data_in(struct trans* trans)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_mm* self;
|
|
|
|
|
struct stream* s;
|
|
|
|
|
int version;
|
|
|
|
|
int size;
|
|
|
|
|
int error;
|
|
|
|
|
int code;
|
|
|
|
|
|
|
|
|
|
if (trans == 0)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
self = (struct xrdp_mm*)(trans->callback_data);
|
|
|
|
|
s = trans_get_in_s(trans);
|
|
|
|
|
if (s == 0)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
in_uint32_be(s, version);
|
|
|
|
|
in_uint32_be(s, size);
|
|
|
|
|
error = trans_force_read(trans, size - 8);
|
|
|
|
|
if (error == 0)
|
|
|
|
|
{
|
|
|
|
|
in_uint16_be(s, code);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case 3:
|
|
|
|
|
error = xrdp_mm_process_login_response(self, s);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_writeln("xrdp_mm_sesman_data_in: unknown code %d", code);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
int APP_CC
|
|
|
|
|
xrdp_mm_connect(struct xrdp_mm* self)
|
|
|
|
@ -903,40 +895,27 @@ xrdp_mm_connect(struct xrdp_mm* self)
|
|
|
|
|
{
|
|
|
|
|
ok = 0;
|
|
|
|
|
errstr[0] = 0;
|
|
|
|
|
self->sck = g_tcp_socket();
|
|
|
|
|
self->sck_obj = g_create_wait_obj_from_socket(self->sck, 0);
|
|
|
|
|
g_tcp_set_non_blocking(self->sck);
|
|
|
|
|
trans_delete(self->sesman_trans);
|
|
|
|
|
self->sesman_trans = trans_create(1, 8192, 8192);
|
|
|
|
|
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);
|
|
|
|
|
error = g_tcp_connect(self->sck, ip, port);
|
|
|
|
|
if (error == 0)
|
|
|
|
|
{
|
|
|
|
|
ok = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (error == -1)
|
|
|
|
|
|
|
|
|
|
self->sesman_trans->trans_data_in = xrdp_mm_sesman_data_in;
|
|
|
|
|
self->sesman_trans->header_size = 8;
|
|
|
|
|
self->sesman_trans->callback_data = self;
|
|
|
|
|
/* try to connect up to 4 times */
|
|
|
|
|
for (index = 0; index < 4; index++)
|
|
|
|
|
{
|
|
|
|
|
if (g_tcp_last_error_would_block(self->sck))
|
|
|
|
|
if (trans_connect(self->sesman_trans, ip, port, 3000) == 0)
|
|
|
|
|
{
|
|
|
|
|
self->sesman_trans_up = 1;
|
|
|
|
|
ok = 1;
|
|
|
|
|
/* wait up to 3 seconds for connect to complete */
|
|
|
|
|
index = 0;
|
|
|
|
|
while (!g_tcp_can_send(self->sck, 100))
|
|
|
|
|
{
|
|
|
|
|
index++;
|
|
|
|
|
if ((index >= 30) || g_is_term())
|
|
|
|
|
{
|
|
|
|
|
g_snprintf(errstr, 255, "error connect sesman - connect timeout");
|
|
|
|
|
ok = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
name = g_get_strerror();
|
|
|
|
|
g_snprintf(errstr, 255, "error connect sesman - %s", name);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
g_sleep(1000);
|
|
|
|
|
g_writeln("xrdp_mm_connect: connect failed "
|
|
|
|
|
"trying again...");
|
|
|
|
|
}
|
|
|
|
|
if (ok)
|
|
|
|
|
{
|
|
|
|
@ -948,10 +927,9 @@ xrdp_mm_connect(struct xrdp_mm* self)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xrdp_wm_log_msg(self->wm, errstr);
|
|
|
|
|
g_delete_wait_obj_from_socket(self->sck_obj);
|
|
|
|
|
self->sck_obj = 0;
|
|
|
|
|
g_tcp_close(self->sck);
|
|
|
|
|
self->sck = 0;
|
|
|
|
|
trans_delete(self->sesman_trans);
|
|
|
|
|
self->sesman_trans = 0;
|
|
|
|
|
self->sesman_trans_up = 0;
|
|
|
|
|
rv = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -976,94 +954,82 @@ xrdp_mm_connect(struct xrdp_mm* self)
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
int APP_CC
|
|
|
|
|
xrdp_mm_signal(struct xrdp_mm* self)
|
|
|
|
|
xrdp_mm_get_wait_objs(struct xrdp_mm* self,
|
|
|
|
|
tbus* read_objs, int* rcount,
|
|
|
|
|
tbus* write_objs, int* wcount, int* timeout)
|
|
|
|
|
{
|
|
|
|
|
struct stream* s;
|
|
|
|
|
int error;
|
|
|
|
|
int version;
|
|
|
|
|
int size;
|
|
|
|
|
int code;
|
|
|
|
|
int rv;
|
|
|
|
|
|
|
|
|
|
if (self == 0)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
rv = 0;
|
|
|
|
|
if (self->connected_state == 1)
|
|
|
|
|
if ((self->sesman_trans != 0) && self->sesman_trans_up)
|
|
|
|
|
{
|
|
|
|
|
make_stream(s);
|
|
|
|
|
init_stream(s, 8192);
|
|
|
|
|
error = xrdp_mm_recv(self, s->data, 8);
|
|
|
|
|
if (error == 0)
|
|
|
|
|
{
|
|
|
|
|
in_uint32_be(s, version);
|
|
|
|
|
in_uint32_be(s, size);
|
|
|
|
|
init_stream(s, 8192);
|
|
|
|
|
error = (size <= 8) || (size > 8000);
|
|
|
|
|
}
|
|
|
|
|
if (error == 0)
|
|
|
|
|
{
|
|
|
|
|
error = xrdp_mm_recv(self, s->data, size - 8);
|
|
|
|
|
}
|
|
|
|
|
if (error == 0)
|
|
|
|
|
trans_get_wait_objs(self->sesman_trans, read_objs, rcount, timeout);
|
|
|
|
|
}
|
|
|
|
|
if ((self->chan_trans != 0) && self->chan_trans_up)
|
|
|
|
|
{
|
|
|
|
|
trans_get_wait_objs(self->chan_trans, read_objs, rcount, timeout);
|
|
|
|
|
}
|
|
|
|
|
if (self->mod != 0)
|
|
|
|
|
{
|
|
|
|
|
if (self->mod->mod_get_wait_objs != 0)
|
|
|
|
|
{
|
|
|
|
|
in_uint16_be(s, code);
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case 3:
|
|
|
|
|
rv = xrdp_mm_process_login_response(self, s);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_writeln("unknown code %d in xrdp_mm_signal", code);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
rv = self->mod->mod_get_wait_objs(self->mod, read_objs, rcount,
|
|
|
|
|
write_objs, wcount, timeout);
|
|
|
|
|
}
|
|
|
|
|
free_stream(s);
|
|
|
|
|
}
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* returns error
|
|
|
|
|
data coming from client that need to go to channel handler */
|
|
|
|
|
int APP_CC
|
|
|
|
|
xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2,
|
|
|
|
|
tbus param3, tbus param4)
|
|
|
|
|
xrdp_mm_check_wait_objs(struct xrdp_mm* self)
|
|
|
|
|
{
|
|
|
|
|
struct stream* s;
|
|
|
|
|
int rv;
|
|
|
|
|
int length;
|
|
|
|
|
int total_length;
|
|
|
|
|
int flags;
|
|
|
|
|
int id;
|
|
|
|
|
char* data;
|
|
|
|
|
|
|
|
|
|
if (self == 0)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
rv = 0;
|
|
|
|
|
if ((self->sesman_trans != 0) && self->sesman_trans_up)
|
|
|
|
|
{
|
|
|
|
|
if (trans_check_wait_objs(self->sesman_trans) != 0)
|
|
|
|
|
{
|
|
|
|
|
self->delete_sesman_trans = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ((self->chan_trans != 0) && self->chan_trans_up)
|
|
|
|
|
{
|
|
|
|
|
s = trans_get_out_s(self->chan_trans, 8192);
|
|
|
|
|
if (s != 0)
|
|
|
|
|
if (trans_check_wait_objs(self->chan_trans) != 0)
|
|
|
|
|
{
|
|
|
|
|
id = LOWORD(param1);
|
|
|
|
|
flags = HIWORD(param1);
|
|
|
|
|
length = param2;
|
|
|
|
|
data = (char*)param3;
|
|
|
|
|
total_length = param4;
|
|
|
|
|
if (total_length < length)
|
|
|
|
|
{
|
|
|
|
|
g_writeln("warning in xrdp_mm_process_channel_data total_len < length");
|
|
|
|
|
total_length = length;
|
|
|
|
|
}
|
|
|
|
|
out_uint32_le(s, 0); /* version */
|
|
|
|
|
out_uint32_le(s, 8 + 8 + 2 + 2 + 2 + 4 + length);
|
|
|
|
|
out_uint32_le(s, 5); /* msg id */
|
|
|
|
|
out_uint32_le(s, 8 + 2 + 2 + 2 + 4 + length);
|
|
|
|
|
out_uint16_le(s, id);
|
|
|
|
|
out_uint16_le(s, flags);
|
|
|
|
|
out_uint16_le(s, length);
|
|
|
|
|
out_uint32_le(s, total_length);
|
|
|
|
|
out_uint8a(s, data, length);
|
|
|
|
|
s_mark_end(s);
|
|
|
|
|
rv = trans_force_write(self->chan_trans);
|
|
|
|
|
self->delete_chan_trans = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (self->mod != 0)
|
|
|
|
|
{
|
|
|
|
|
if (self->mod->mod_check_wait_objs != 0)
|
|
|
|
|
{
|
|
|
|
|
rv = self->mod->mod_check_wait_objs(self->mod);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (self->delete_sesman_trans)
|
|
|
|
|
{
|
|
|
|
|
trans_delete(self->sesman_trans);
|
|
|
|
|
self->sesman_trans = 0;
|
|
|
|
|
self->sesman_trans_up = 0;
|
|
|
|
|
self->delete_sesman_trans = 0;
|
|
|
|
|
}
|
|
|
|
|
if (self->delete_chan_trans)
|
|
|
|
|
{
|
|
|
|
|
trans_delete(self->chan_trans);
|
|
|
|
|
self->chan_trans = 0;
|
|
|
|
|
self->chan_trans_up = 0;
|
|
|
|
|
self->delete_chan_trans = 0;
|
|
|
|
|
}
|
|
|
|
|
return rv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1074,7 +1040,7 @@ server_begin_update(struct xrdp_mod* mod)
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
p = xrdp_painter_create(wm, wm->session);
|
|
|
|
|
xrdp_painter_begin_update(p);
|
|
|
|
|
mod->painter = (long)p;
|
|
|
|
@ -1087,7 +1053,7 @@ server_end_update(struct xrdp_mod* mod)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
xrdp_painter_end_update(p);
|
|
|
|
|
xrdp_painter_delete(p);
|
|
|
|
|
mod->painter = 0;
|
|
|
|
@ -1101,8 +1067,8 @@ server_fill_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy)
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
xrdp_painter_fill_rect(p, wm->screen, x, y, cx, cy);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1115,8 +1081,8 @@ server_screen_blt(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->rop = 0xcc;
|
|
|
|
|
xrdp_painter_copy(p, wm->screen, wm->screen, x, y, cx, cy, srcx, srcy);
|
|
|
|
|
return 0;
|
|
|
|
@ -1131,8 +1097,8 @@ server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
|
|
|
|
|
struct xrdp_bitmap* b;
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
b = xrdp_bitmap_create_with_data(width, height, wm->screen->bpp, data, wm);
|
|
|
|
|
xrdp_painter_copy(p, b, wm->screen, x, y, cx, cy, srcx, srcy);
|
|
|
|
|
xrdp_bitmap_delete(b);
|
|
|
|
@ -1146,7 +1112,7 @@ server_set_pointer(struct xrdp_mod* mod, int x, int y,
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
xrdp_wm_pointer(wm, data, mask, x, y);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1157,7 +1123,7 @@ server_palette(struct xrdp_mod* mod, int* palette)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
if (g_memcmp(wm->palette, palette, 255 * sizeof(int)) != 0)
|
|
|
|
|
{
|
|
|
|
|
g_memcpy(wm->palette, palette, 256 * sizeof(int));
|
|
|
|
@ -1177,7 +1143,7 @@ server_msg(struct xrdp_mod* mod, char* msg, int code)
|
|
|
|
|
g_writeln(msg);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
return xrdp_wm_log_msg(wm, msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1194,7 +1160,7 @@ server_set_clip(struct xrdp_mod* mod, int x, int y, int cx, int cy)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
return xrdp_painter_set_clip(p, x, y, cx, cy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1204,7 +1170,7 @@ server_reset_clip(struct xrdp_mod* mod)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
return xrdp_painter_clr_clip(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1214,7 +1180,7 @@ server_set_fgcolor(struct xrdp_mod* mod, int fgcolor)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->fg_color = fgcolor;
|
|
|
|
|
p->pen.color = p->fg_color;
|
|
|
|
|
return 0;
|
|
|
|
@ -1226,7 +1192,7 @@ server_set_bgcolor(struct xrdp_mod* mod, int bgcolor)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->bg_color = bgcolor;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1237,7 +1203,7 @@ server_set_opcode(struct xrdp_mod* mod, int opcode)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->rop = opcode;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1248,7 +1214,7 @@ server_set_mixmode(struct xrdp_mod* mod, int mixmode)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->mix_mode = mixmode;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -1260,7 +1226,7 @@ server_set_brush(struct xrdp_mod* mod, int x_orgin, int y_orgin,
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->brush.x_orgin = x_orgin;
|
|
|
|
|
p->brush.y_orgin = y_orgin;
|
|
|
|
|
p->brush.style = style;
|
|
|
|
@ -1274,7 +1240,7 @@ server_set_pen(struct xrdp_mod* mod, int style, int width)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
p->pen.style = style;
|
|
|
|
|
p->pen.width = width;
|
|
|
|
|
return 0;
|
|
|
|
@ -1287,8 +1253,8 @@ server_draw_line(struct xrdp_mod* mod, int x1, int y1, int x2, int y2)
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
return xrdp_painter_line(p, wm->screen, x1, y1, x2, y2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1322,8 +1288,8 @@ server_draw_text(struct xrdp_mod* mod, int font,
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
struct xrdp_painter* p;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
p = (struct xrdp_painter*)mod->painter;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
p = (struct xrdp_painter*)(mod->painter);
|
|
|
|
|
return xrdp_painter_draw_text2(p, wm->screen, font, flags,
|
|
|
|
|
mixmode, clip_left, clip_top,
|
|
|
|
|
clip_right, clip_bottom,
|
|
|
|
@ -1338,7 +1304,7 @@ server_reset(struct xrdp_mod* mod, int width, int height, int bpp)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
if (wm->client_info == 0)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
@ -1378,7 +1344,7 @@ server_query_channel(struct xrdp_mod* mod, int index, char* channel_name,
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
if (wm->mm->sesman_controlled)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
@ -1394,7 +1360,7 @@ server_get_channel_id(struct xrdp_mod* mod, char* name)
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
if (wm->mm->sesman_controlled)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
@ -1410,7 +1376,7 @@ server_send_to_channel(struct xrdp_mod* mod, int channel_id,
|
|
|
|
|
{
|
|
|
|
|
struct xrdp_wm* wm;
|
|
|
|
|
|
|
|
|
|
wm = (struct xrdp_wm*)mod->wm;
|
|
|
|
|
wm = (struct xrdp_wm*)(mod->wm);
|
|
|
|
|
if (wm->mm->sesman_controlled)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|