summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2013-08-25 18:02:36 -0700
committerLaxmikant Rashinkar <LK.Rashinkar@gmail.com>2013-08-25 18:02:36 -0700
commit829c494fb9b62c68d1079251ca1c97de84c09c70 (patch)
treeafd76b7fd9cf58b1760cb9bf0b4b85776bcab221 /common
parentf8f648c57432a3238a17dc70909947a30ccaebae (diff)
parent1a616a1b469a00279ac6d42cffcd2b23da492c60 (diff)
downloadxrdp-proprietary-829c494fb9b62c68d1079251ca1c97de84c09c70.tar.gz
xrdp-proprietary-829c494fb9b62c68d1079251ca1c97de84c09c70.zip
Merge branch 'master' of github.com:neutrinolabs/xrdp
Diffstat (limited to 'common')
-rw-r--r--common/log.c24
-rw-r--r--common/os_calls.c15
-rw-r--r--common/os_calls.h1
-rw-r--r--common/parse.h29
-rw-r--r--common/trans.c23
-rw-r--r--common/trans.h2
6 files changed, 69 insertions, 25 deletions
diff --git a/common/log.c b/common/log.c
index ce0000aa..55353a8f 100644
--- a/common/log.c
+++ b/common/log.c
@@ -363,7 +363,7 @@ internal_config_read_logging(int file, struct log_config *lc,
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_ENABLE_SYSLOG))
{
- lc->enable_syslog = text2bool((char *)list_get_item(param_v, i));
+ lc->enable_syslog = g_text2bool((char *)list_get_item(param_v, i));
}
if (0 == g_strcasecmp(buf, SESMAN_CFG_LOG_SYSLOG_LEVEL))
@@ -413,28 +413,6 @@ internalInitAndAllocStruct(void)
* Here below the public functions
*/
-
-/**
- *
- * @brief Reads sesman configuration
- * @param s translates the strings "1", "true" and "yes" in 1 (true) and other strings in 0
- * @return 0 on false, 1 on 1,true, yes
- *
- */
-int APP_CC
-text2bool(char *s)
-{
- if ( (g_atoi(s) != 0) ||
- (0 == g_strcasecmp(s, "true")) ||
- (0 == g_strcasecmp(s, "on")) ||
- (0 == g_strcasecmp(s, "yes")))
- {
- return 1;
- }
-
- return 0;
-}
-
enum logReturns DEFAULT_CC
log_start_from_param(const struct log_config *iniParams)
{
diff --git a/common/os_calls.c b/common/os_calls.c
index f5f5cd60..1939ddc9 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -2935,3 +2935,18 @@ g_time3(void)
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
#endif
}
+
+/*****************************************************************************/
+/* returns boolean */
+int APP_CC
+g_text2bool(const char *s)
+{
+ if ( (g_atoi(s) != 0) ||
+ (0 == g_strcasecmp(s, "true")) ||
+ (0 == g_strcasecmp(s, "on")) ||
+ (0 == g_strcasecmp(s, "yes")))
+ {
+ return 1;
+ }
+ return 0;
+}
diff --git a/common/os_calls.h b/common/os_calls.h
index cba37588..2dbbe660 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -152,5 +152,6 @@ int APP_CC g_check_user_in_group(const char* username, int gid, int* ok);
int APP_CC g_time1(void);
int APP_CC g_time2(void);
int APP_CC g_time3(void);
+int APP_CC g_text2bool(const char *s);
#endif
diff --git a/common/parse.h b/common/parse.h
index f92e76de..3ec37104 100644
--- a/common/parse.h
+++ b/common/parse.h
@@ -279,6 +279,35 @@ struct stream
#endif
/******************************************************************************/
+#if defined(B_ENDIAN) || defined(NEED_ALIGN)
+#define out_uint64_le(s, v) do \
+{ \
+ *((s)->p) = (unsigned char)((v) >> 0); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 8); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 16); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 24); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 32); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 40); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 48); \
+ (s)->p++; \
+ *((s)->p) = (unsigned char)((v) >> 56); \
+ (s)->p++; \
+} while (0)
+#else
+#define out_uint64_le(s, v) do \
+{ \
+ *((tui64*)((s)->p)) = (v); \
+ (s)->p += 8; \
+} while (0)
+#endif
+
+/******************************************************************************/
#define out_uint32_be(s, v) do \
{ \
*((s)->p) = (unsigned char)((v) >> 24); \
diff --git a/common/trans.c b/common/trans.c
index e862249e..0b672168 100644
--- a/common/trans.c
+++ b/common/trans.c
@@ -142,6 +142,7 @@ trans_check_wait_objs(struct trans *self)
in_trans->sck = in_sck;
in_trans->type1 = TRANS_TYPE_SERVER;
in_trans->status = TRANS_STATUS_UP;
+ in_trans->is_term = self->is_term;
if (self->trans_conn_in(self, in_trans) != 0)
{
@@ -226,9 +227,18 @@ trans_force_read_s(struct trans *self, struct stream *in_s, int size)
{
if (g_tcp_last_error_would_block(self->sck))
{
- if (!g_tcp_can_recv(self->sck, 10))
+ if (!g_tcp_can_recv(self->sck, 100))
{
/* check for term here */
+ if (self->is_term != 0)
+ {
+ if (self->is_term())
+ {
+ /* term */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
+ }
+ }
}
}
else
@@ -285,9 +295,18 @@ trans_force_write_s(struct trans *self, struct stream *out_s)
{
if (g_tcp_last_error_would_block(self->sck))
{
- if (!g_tcp_can_send(self->sck, 10))
+ if (!g_tcp_can_send(self->sck, 100))
{
/* check for term here */
+ if (self->is_term != 0)
+ {
+ if (self->is_term())
+ {
+ /* term */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
+ }
+ }
}
}
else
diff --git a/common/trans.h b/common/trans.h
index 8daa980a..4b8e3b42 100644
--- a/common/trans.h
+++ b/common/trans.h
@@ -38,6 +38,7 @@ struct trans; /* forward declaration */
typedef int (*ttrans_data_in)(struct trans* self);
typedef int (*ttrans_conn_in)(struct trans* self, struct trans* new_self);
+typedef int (*tis_term)(void);
struct trans
{
@@ -52,6 +53,7 @@ struct trans
struct stream* in_s;
struct stream* out_s;
char* listen_filename;
+ tis_term is_term; /* used to test for exit */
};
struct trans* APP_CC