|
|
@ -64,7 +64,7 @@ lib_recv(struct vnc* v, char* data, int len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC lib_recv return 1");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC lib_recv return 1");
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -202,14 +202,14 @@ lib_process_channel_data(struct vnc* v, int chanid, int flags, int size,
|
|
|
|
free_stream(out_s);
|
|
|
|
free_stream(out_s);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:{
|
|
|
|
default:{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC clip information unhandled");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC clip information unhandled");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
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);
|
|
|
|
"%d :(v->clip_chanid) %d",chanid,v->clip_chanid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -387,7 +387,7 @@ get_pixel_safe(char* data, int x, int y, int width, int height, int bpp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_ERROR,"error in get_pixel_safe bpp %d", bpp);
|
|
|
|
log_message(LOG_LEVEL_ERROR, "error in get_pixel_safe bpp %d", bpp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -442,7 +442,7 @@ set_pixel_safe(char* data, int x, int y, int width, int height, int bpp,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_ERROR,"error in set_pixel_safe bpp %d", bpp);
|
|
|
|
log_message(LOG_LEVEL_ERROR, "error in set_pixel_safe bpp %d", bpp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -479,7 +479,7 @@ split_color(int pixel, int* r, int* g, int* b, int bpp, int* palette)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_ERROR,"error in split_color bpp %d", bpp);
|
|
|
|
log_message(LOG_LEVEL_ERROR, "error in split_color bpp %d", bpp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -494,7 +494,7 @@ make_color(int r, int g, int b, int bpp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_ERROR,"error in make_color bpp %d", bpp);
|
|
|
|
log_message(LOG_LEVEL_ERROR, "error in make_color bpp %d", bpp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -796,7 +796,7 @@ lib_mod_signal(struct vnc* v)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (type == 3) /* clipboard */
|
|
|
|
else if (type == 3) /* clipboard */
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC got clip data");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC got clip data");
|
|
|
|
error = lib_clip_data(v);
|
|
|
|
error = lib_clip_data(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -859,8 +859,8 @@ lib_mod_connect(struct vnc* v)
|
|
|
|
if ((v->server_bpp != 8) && (v->server_bpp != 15) &&
|
|
|
|
if ((v->server_bpp != 8) && (v->server_bpp != 15) &&
|
|
|
|
(v->server_bpp != 16) && (v->server_bpp != 24))
|
|
|
|
(v->server_bpp != 16) && (v->server_bpp != 24))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
v->server_msg(v, "VNC error - only supporting 8, 15, 16 and 24 bpp rdp \
|
|
|
|
v->server_msg(v, "VNC error - only supporting 8, 15, 16 and 24 bpp rdp "
|
|
|
|
connections", 0);
|
|
|
|
"connections", 0);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (g_strcmp(v->ip, "") == 0)
|
|
|
|
if (g_strcmp(v->ip, "") == 0)
|
|
|
@ -886,7 +886,7 @@ connections", 0);
|
|
|
|
init_stream(s, 8192);
|
|
|
|
init_stream(s, 8192);
|
|
|
|
error = lib_recv(v, s->data, 12);
|
|
|
|
error = lib_recv(v, s->data, 12);
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
error = lib_send(v, "RFB 003.003\n", 12);
|
|
|
|
error = lib_send(v, "RFB 003.003\n", 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* sec type */
|
|
|
|
/* sec type */
|
|
|
@ -909,33 +909,33 @@ connections", 0);
|
|
|
|
init_stream(s, 8192);
|
|
|
|
init_stream(s, 8192);
|
|
|
|
error = lib_recv(v, s->data, 16);
|
|
|
|
error = lib_recv(v, s->data, 16);
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rfbEncryptBytes(s->data, v->password);
|
|
|
|
rfbEncryptBytes(s->data, v->password);
|
|
|
|
error = lib_send(v, s->data, 16);
|
|
|
|
error = lib_send(v, s->data, 16);
|
|
|
|
check_sec_result = 1 ; // not needed
|
|
|
|
check_sec_result = 1; // not needed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(i==0)
|
|
|
|
else if (i == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC Server will disconnect");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC Server will disconnect");
|
|
|
|
error = 1;
|
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC unsupported security level");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC unsupported security level");
|
|
|
|
error = 1;
|
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error!=0)
|
|
|
|
if (error!=0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC Error after security negotiation");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC Error after security negotiation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error == 0 && check_sec_result)
|
|
|
|
if (error == 0 && check_sec_result)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* sec result */
|
|
|
|
/* sec result */
|
|
|
|
init_stream(s, 8192);
|
|
|
|
init_stream(s, 8192);
|
|
|
|
error = lib_recv(v, s->data, 4);
|
|
|
|
error = lib_recv(v, s->data, 4);
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
in_uint32_be(s, i);
|
|
|
|
in_uint32_be(s, i);
|
|
|
@ -958,8 +958,8 @@ connections", 0);
|
|
|
|
error = lib_send(v, s->data, 1); /* share flag */
|
|
|
|
error = lib_send(v, s->data, 1); /* share flag */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC error before sending share flag");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC error before sending share flag");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -967,8 +967,8 @@ connections", 0);
|
|
|
|
error = lib_recv(v, s->data, 4); /* server init */
|
|
|
|
error = lib_recv(v, s->data, 4); /* server init */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC error before receiving server init");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC error before receiving server init");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -979,8 +979,8 @@ connections", 0);
|
|
|
|
error = lib_recv(v, pixel_format->data, 16);
|
|
|
|
error = lib_recv(v, pixel_format->data, 16);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC error before receiving pixel format");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC error before receiving pixel format");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -990,8 +990,8 @@ connections", 0);
|
|
|
|
error = lib_recv(v, s->data, 4); /* name len */
|
|
|
|
error = lib_recv(v, s->data, 4); /* name len */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC error before receiving name length");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC error before receiving name length");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1008,9 +1008,9 @@ connections", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC error before receiving name");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC error before receiving name");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* should be connected */
|
|
|
|
/* should be connected */
|
|
|
|
if (error == 0)
|
|
|
|
if (error == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1157,7 +1157,7 @@ connections", 0);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
v->server_msg(v, "VNC error - problem connecting", 0);
|
|
|
|
v->server_msg(v, "VNC error - problem connecting", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return error;
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1268,7 +1268,7 @@ mod_init(void)
|
|
|
|
int EXPORT_CC
|
|
|
|
int EXPORT_CC
|
|
|
|
mod_exit(struct vnc* v)
|
|
|
|
mod_exit(struct vnc* v)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
log_message(LOG_LEVEL_DEBUG,"VNC mod_exit");
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "VNC mod_exit");
|
|
|
|
if (v == 0)
|
|
|
|
if (v == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|