diff --git a/freerdp1/xrdp-freerdp.c b/freerdp1/xrdp-freerdp.c index a309c1c6..45d1a18d 100644 --- a/freerdp1/xrdp-freerdp.c +++ b/freerdp1/xrdp-freerdp.c @@ -87,34 +87,41 @@ lxrdp_connect(struct mod* mod) switch (connectErrorCode) { case PREECONNECTERROR: - snprintf(buf, 128, "The error code from connect is PREECONNECTERROR"); + snprintf(buf, 128, "The error code from connect is " + "PREECONNECTERROR"); break; case UNDEFINEDCONNECTERROR: - snprintf(buf, 128, "The error code from connect is UNDEFINEDCONNECTERROR"); + snprintf(buf, 128, "The error code from connect is " + "UNDEFINEDCONNECTERROR"); break; case POSTCONNECTERROR: - snprintf(buf, 128, "The error code from connect is POSTCONNECTERROR"); + snprintf(buf, 128, "The error code from connect is " + "POSTCONNECTERROR"); break; case DNSERROR: snprintf(buf, 128, "The DNS system generated an error"); break; 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; case CONNECTERROR: snprintf(buf, 128, "A general connect error was returned"); break; case MCSCONNECTINITIALERROR: - snprintf(buf, 128, "The error code from connect is MCSCONNECTINITIALERROR"); + snprintf(buf, 128, "The error code from connect is " + "MCSCONNECTINITIALERROR"); break; case TLSCONNECTERROR: snprintf(buf, 128, "Error in TLS handshake"); break; case AUTHENTICATIONERROR: - snprintf(buf, 128, "Authentication error check your password and username"); + snprintf(buf, 128, "Authentication error check your password " + "and username"); break; default: - snprintf(buf, 128, "Unhandled Errorcode from connect : %d", connectErrorCode); + snprintf(buf, 128, "Unhandled Errorcode from connect : %d", + connectErrorCode); 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", 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 { @@ -766,13 +773,13 @@ lfreerdp_upsidedown(uint8* destination, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_o tui8* src; tui8* dst; int line_bytes; - int j ; - if(destination==NULL) + int j; + + if (destination == NULL) { - LLOGLN(0, ("lfreerdp_upsidedown : destination pointer is NULL !!!")); - return ; + LLOGLN(0, ("lfreerdp_upsidedown: destination pointer is NULL !!!")); + return; } - line_bytes = server_Bpp * cache_bitmap_v2_order->bitmapWidth; src = cache_bitmap_v2_order->bitmapDataStream; dst = destination + ((cache_bitmap_v2_order->bitmapHeight) * line_bytes); @@ -843,11 +850,10 @@ lfreerdp_cache_bitmapV2(rdpContext* context, server_bpp, server_bpp); } else - { - /* Uncompressed bitmaps are upside down */ - lfreerdp_upsidedown(dst_data, cache_bitmap_v2_order,server_Bpp); + { + /* Uncompressed bitmaps are upside down */ + lfreerdp_upsidedown(dst_data, cache_bitmap_v2_order, server_Bpp); 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, width, height, mod->colormap); diff --git a/libxrdp/xrdp_fastpath.c b/libxrdp/xrdp_fastpath.c index 5ce07861..9a147b1b 100644 --- a/libxrdp/xrdp_fastpath.c +++ b/libxrdp/xrdp_fastpath.c @@ -76,7 +76,7 @@ xrdp_fastpath_send_update_pdu(struct xrdp_fastpath* self, tui8 updateCode, compression = 0; 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); for (i = 0; payloadLeft > 0; i++) { @@ -143,7 +143,7 @@ xrdp_fastpath_process_update(struct xrdp_fastpath* self, tui8 updateCode, } return 0; -} +} /*****************************************************************************/ int APP_CC @@ -192,5 +192,5 @@ xrdp_fastpath_process_data(struct xrdp_fastpath* self, struct stream* s, return 1; } in_uint16_le(s, size); - return xrdp_fastpath_process_update(self, updateCode, size, s); + return xrdp_fastpath_process_update(self, updateCode, size, s); } diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 91765749..1abeeca6 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -527,20 +527,20 @@ nil_signal_handler(int sig) /*****************************************************************************/ static int APP_CC -get_display_num_from_display(char * display_text) +get_display_num_from_display(char* display_text) { - int index = 0; - int mode = 0; - int host_index = 0; - int disp_index = 0; - int scre_index = 0; - char host[256] = ""; - char disp[256] = ""; - char scre[256] = ""; - - g_memset(host,0,256); - g_memset(disp,0,256); - g_memset(scre,0,256); + int index; + int mode; + int host_index; + int disp_index; + int scre_index; + char host[256]; + char disp[256]; + char scre[256]; + + g_memset(host, 0, 256); + g_memset(disp, 0, 256); + g_memset(scre, 0, 256); index = 0; host_index = 0; @@ -637,28 +637,32 @@ main(int argc, char** argv) int pid = 0; char text[256] = ""; char* display_text = (char *)NULL; - enum logReturns error ; + enum logReturns error; char cfg_file[256]; g_init("xrdp-chansrv"); /* os_calls */ read_ini(); pid = g_getpid(); - + /* starting logging subsystem */ g_snprintf(cfg_file, 255, "%s/sesman.ini", XRDP_CFG_PATH); error = log_start(cfg_file,"XRDP-Chansrv"); if (error != LOG_STARTUP_OK) { - char buf[256] ; switch (error) { - case LOG_ERROR_MALLOC: - g_printf("error on malloc. cannot start logging. quitting.\n"); + case LOG_ERROR_MALLOC: + g_writeln("error on malloc. cannot start logging. quitting."); break; - case LOG_ERROR_FILE_OPEN: - g_printf("error opening log file [%s]. quitting.\n", getLogFile(buf,255)); + case LOG_ERROR_FILE_OPEN: + g_writeln("error opening log file [%s]. quitting.", + getLogFile(text, 255)); + break; + default: + g_writeln("log_start error"); break; } + g_deinit(); g_exit(1); } log_message(LOG_LEVEL_ALWAYS,"main: app started pid %d(0x%8.8x)", pid, pid); diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index 0afff037..a3e83e5f 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -30,6 +30,7 @@ #include "os_calls.h" #include "chansrv.h" #include "log.h" +#include "clipboard.h" static Atom g_clipboard_atom = 0; static Atom g_clip_property_atom = 0; @@ -101,10 +102,12 @@ static Time APP_CC clipboard_get_server_time(void) { XEvent xevent; + unsigned char no_text[4]; /* append nothing */ + no_text[0] = 0; XChangeProperty(g_display, g_wnd, g_get_time_atom, XA_STRING, 8, - PropModeAppend, "", 0); + PropModeAppend, no_text, 0); /* wait for PropertyNotify */ do { @@ -280,7 +283,6 @@ clipboard_send_data_request(void) struct stream* s; int size; int rv; - int num_chars; log_message(LOG_LEVEL_DEBUG,"clipboard_send_data_request:"); if (!g_got_format_announce) @@ -492,8 +494,6 @@ static int APP_CC clipboard_process_format_announce(struct stream* s, int clip_msg_status, int clip_msg_len) { - Window owner; - log_message(LOG_LEVEL_DEBUG,"clipboard_process_format_announce: CLIPRDR_FORMAT_ANNOUNCE"); //g_hexdump(s->p, s->end - s->p); clipboard_send_format_ack(); @@ -532,13 +532,11 @@ static int APP_CC clipboard_process_data_response(struct stream* s, int clip_msg_status, int clip_msg_len) { - XEvent xev; XSelectionRequestEvent* lxev; twchar* wtext; twchar wchr; int len; int index; - int wtext_size; int data_in_len; log_message(LOG_LEVEL_DEBUG,"clipboard_process_data_response: CLIPRDR_DATA_RESPONSE"); diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index 3d68faff..6a86d97d 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -207,7 +207,6 @@ static int APP_CC sound_process_training(struct stream* s, int size) { int time_diff; - char buf[256]; print_got_here(); @@ -315,7 +314,6 @@ sound_init(void) { char port[256]; int error; - pthread_t thread; print_got_here(); LOG(0, ("sound_init:")); diff --git a/sesman/libscp/libscp_v1s.c b/sesman/libscp/libscp_v1s.c index 6b54a14b..e10af26c 100644 --- a/sesman/libscp/libscp_v1s.c +++ b/sesman/libscp/libscp_v1s.c @@ -46,7 +46,7 @@ enum SCP_SERVER_STATES_E scp_v1s_accept(struct SCP_CONNECTION* c, struct SCP_SES 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); if (version != 1) diff --git a/sesman/scp_v1.c b/sesman/scp_v1.c index d1509224..f93f89ee 100644 --- a/sesman/scp_v1.c +++ b/sesman/scp_v1.c @@ -56,9 +56,11 @@ scp_v1_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s) 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) { @@ -108,7 +110,7 @@ scp_v1_process(struct SCP_CONNECTION* c, struct SCP_SESSION* s) { /* no disconnected sessions - start a new one */ 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) { 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: /* ok, reconnecting... */ 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"); } else { - display=sitem->display; + display = sitem->display; /*e=scp_v1s_reconnect_session(c, sitem, display);*/ e=scp_v1s_reconnect_session(c, display); if (0 != s->client_ip) diff --git a/sesman/session.c b/sesman/session.c index 1557f2da..8acc09c2 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -55,12 +55,12 @@ static int g_sync_result; * @param self * @param outstr, allocate this buffer before you use this function * @param len the allocated len for outstr - * @return - */ + * @return + */ char* APP_CC dumpItemsToString(struct list* self, char *outstr, int len) { - g_memset(outstr,0,len); + g_memset(outstr,0,len); int index; tbus item; int totalLen= 0; @@ -70,15 +70,15 @@ dumpItemsToString(struct list* self, char *outstr, int len) g_writeln("List is empty"); } for (index = 0; index < self->count; index++) - { + { /* +1 = one space*/ totalLen = totalLen + g_strlen((char*)list_get_item(self, index))+1; if(len>totalLen) { g_strcat(outstr,(char*)list_get_item(self, index)); g_strcat(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 */ list_add_item(xserver_params, 0); 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); } else @@ -828,7 +828,7 @@ session_get_byuser(char* user, int* cnt, unsigned char flags) int count; int index; - count=0; + count = 0; /*THREAD-FIX require chain lock */ lock_chain_acquire(); @@ -852,9 +852,9 @@ session_get_byuser(char* user, int* cnt, unsigned char flags) tmp=tmp->next; } - if (count==0) + if (count == 0) { - (*cnt)=0; + (*cnt) = 0; /*THREAD-FIX release chain lock */ lock_chain_release(); return 0; @@ -862,9 +862,9 @@ 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); - if (sess==0) + if (sess == 0) { - (*cnt)=0; + (*cnt) = 0; /*THREAD-FIX release chain lock */ lock_chain_release(); return 0; diff --git a/sesman/thread.c b/sesman/thread.c index 4c266637..98a92533 100644 --- a/sesman/thread.c +++ b/sesman/thread.c @@ -22,7 +22,7 @@ * @file thread.c * @brief thread stuff... * @author Simone Fedele - * + * */ #include "sesman.h" @@ -100,13 +100,13 @@ thread_session_update_start(void) int ret; //starts the session update thread //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) ret = pthread_create(&g_thread_updater, NULL, , ""); pthread_detach(g_thread_updater); - if (ret==0) + if (ret == 0) { log_message(&(g_cfg->log), LOG_LEVEL_INFO, "session update thread started successfully"); return 0; @@ -148,7 +148,7 @@ thread_scp_start(int skt) //ret = pthread_create(&th, NULL, scp_process_start, (void*) (&g_thread_sck)); pthread_detach(th); - if (ret == 0) + if (ret == 0) { log_message(LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt); return 0; @@ -172,4 +172,3 @@ thread_scp_start(int skt) return 1; } - diff --git a/sesman/tools/sestest.c b/sesman/tools/sestest.c index 1ba119e0..c0784ba3 100644 --- a/sesman/tools/sestest.c +++ b/sesman/tools/sestest.c @@ -206,7 +206,7 @@ menuSelect(tui32 choices) ret = scanf("%u", &sel); - while ((ret==0) || (sel > choices)) + while ((ret == 0) || (sel > choices)) { g_printf("invalid choice."); ret = scanf("%u", &sel); diff --git a/sesman/verify_user.c b/sesman/verify_user.c index ffe1c04d..aaa1515c 100644 --- a/sesman/verify_user.c +++ b/sesman/verify_user.c @@ -302,13 +302,13 @@ auth_account_disabled(struct spwd* stp) { int today; - if (0==stp) + if (0 == stp) { /* if an invalid struct was passed we assume a disabled account */ return 1; } - today=g_time1()/SECS_PER_DAY; + today = g_time1() / SECS_PER_DAY; LOG_DBG("last %d",stp->sp_lstchg); LOG_DBG("min %d",stp->sp_min); diff --git a/vnc/vnc.c b/vnc/vnc.c index 12c89a14..fd5ba25f 100644 --- a/vnc/vnc.c +++ b/vnc/vnc.c @@ -64,7 +64,7 @@ lib_recv(struct vnc* v, char* data, int len) } else { - log_message(LOG_LEVEL_DEBUG,"VNC lib_recv return 1"); + log_message(LOG_LEVEL_DEBUG, "VNC lib_recv 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); break; default:{ - log_message(LOG_LEVEL_DEBUG,"VNC clip information unhandled"); + log_message(LOG_LEVEL_DEBUG, "VNC clip information unhandled"); break; } } } 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); } return 0; @@ -387,7 +387,7 @@ get_pixel_safe(char* data, int x, int y, int width, int height, int bpp) } 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; } @@ -442,7 +442,7 @@ set_pixel_safe(char* data, int x, int y, int width, int height, int bpp, } 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 { - 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; } @@ -494,7 +494,7 @@ make_color(int r, int g, int b, int bpp) } 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; } @@ -796,7 +796,7 @@ lib_mod_signal(struct vnc* v) } 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); } else @@ -859,8 +859,8 @@ lib_mod_connect(struct vnc* v) if ((v->server_bpp != 8) && (v->server_bpp != 15) && (v->server_bpp != 16) && (v->server_bpp != 24)) { - v->server_msg(v, "VNC error - only supporting 8, 15, 16 and 24 bpp rdp \ -connections", 0); + v->server_msg(v, "VNC error - only supporting 8, 15, 16 and 24 bpp rdp " + "connections", 0); return 1; } if (g_strcmp(v->ip, "") == 0) @@ -886,7 +886,7 @@ connections", 0); init_stream(s, 8192); error = lib_recv(v, s->data, 12); if (error == 0) - { + { error = lib_send(v, "RFB 003.003\n", 12); } /* sec type */ @@ -909,33 +909,33 @@ connections", 0); init_stream(s, 8192); error = lib_recv(v, s->data, 16); if (error == 0) - { - rfbEncryptBytes(s->data, v->password); - error = lib_send(v, s->data, 16); - check_sec_result = 1 ; // not needed - } + { + rfbEncryptBytes(s->data, v->password); + error = lib_send(v, s->data, 16); + check_sec_result = 1; // not needed + } } - else if(i==0) - { - log_message(LOG_LEVEL_DEBUG,"VNC Server will disconnect"); + else if (i == 0) + { + log_message(LOG_LEVEL_DEBUG, "VNC Server will disconnect"); error = 1; } else - { - log_message(LOG_LEVEL_DEBUG,"VNC unsupported security level"); - error = 1; + { + log_message(LOG_LEVEL_DEBUG, "VNC unsupported security level"); + error = 1; } } } 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) { /* sec result */ - init_stream(s, 8192); - error = lib_recv(v, s->data, 4); + init_stream(s, 8192); + error = lib_recv(v, s->data, 4); if (error == 0) { in_uint32_be(s, i); @@ -958,8 +958,8 @@ connections", 0); error = lib_send(v, s->data, 1); /* share flag */ } 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) { @@ -967,8 +967,8 @@ connections", 0); error = lib_recv(v, s->data, 4); /* server init */ } 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) { @@ -979,8 +979,8 @@ connections", 0); error = lib_recv(v, pixel_format->data, 16); } 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) { @@ -990,8 +990,8 @@ connections", 0); error = lib_recv(v, s->data, 4); /* name len */ } 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) { @@ -1008,9 +1008,9 @@ connections", 0); } } else - { - log_message(LOG_LEVEL_DEBUG,"VNC error before receiving name"); - } + { + log_message(LOG_LEVEL_DEBUG, "VNC error before receiving name"); + } /* should be connected */ if (error == 0) { @@ -1157,7 +1157,7 @@ connections", 0); else { v->server_msg(v, "VNC error - problem connecting", 0); - } + } return error; } @@ -1268,7 +1268,7 @@ mod_init(void) int EXPORT_CC mod_exit(struct vnc* v) { - log_message(LOG_LEVEL_DEBUG,"VNC mod_exit"); + log_message(LOG_LEVEL_DEBUG, "VNC mod_exit"); if (v == 0) { return 0; diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 223b128b..a2edaa14 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -1048,7 +1048,7 @@ xrdp_mm_connect(struct xrdp_mm* self) g_snprintf(errstr, 255, "Failure to connect to: %s port: %s", ip, port); xrdp_wm_log_msg(self->wm, errstr); - rv = 1 ; /* failure */ + rv = 1; /* failure */ } } if (self->wm->login_mode != 10)