no logic changes, remove warnings and coding style changes

master
Jay Sorg 13 years ago
parent 099a421c77
commit 856783ba95

@ -87,34 +87,41 @@ lxrdp_connect(struct mod* mod)
switch (connectErrorCode) switch (connectErrorCode)
{ {
case PREECONNECTERROR: case PREECONNECTERROR:
snprintf(buf, 128, "The error code from connect is PREECONNECTERROR"); snprintf(buf, 128, "The error code from connect is "
"PREECONNECTERROR");
break; break;
case UNDEFINEDCONNECTERROR: case UNDEFINEDCONNECTERROR:
snprintf(buf, 128, "The error code from connect is UNDEFINEDCONNECTERROR"); snprintf(buf, 128, "The error code from connect is "
"UNDEFINEDCONNECTERROR");
break; break;
case POSTCONNECTERROR: case POSTCONNECTERROR:
snprintf(buf, 128, "The error code from connect is POSTCONNECTERROR"); snprintf(buf, 128, "The error code from connect is "
"POSTCONNECTERROR");
break; break;
case DNSERROR: case DNSERROR:
snprintf(buf, 128, "The DNS system generated an error"); snprintf(buf, 128, "The DNS system generated an error");
break; break;
case DNSNAMENOTFOUND: case DNSNAMENOTFOUND:
snprintf(buf, 128, "The DNS system could not find the specified name"); snprintf(buf, 128, "The DNS system could not find the "
"specified name");
break; break;
case CONNECTERROR: case CONNECTERROR:
snprintf(buf, 128, "A general connect error was returned"); snprintf(buf, 128, "A general connect error was returned");
break; break;
case MCSCONNECTINITIALERROR: case MCSCONNECTINITIALERROR:
snprintf(buf, 128, "The error code from connect is MCSCONNECTINITIALERROR"); snprintf(buf, 128, "The error code from connect is "
"MCSCONNECTINITIALERROR");
break; break;
case TLSCONNECTERROR: case TLSCONNECTERROR:
snprintf(buf, 128, "Error in TLS handshake"); snprintf(buf, 128, "Error in TLS handshake");
break; break;
case AUTHENTICATIONERROR: case AUTHENTICATIONERROR:
snprintf(buf, 128, "Authentication error check your password and username"); snprintf(buf, 128, "Authentication error check your password "
"and username");
break; break;
default: default:
snprintf(buf, 128, "Unhandled Errorcode from connect : %d", connectErrorCode); snprintf(buf, 128, "Unhandled Errorcode from connect : %d",
connectErrorCode);
break; break;
} }
} }
@ -233,7 +240,7 @@ lxrdp_event(struct mod* mod, int msg, long param1, long param2,
{ {
LLOGLN(0, ("update rectangle left: %d top: %d bottom: %d right: %d", LLOGLN(0, ("update rectangle left: %d top: %d bottom: %d right: %d",
rectangle->left, rectangle->top, rectangle->bottom, rectangle->right)); rectangle->left, rectangle->top, rectangle->bottom, rectangle->right));
mod->inst->update->RefreshRect(mod->inst->context, 1, rectangle); mod->inst->update->RefreshRect(mod->inst->context, 1, rectangle);
} }
else else
{ {
@ -766,13 +773,13 @@ lfreerdp_upsidedown(uint8* destination, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_o
tui8* src; tui8* src;
tui8* dst; tui8* dst;
int line_bytes; int line_bytes;
int j ; int j;
if(destination==NULL)
if (destination == NULL)
{ {
LLOGLN(0, ("lfreerdp_upsidedown : destination pointer is NULL !!!")); LLOGLN(0, ("lfreerdp_upsidedown: destination pointer is NULL !!!"));
return ; return;
} }
line_bytes = server_Bpp * cache_bitmap_v2_order->bitmapWidth; line_bytes = server_Bpp * cache_bitmap_v2_order->bitmapWidth;
src = cache_bitmap_v2_order->bitmapDataStream; src = cache_bitmap_v2_order->bitmapDataStream;
dst = destination + ((cache_bitmap_v2_order->bitmapHeight) * line_bytes); dst = destination + ((cache_bitmap_v2_order->bitmapHeight) * line_bytes);
@ -843,11 +850,10 @@ lfreerdp_cache_bitmapV2(rdpContext* context,
server_bpp, server_bpp); server_bpp, server_bpp);
} }
else else
{ {
/* Uncompressed bitmaps are upside down */ /* Uncompressed bitmaps are upside down */
lfreerdp_upsidedown(dst_data, cache_bitmap_v2_order,server_Bpp); lfreerdp_upsidedown(dst_data, cache_bitmap_v2_order, server_Bpp);
LLOGLN(10, ("lfreerdp_cache_bitmapV2: upside down progressed")); LLOGLN(10, ("lfreerdp_cache_bitmapV2: upside down progressed"));
/* old: g_memcpy(dst_data, cache_bitmap_v2_order->bitmapDataStream,width * height * server_Bpp);*/
} }
dst_data1 = convert_bitmap(server_bpp, client_bpp, dst_data, dst_data1 = convert_bitmap(server_bpp, client_bpp, dst_data,
width, height, mod->colormap); width, height, mod->colormap);

@ -76,7 +76,7 @@ xrdp_fastpath_send_update_pdu(struct xrdp_fastpath* self, tui8 updateCode,
compression = 0; compression = 0;
s_send = self->out_s; s_send = self->out_s;
maxLen = FASTPATH_MAX_PACKET_SIZE - 6 ; /* 6 bytes for header */ maxLen = FASTPATH_MAX_PACKET_SIZE - 6; /* 6 bytes for header */
payloadLeft = (s->end - s->data); payloadLeft = (s->end - s->data);
for (i = 0; payloadLeft > 0; i++) for (i = 0; payloadLeft > 0; i++)
{ {
@ -143,7 +143,7 @@ xrdp_fastpath_process_update(struct xrdp_fastpath* self, tui8 updateCode,
} }
return 0; return 0;
} }
/*****************************************************************************/ /*****************************************************************************/
int APP_CC int APP_CC
@ -192,5 +192,5 @@ xrdp_fastpath_process_data(struct xrdp_fastpath* self, struct stream* s,
return 1; return 1;
} }
in_uint16_le(s, size); in_uint16_le(s, size);
return xrdp_fastpath_process_update(self, updateCode, size, s); return xrdp_fastpath_process_update(self, updateCode, size, s);
} }

