summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2009-09-28 01:16:07 +0000
committerjsorg71 <jsorg71>2009-09-28 01:16:07 +0000
commit328649af9b9d64ab6f95734fbccd7fa2b31420e5 (patch)
treed175c32681bb343f9a463fff54b9dd726abeecd7
parenta673a075bd5e99ce9d1ff7e505d0ccfb880429ba (diff)
downloadxrdp-proprietary-328649af9b9d64ab6f95734fbccd7fa2b31420e5.tar.gz
xrdp-proprietary-328649af9b9d64ab6f95734fbccd7fa2b31420e5.zip
g_thread_sck set outside of lock fix and g_cfg should always be a pointer to a struct
-rw-r--r--sesman/access.c2
-rw-r--r--sesman/config.c2
-rw-r--r--sesman/env.c2
-rw-r--r--sesman/lock.c2
-rw-r--r--sesman/scp.c22
-rw-r--r--sesman/scp_v0.c2
-rw-r--r--sesman/scp_v1.c2
-rw-r--r--sesman/scp_v1_mng.c2
-rw-r--r--sesman/sesman.c3
-rw-r--r--sesman/session.c2
-rw-r--r--sesman/sig.c2
-rw-r--r--sesman/thread.c34
-rw-r--r--sesman/verify_user.c18
13 files changed, 47 insertions, 48 deletions
diff --git a/sesman/access.c b/sesman/access.c
index 5e22b785..d84e9330 100644
--- a/sesman/access.c
+++ b/sesman/access.c
@@ -27,7 +27,7 @@
#include "sesman.h"
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
/******************************************************************************/
int DEFAULT_CC
diff --git a/sesman/config.c b/sesman/config.c
index d24661e3..102d58e1 100644
--- a/sesman/config.c
+++ b/sesman/config.c
@@ -30,7 +30,7 @@
#include "file.h"
#include "sesman.h"
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
/******************************************************************************/
/**
diff --git a/sesman/env.c b/sesman/env.c
index d9c35dba..8c680ce5 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -31,7 +31,7 @@
#include "grp.h"
extern unsigned char g_fixedkey[8]; /* in sesman.c */
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
/******************************************************************************/
int DEFAULT_CC
diff --git a/sesman/lock.c b/sesman/lock.c
index eb1abe81..da513172 100644
--- a/sesman/lock.c
+++ b/sesman/lock.c
@@ -23,7 +23,7 @@
#include "sesman.h"
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
static tbus g_sync_mutex = 0;
static tbus g_lock_chain = 0;
diff --git a/sesman/scp.c b/sesman/scp.c
index d26b254b..439c046c 100644
--- a/sesman/scp.c
+++ b/sesman/scp.c
@@ -31,7 +31,7 @@
#include "sesman.h"
extern int g_thread_sck; /* in thread.c */
-extern struct config_sesman g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
/******************************************************************************/
void* DEFAULT_CC
@@ -43,7 +43,7 @@ scp_process_start(void* sck)
/* making a local copy of the socket (it's on the stack) */
/* probably this is just paranoia */
scon.in_sck = g_thread_sck;
- LOG_DBG(&(g_cfg.log), "started scp thread on socket %d", scon.in_sck);
+ LOG_DBG(&(g_cfg->log), "started scp thread on socket %d", scon.in_sck);
/* unlocking g_thread_sck */
lock_socket_release();
@@ -60,40 +60,40 @@ scp_process_start(void* sck)
if (sdata->version == 0)
{
/* starts processing an scp v0 connection */
- LOG_DBG(&(g_cfg.log), "accept ok, go on with scp v0\n",0);
+ LOG_DBG(&(g_cfg->log), "accept ok, go on with scp v0\n",0);
scp_v0_process(&scon, sdata);
}
else
{
- LOG_DBG(&(g_cfg.log), "accept ok, go on with scp v1\n",0);
- /*LOG_DBG(&(g_cfg.log), "user: %s\npass: %s",sdata->username, sdata->password);*/
+ LOG_DBG(&(g_cfg->log), "accept ok, go on with scp v1\n",0);
+ /*LOG_DBG(&(g_cfg->log), "user: %s\npass: %s",sdata->username, sdata->password);*/
scp_v1_process(&scon, sdata);
}
break;
case SCP_SERVER_STATE_START_MANAGE:
/* starting a management session */
- log_message(&(g_cfg.log), LOG_LEVEL_WARNING,
+ log_message(&(g_cfg->log), LOG_LEVEL_WARNING,
"starting a sesman management session...");
scp_v1_mng_process(&scon, sdata);
break;
case SCP_SERVER_STATE_VERSION_ERR:
/* an unknown scp version was requested, so we shut down the */
/* connection (and log the fact) */
- log_message(&(g_cfg.log), LOG_LEVEL_WARNING,
+ log_message(&(g_cfg->log), LOG_LEVEL_WARNING,
"unknown protocol version specified. connection refused.");
break;
case SCP_SERVER_STATE_NETWORK_ERR:
- log_message(&(g_cfg.log), LOG_LEVEL_WARNING, "libscp network error.");
+ log_message(&(g_cfg->log), LOG_LEVEL_WARNING, "libscp network error.");
break;
case SCP_SERVER_STATE_SEQUENCE_ERR:
- log_message(&(g_cfg.log), LOG_LEVEL_WARNING, "libscp sequence error.");
+ log_message(&(g_cfg->log), LOG_LEVEL_WARNING, "libscp sequence error.");
break;
case SCP_SERVER_STATE_INTERNAL_ERR:
/* internal error occurred (eg. malloc() error, ecc.) */
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "libscp internal error occurred.");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "libscp internal error occurred.");
break;
default:
- log_message(&(g_cfg.log), LOG_LEVEL_ALWAYS, "unknown return from scp_vXs_accept()");
+ log_message(&(g_cfg->log), LOG_LEVEL_ALWAYS, "unknown return from scp_vXs_accept()");
}
g_tcp_close(scon.in_sck);
free_stream(scon.in_s);
diff --git a/sesman/scp_v0.c b/sesman/scp_v0.c
index 5bc97113..af84f80a 100644
--- a/sesman/scp_v0.c
+++ b/sesman/scp_v0.c
@@ -27,7 +27,7 @@
#include "sesman.h"
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
/******************************************************************************/
void DEFAULT_CC
diff --git a/sesman/scp_v1.c b/sesman/scp_v1.c
index fd7eb275..4f3a6b38 100644
--- a/sesman/scp_v1.c
+++ b/sesman/scp_v1.c
@@ -30,7 +30,7 @@
//#include "libscp_types.h"
#include "libscp.h"
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char* f);
diff --git a/sesman/scp_v1_mng.c b/sesman/scp_v1_mng.c
index 36ff8507..636fac94 100644
--- a/sesman/scp_v1_mng.c
+++ b/sesman/scp_v1_mng.c
@@ -29,7 +29,7 @@
#include "libscp.h"
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
static void parseCommonStates(enum SCP_SERVER_STATES_E e, char* f);
diff --git a/sesman/sesman.c b/sesman/sesman.c
index 27ad10fb..7ef5d902 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -30,7 +30,7 @@
int g_sck;
int g_pid;
unsigned char g_fixedkey[8] = { 23, 82, 107, 6, 35, 78, 88, 7 };
-struct config_sesman* g_cfg; /* config.h */
+struct config_sesman* g_cfg; /* defined in config.h */
tbus g_term_event = 0;
tbus g_sync_event = 0;
@@ -104,7 +104,6 @@ sesman_main_loop(void)
{
/* we've got a connection, so we pass it to scp code */
LOG_DBG(&(g_cfg->log), "new connection");
- g_thread_sck = in_sck;
thread_scp_start(in_sck);
/* todo, do we have to wait here ? */
}
diff --git a/sesman/session.c b/sesman/session.c
index 474b28e2..aee2af3d 100644
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -33,7 +33,7 @@
extern tbus g_sync_event;
extern unsigned char g_fixedkey[8];
-extern struct config_sesman* g_cfg; /* config.h */
+extern struct config_sesman* g_cfg; /* in sesman.c */
struct session_chain* g_sessions;
int g_session_count;
diff --git a/sesman/sig.c b/sesman/sig.c
index 6df57cc1..acea2429 100644
--- a/sesman/sig.c
+++ b/sesman/sig.c
@@ -31,7 +31,7 @@
extern int g_sck;
extern int g_pid;
-extern struct config_sesman* g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
extern tbus g_term_event;
/******************************************************************************/
diff --git a/sesman/thread.c b/sesman/thread.c
index bac6182f..8d7f1a9d 100644
--- a/sesman/thread.c
+++ b/sesman/thread.c
@@ -31,7 +31,7 @@
#include <signal.h>
#include <pthread.h>
-extern struct config_sesman g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
static pthread_t g_thread_sighandler;
//static pthread_t g_thread_updater;
@@ -62,14 +62,14 @@ thread_sighandler_start(void)
sigaddset(&waitmask, SIGFPE);
pthread_sigmask(SIG_UNBLOCK, &waitmask, NULL);
- log_message(&(g_cfg.log), LOG_LEVEL_INFO,"starting signal handling thread...");
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO,"starting signal handling thread...");
ret = pthread_create(&g_thread_sighandler, NULL, sig_handler_thread, "");
pthread_detach(g_thread_sighandler);
if (ret == 0)
{
- log_message(&(g_cfg.log), LOG_LEVEL_INFO, "signal handler thread started successfully");
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO, "signal handler thread started successfully");
return 0;
}
@@ -77,16 +77,16 @@ thread_sighandler_start(void)
switch (ret)
{
case EINVAL:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid attributes for signal handling thread (creation returned EINVAL)");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "invalid attributes for signal handling thread (creation returned EINVAL)");
break;
case EAGAIN:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "not enough resources to start signal handling thread (creation returned EAGAIN)");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "not enough resources to start signal handling thread (creation returned EAGAIN)");
break;
case EPERM:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid permissions for signal handling thread (creation returned EPERM)");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "invalid permissions for signal handling thread (creation returned EPERM)");
break;
default:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "unknown error starting signal handling thread");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "unknown error starting signal handling thread");
}
return 1;
@@ -108,7 +108,7 @@ thread_session_update_start(void)
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;
}
@@ -116,16 +116,16 @@ thread_session_update_start(void)
switch (ret)
{
case EINVAL:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid attributes for session update thread (creation returned EINVAL)");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "invalid attributes for session update thread (creation returned EINVAL)");
break;
case EAGAIN:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "not enough resources to start session update thread (creation returned EAGAIN)");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "not enough resources to start session update thread (creation returned EAGAIN)");
break;
case EPERM:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid permissions for session update thread (creation returned EPERM)");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "invalid permissions for session update thread (creation returned EPERM)");
break;
default:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "unknown error starting session update thread");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "unknown error starting session update thread");
}
return 1;
@@ -150,7 +150,7 @@ thread_scp_start(int skt)
if (ret == 0)
{
- log_message(&(g_cfg.log), LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt);
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO, "scp thread on sck %d started successfully", skt);
return 0;
}
@@ -158,16 +158,16 @@ thread_scp_start(int skt)
switch (ret)
{
case EINVAL:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid attributes for scp thread on sck %d (creation returned EINVAL)", skt);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "invalid attributes for scp thread on sck %d (creation returned EINVAL)", skt);
break;
case EAGAIN:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "not enough resources to start scp thread on sck %d (creation returned EAGAIN)", skt);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "not enough resources to start scp thread on sck %d (creation returned EAGAIN)", skt);
break;
case EPERM:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "invalid permissions for scp thread on sck %d (creation returned EPERM)", skt);
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "invalid permissions for scp thread on sck %d (creation returned EPERM)", skt);
break;
default:
- log_message(&(g_cfg.log), LOG_LEVEL_ERROR, "unknown error starting scp thread on sck %d");
+ log_message(&(g_cfg->log), LOG_LEVEL_ERROR, "unknown error starting scp thread on sck %d");
}
return 1;
diff --git a/sesman/verify_user.c b/sesman/verify_user.c
index 18980aaf..cdc60b47 100644
--- a/sesman/verify_user.c
+++ b/sesman/verify_user.c
@@ -38,7 +38,7 @@
#define SECS_PER_DAY (24L*3600L)
#endif
-extern struct config_sesman g_cfg;
+extern struct config_sesman* g_cfg; /* in sesman.c */
static int DEFAULT_CC
auth_crypt_pwd(char* pwd, char* pln, char* crp);
@@ -73,7 +73,7 @@ auth_userpass(char* user, char* pass)
}
if (1==auth_account_disabled(stp))
{
- log_message(&(g_cfg.log), LOG_LEVEL_INFO, "account %s is disabled", user);
+ log_message(&(g_cfg->log), LOG_LEVEL_INFO, "account %s is disabled", user);
return 0;
}
g_strncpy(hash, stp->sp_pwdp, 34);
@@ -310,13 +310,13 @@ auth_account_disabled(struct spwd* stp)
today=g_time1()/SECS_PER_DAY;
- LOG_DBG(&(g_cfg.log), "last %d",stp->sp_lstchg);
- LOG_DBG(&(g_cfg.log), "min %d",stp->sp_min);
- LOG_DBG(&(g_cfg.log), "max %d",stp->sp_max);
- LOG_DBG(&(g_cfg.log), "inact %d",stp->sp_inact);
- LOG_DBG(&(g_cfg.log), "warn %d",stp->sp_warn);
- LOG_DBG(&(g_cfg.log), "expire %d",stp->sp_expire);
- LOG_DBG(&(g_cfg.log), "today %d",today);
+ LOG_DBG(&(g_cfg->log), "last %d",stp->sp_lstchg);
+ LOG_DBG(&(g_cfg->log), "min %d",stp->sp_min);
+ LOG_DBG(&(g_cfg->log), "max %d",stp->sp_max);
+ LOG_DBG(&(g_cfg->log), "inact %d",stp->sp_inact);
+ LOG_DBG(&(g_cfg->log), "warn %d",stp->sp_warn);
+ LOG_DBG(&(g_cfg->log), "expire %d",stp->sp_expire);
+ LOG_DBG(&(g_cfg->log), "today %d",today);
if ((stp->sp_expire != -1) && (today >= stp->sp_expire))
{