summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-06-10 23:47:08 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-06-10 23:47:08 -0700
commit856783ba95e46561ee1776a22b03900e7f0e7286 (patch)
tree36b1b5a054707b3db3b446fbd13401cf78793f3f /sesman
parent099a421c7706ea5d7706890d7a3f12a4ccf7c126 (diff)
downloadxrdp-proprietary-856783ba95e46561ee1776a22b03900e7f0e7286.tar.gz
xrdp-proprietary-856783ba95e46561ee1776a22b03900e7f0e7286.zip
no logic changes, remove warnings and coding style changes
Diffstat (limited to 'sesman')
-rw-r--r--sesman/chansrv/chansrv.c44
-rw-r--r--sesman/chansrv/clipboard.c10
-rw-r--r--sesman/chansrv/sound.c2
-rw-r--r--sesman/libscp/libscp_v1s.c2
-rw-r--r--sesman/scp_v1.c14
-rw-r--r--sesman/session.c24
-rw-r--r--sesman/thread.c11
-rw-r--r--sesman/tools/sestest.c2
-rw-r--r--sesman/verify_user.c4
9 files changed, 57 insertions, 56 deletions
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);