@ -527,20 +527,20 @@ nil_signal_handler(int sig)
/*****************************************************************************/ /*****************************************************************************/
static int APP_CC static int APP_CC
get_display_num_from_display(char * display_text) get_display_num_from_display(char* display_text)
{ {
int index = 0; int index;
int mode = 0; int mode;
int host_index = 0; int host_index;
int disp_index = 0; int disp_index;
int scre_index = 0; int scre_index;
char host[256] = ""; char host[256];
char disp[256] = ""; char disp[256];
char scre[256] = ""; char scre[256];
g_memset(host,0,256); g_memset(host, 0, 256);
g_memset(disp,0,256); g_memset(disp, 0, 256);
g_memset(scre,0,256); g_memset(scre, 0, 256);
index = 0; index = 0;
host_index = 0; host_index = 0;
@ -637,28 +637,32 @@ main(int argc, char** argv)
int pid = 0; int pid = 0;
char text[256] = ""; char text[256] = "";
char* display_text = (char *)NULL; char* display_text = (char *)NULL;
enum logReturns error ; enum logReturns error;
char cfg_file[256]; char cfg_file[256];
g_init("xrdp-chansrv"); /* os_calls */ g_init("xrdp-chansrv"); /* os_calls */
read_ini(); read_ini();
pid = g_getpid(); pid = g_getpid();
/* starting logging subsystem */ /* starting logging subsystem */
g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH); g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH);
error = log_start(cfg_file,"XRDP-Chansrv"); error = log_start(cfg_file,"XRDP-Chansrv");
if (error != LOG_STARTUP_OK) if (error != LOG_STARTUP_OK)
{ {
char buf[256] ;
switch (error) switch (error)
{ {
case LOG_ERROR_MALLOC: case LOG_ERROR_MALLOC:
g_printf("error on malloc. cannot start logging. quitting.\n"); g_writeln("error on malloc. cannot start logging. quitting.");
break; break;
case LOG_ERROR_FILE_OPEN: case LOG_ERROR_FILE_OPEN:
g_printf("error opening log file [%s]. quitting.\n", getLogFile(buf,255)); g_writeln("error opening log file [%s]. quitting.",
getLogFile(text, 255));
break;
default:
g_writeln("log_start error");
break; break;
} }
g_deinit();
g_exit(1); g_exit(1);
} }
log_message(LOG_LEVEL_ALWAYS,"main: app started pid %d(0x%8.8x)", pid, pid); log_message(LOG_LEVEL_ALWAYS,"main: app started pid %d(0x%8.8x)", pid, pid);

@ -30,6 +30,7 @@
#include "os_calls.h" #include "os_calls.h"
#include "chansrv.h" #include "chansrv.h"
#include "log.h" #include "log.h"
#include "clipboard.h"
static Atom g_clipboard_atom = 0; static Atom g_clipboard_atom = 0;
static Atom g_clip_property_atom = 0; static Atom g_clip_property_atom = 0;
@ -101,10 +102,12 @@ static Time APP_CC
clipboard_get_server_time(void) clipboard_get_server_time(void)
{ {
XEvent xevent; XEvent xevent;
unsigned char no_text[4];
/* append nothing */ /* append nothing */
no_text[0] = 0;
XChangeProperty(g_display, g_wnd, g_get_time_atom, XA_STRING, 8, XChangeProperty(g_display, g_wnd, g_get_time_atom, XA_STRING, 8,
PropModeAppend, "", 0); PropModeAppend, no_text, 0);
/* wait for PropertyNotify */ /* wait for PropertyNotify */
do do
{ {
@ -280,7 +283,6 @@ clipboard_send_data_request(void)
struct stream* s; struct stream* s;
int size; int size;
int rv; int rv;
int num_chars;
log_message(LOG_LEVEL_DEBUG,"clipboard_send_data_request:"); log_message(LOG_LEVEL_DEBUG,"clipboard_send_data_request:");
if (!g_got_format_announce) if (!g_got_format_announce)
@ -492,8 +494,6 @@ static int APP_CC
clipboard_process_format_announce(struct stream* s, int clip_msg_status, clipboard_process_format_announce(struct stream* s, int clip_msg_status,
int clip_msg_len) int clip_msg_len)
{ {
Window owner;
log_message(LOG_LEVEL_DEBUG,"clipboard_process_format_announce: CLIPRDR_FORMAT_ANNOUNCE"); log_message(LOG_LEVEL_DEBUG,"clipboard_process_format_announce: CLIPRDR_FORMAT_ANNOUNCE");
//g_hexdump(s->p, s->end - s->p); //g_hexdump(s->p, s->end - s->p);
clipboard_send_format_ack(); clipboard_send_format_ack();
@ -532,13 +532,11 @@ static int APP_CC
clipboard_process_data_response(struct stream* s, int clip_msg_status, clipboard_process_data_response(struct stream* s, int clip_msg_status,
int clip_msg_len) int clip_msg_len)
{ {
XEvent xev;
XSelectionRequestEvent* lxev; XSelectionRequestEvent* lxev;
twchar* wtext; twchar* wtext;
twchar wchr; twchar wchr;
int len; int len;
int index; int index;
int wtext_size;
int data_in_len; int data_in_len;
log_message(LOG_LEVEL_DEBUG,"clipboard_process_data_response: CLIPRDR_DATA_RESPONSE"); log_message(LOG_LEVEL_DEBUG,"clipboard_process_data_response: CLIPRDR_DATA_RESPONSE");

@ -207,7 +207,6 @@ static int APP_CC
sound_process_training(struct stream* s, int size) sound_process_training(struct stream* s, int size)
{ {
int time_diff; int time_diff;
char buf[256];
print_got_here(); print_got_here();
@ -315,7 +314,6 @@ sound_init(void)
{ {
char port[256]; char port[256];
int error; int error;
pthread_t thread;
print_got_here(); print_got_here();
LOG(0, ("sound_init:")); LOG(0, ("sound_init:"));

@ -46,7 +46,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION* c, struct SCP_SES
if (!skipVchk) if (!skipVchk)
{ {
if (0==scp_tcp_force_recv(c->in_sck, c->in_s->data, 8)) if (0 == scp_tcp_force_recv(c->in_sck, c->in_s->data, 8))
{ {
in_uint32_be(c->in_s, version); in_uint32_be(c->in_s, version);
if (version != 1) if (version != 1)

@ -56,9 +56,11 @@ scp_v1_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s)
while ((!data) && ((retries == 0) || (current_try > 0))) while ((!data) && ((retries == 0) || (current_try > 0)))
{ {
LOG_DBG("data %d - retry %d - currenttry %d - expr %d", data, retries, current_try, ((!data) && ((retries==0) || (current_try>0)))); LOG_DBG("data %d - retry %d - currenttry %d - expr %d",
data, retries, current_try,
((!data) && ((retries == 0) || (current_try > 0))));
e=scp_v1s_request_password(c,s,"Wrong username and/or password"); e = scp_v1s_request_password(c, s, "Wrong username and/or password");
switch (e) switch (e)
{ {
@ -108,7 +110,7 @@ scp_v1_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s)
{ {
/* no disconnected sessions - start a new one */ /* no disconnected sessions - start a new one */
log_message(LOG_LEVEL_DEBUG,"No disconnected sessions for this user" log_message(LOG_LEVEL_DEBUG,"No disconnected sessions for this user"
"- we create a new one"); "- we create a new one");
if (0 != s->client_ip) if (0 != s->client_ip)
{ {
log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s, ip %s", s->username, s->client_ip); log_message(LOG_LEVEL_INFO, "++ created session (access granted): username %s, ip %s", s->username, s->client_ip);
@ -159,14 +161,14 @@ scp_v1_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s)
case SCP_SERVER_STATE_OK: case SCP_SERVER_STATE_OK:
/* ok, reconnecting... */ /* ok, reconnecting... */
sitem=session_get_bypid(sid); sitem=session_get_bypid(sid);
if (0==sitem) if (0 == sitem)
{ {
e=scp_v1s_connection_error(c, "Internal error"); e = scp_v1s_connection_error(c, "Internal error");
log_message(LOG_LEVEL_INFO, "Cannot find session item on the chain"); log_message(LOG_LEVEL_INFO, "Cannot find session item on the chain");
} }
else else
{ {
display=sitem->display; display = sitem->display;
/*e=scp_v1s_reconnect_session(c, sitem, display);*/ /*e=scp_v1s_reconnect_session(c, sitem, display);*/
e=scp_v1s_reconnect_session(c, display); e=scp_v1s_reconnect_session(c, display);
if (0 != s->client_ip) if (0 != s->client_ip)

@ -55,12 +55,12 @@ static int g_sync_result;
* @param self * @param self
* @param outstr, allocate this buffer before you use this function * @param outstr, allocate this buffer before you use this function
* @param len the allocated len for outstr * @param len the allocated len for outstr
* @return * @return
*/ */
char* APP_CC char* APP_CC
dumpItemsToString(struct list* self, char *outstr, int len) dumpItemsToString(struct list* self, char *outstr, int len)
{ {
g_memset(outstr,0,len); g_memset(outstr,0,len);
int index; int index;
tbus item; tbus item;
int totalLen= 0; int totalLen= 0;
@ -70,15 +70,15 @@ dumpItemsToString(struct list* self, char *outstr, int len)
g_writeln("List is empty"); g_writeln("List is empty");
} }
for (index = 0; index < self->count; index++) for (index = 0; index < self->count; index++)
{ {
/* +1 = one space*/ /* +1 = one space*/
totalLen = totalLen + g_strlen((char*)list_get_item(self, index))+1; totalLen = totalLen + g_strlen((char*)list_get_item(self, index))+1;
if(len>totalLen) if(len>totalLen)
{ {
g_strcat(outstr,(char*)list_get_item(self, index)); g_strcat(outstr,(char*)list_get_item(self, index));
g_strcat(outstr," "); g_strcat(outstr," ");
} }
} }
return outstr ; return outstr ;
} }
@ -556,7 +556,7 @@ session_start_fork(int width, int height, int bpp, char* username,
/* make sure it ends with a zero */ /* make sure it ends with a zero */
list_add_item(xserver_params, 0); list_add_item(xserver_params, 0);
pp1 = (char**)xserver_params->items; pp1 = (char**)xserver_params->items;
log_message(LOG_LEVEL_INFO,"X11rdp start:%s",dumpItemsToString(xserver_params, execvpparams, 2048)); log_message(LOG_LEVEL_INFO,"X11rdp start:%s",dumpItemsToString(xserver_params, execvpparams, 2048));
g_execvp("X11rdp", pp1); g_execvp("X11rdp", pp1);
} }
else else
@ -828,7 +828,7 @@ session_get_byuser(char* user, int* cnt, unsigned char flags)
int count; int count;
int index; int index;
count=0; count = 0;
/*THREAD-FIX require chain lock */ /*THREAD-FIX require chain lock */
lock_chain_acquire(); lock_chain_acquire();
@ -852,9 +852,9 @@ session_get_byuser(char* user, int* cnt, unsigned char flags)
tmp=tmp->next; tmp=tmp->next;
} }
if (count==0) if (count == 0)
{ {
(*cnt)=0; (*cnt) = 0;
/*THREAD-FIX release chain lock */ /*THREAD-FIX release chain lock */
lock_chain_release(); lock_chain_release();
return 0; return 0;
@ -862,9 +862,9 @@ session_get_byuser(char* user, int* cnt, unsigned char flags)
/* malloc() an array of disconnected sessions */ /* malloc() an array of disconnected sessions */
sess=g_malloc(count * sizeof(struct SCP_DISCONNECTED_SESSION),1); sess=g_malloc(count * sizeof(struct SCP_DISCONNECTED_SESSION),1);
if (sess==0) if (sess == 0)
{ {
(*cnt)=0; (*cnt) = 0;
/*THREAD-FIX release chain lock */ /*THREAD-FIX release chain lock */
lock_chain_release(); lock_chain_release();
return 0; return 0;

@ -22,7 +22,7 @@
* @file thread.c * @file thread.c
* @brief thread stuff... * @brief thread stuff...
* @author Simone Fedele * @author Simone Fedele
* *
*/ */
#include "sesman.h" #include "sesman.h"
@ -100,13 +100,13 @@ thread_session_update_start(void)
int ret; int ret;
//starts the session update thread //starts the session update thread
//that checks for idle time, destroys sessions, ecc... //that checks for idle time, destroys sessions, ecc...
#warning this thread should always request lock_fork before read or write #warning this thread should always request lock_fork before read or write
#warning (so we can Fork() In Peace) #warning (so we can Fork() In Peace)
ret = pthread_create(&g_thread_updater, NULL, , ""); ret = pthread_create(&g_thread_updater, NULL, , "");
pthread_detach(g_thread_updater); pthread_detach(g_thread_updater);
if (ret==0) if (ret == 0)
{ {
log_message(&(g_cfg->log), LOG_LEVEL_INFO, "session update thread started successfully"); log_message(&(g_cfg->log), LOG_LEVEL_INFO, "session update thread started successfully");
return 0; return 0;
@ -148,7 +148,7 @@ thread_scp_start(int skt)
//ret = pthread_create(&th, NULL, scp_process_start, (void*) (&g_thread_sck)); //ret = pthread_create(&th, NULL, scp_process_start, (void*) (&g_thread_sck));
pthread_detach(th); pthread_detach(th);
if (ret == 0) if (ret == 0)
{ {
log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt); log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt);
return 0; return 0;
@ -172,4 +172,3 @@ thread_scp_start(int skt)
return 1; return 1;
} }

@ -206,7 +206,7 @@ menuSelect(tui32 choices)
ret = scanf("%u", &sel); ret = scanf("%u", &sel);
while ((ret==0) || (sel > choices)) while ((ret == 0) || (sel > choices))
{ {
g_printf("invalid choice."); g_printf("invalid choice.");
ret = scanf("%u", &sel); ret = scanf("%u", &sel);

@ -302,13 +302,13 @@ auth_account_disabled(struct spwd* stp)
{ {
int today; int today;
if (0==stp) if (0 == stp)
{ {
/* if an invalid struct was passed we assume a disabled account */ /* if an invalid struct was passed we assume a disabled account */
return 1; return 1;
} }
today=g_time1()/SECS_PER_DAY; today = g_time1() / SECS_PER_DAY;
LOG_DBG("last %d",stp->sp_lstchg); LOG_DBG("last %d",stp->sp_lstchg);
LOG_DBG("min %d",stp->sp_min); LOG_DBG("min %d",stp->sp_min);

@ -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;

@ -1048,7 +1048,7 @@ xrdp_mm_connect(struct xrdp_mm* self)
g_snprintf(errstr, 255, "Failure to connect to: %s port: %s", g_snprintf(errstr, 255, "Failure to connect to: %s port: %s",
ip, port); ip, port);
xrdp_wm_log_msg(self->wm, errstr); xrdp_wm_log_msg(self->wm, errstr);
rv = 1 ; /* failure */ rv = 1; /* failure */
} }
} }
if (self->wm->login_mode != 10) if (self->wm->login_mode != 10)

Loading…
Cancel
Save