diff --git a/build/builder/build-server.py b/build/builder/build-server.py
index 295bdaf..180d7f4 100644
--- a/build/builder/build-server.py
+++ b/build/builder/build-server.py
@@ -63,31 +63,24 @@ class BuilderLinux(BuilderBase):
super().__init__()
def build_server(self):
- cc.n('build tp_web...')
+ cc.n('build server app (tp_core/libtpssh/tp_web)...')
- ###################
- # out_path = os.path.join(ROOT_PATH, 'out', 'eom_ts', ctx.target_path, ctx.dist_path)
out_path = os.path.join(ROOT_PATH, 'out', 'server', ctx.bits_path, 'bin')
- out_file = os.path.join(out_path, 'tp_web')
+ out_files = [os.path.join(out_path, 'tp_core'), os.path.join(out_path, 'libtpssh.so'),
+ os.path.join(out_path, 'tp_web')]
- if os.path.exists(out_file):
- utils.remove(out_file)
+ for f in out_files:
+ if os.path.exists(f):
+ utils.remove(f)
utils.makedirs(out_path)
utils.cmake(os.path.join(ROOT_PATH, 'server', 'cmake-build'), ctx.target_path, False)
- utils.strip(out_file)
+ # utils.strip(out_file)
-
- # wscript_file = os.path.join(ROOT_PATH, 'wscript')
- # utils.waf_build(wscript_file, ctx.target_path, False)
-
- # chk_file = os.path.join(ROOT_PATH, 'waf_build', ctx.target_path, 'eom_ts')
- # utils.ensure_file_exists(chk_file)
- # os.chmod(chk_file, 0o777)
-
- # shutil.copy(chk_file, out_file)
- utils.ensure_file_exists(out_file)
+ for f in out_files:
+ if os.path.exists(f):
+ utils.ensure_file_exists(f)
diff --git a/server/.idea/encodings.xml b/server/.idea/encodings.xml
index e0aac22..2f77846 100644
--- a/server/.idea/encodings.xml
+++ b/server/.idea/encodings.xml
@@ -9,6 +9,7 @@
+
diff --git a/server/.idea/server.iml b/server/.idea/server.iml
index 57328bc..240d818 100644
--- a/server/.idea/server.iml
+++ b/server/.idea/server.iml
@@ -46,20 +46,20 @@
-
+
+
-
+
-
+
-
+
-
@@ -73,9 +73,9 @@
-
-
+
+
diff --git a/server/tp_core/common/ts_membuf.cpp b/server/tp_core/common/ts_membuf.cpp
index 29d853c..13a3b79 100644
--- a/server/tp_core/common/ts_membuf.cpp
+++ b/server/tp_core/common/ts_membuf.cpp
@@ -21,6 +21,11 @@ MemBuffer::~MemBuffer()
void MemBuffer::append(const ex_u8* data, size_t size)
{
reserve(m_data_size + size);
+
+ // TODO: should return boolean.
+ if(NULL == m_buffer)
+ return;
+
memcpy(m_buffer+m_data_size, data, size);
m_data_size += size;
}
@@ -40,6 +45,13 @@ void MemBuffer::reserve(size_t size)
m_buffer_size = new_size;
+ // TODO: reserve() should return boolean.
+ if(NULL == m_buffer)
+ {
+ m_buffer_size = 0;
+ m_data_size = 0;
+ }
+
//TSLOGD("[mbuf] reserve(): #%d, buffer-size: %d, data-size: %d\n", m_index, m_buffer_size, m_data_size);
}
diff --git a/server/tp_core/protocol/ssh/ssh_session.cpp b/server/tp_core/protocol/ssh/ssh_session.cpp
index 8812fcd..592e724 100644
--- a/server/tp_core/protocol/ssh/ssh_session.cpp
+++ b/server/tp_core/protocol/ssh/ssh_session.cpp
@@ -937,7 +937,7 @@ int SshSession::_on_server_channel_data(ssh_session session, ssh_channel channel
" - authroized by %s\r\n"\
"=============================================\r\n"\
"\r\n"\
- "\033]0;TP#telnet://%s\007",
+ "\033]0;tpssh://%s\007",
_this->m_server_ip.c_str(),
_this->m_server_port, auth_mode,
_this->m_server_ip.c_str()
@@ -955,9 +955,13 @@ int SshSession::_on_server_channel_data(ssh_session session, ssh_channel channel
{
ret = ssh_channel_write_stderr(info->channel, data, len);
}
+ else if(info->type != TS_SSH_CHANNEL_TYPE_SHELL)
+ {
+ ret = ssh_channel_write(info->channel, data, len);
+ }
else
{
- if (len > 5)
+ if (len > 5 && len < 256)
{
const ex_u8* _begin = ex_memmem((const ex_u8*)data, len, (const ex_u8*)"\033]0;", 4);
if (NULL != _begin)
@@ -975,18 +979,25 @@ int SshSession::_on_server_channel_data(ssh_session session, ssh_channel channel
if (len_before > 0)
mbuf.append((ex_u8*)data, len_before);
- mbuf.append((ex_u8*)"\033]0;TP#ssh://", 13);
+ mbuf.append((ex_u8*)"\033]0;tpssh://", 13);
mbuf.append((ex_u8*)_this->m_server_ip.c_str(), _this->m_server_ip.length());
mbuf.append((ex_u8*)"\007", 1);
if (len_end > 0)
mbuf.append((ex_u8*)_end, len_end);
- ret = ssh_channel_write(info->channel, mbuf.data(), mbuf.size());
- if (ret <= 0)
- EXLOGE("[ssh] send to client failed (1).\n");
- else
- ret = len;
+ if(mbuf.size() > 0)
+ {
+ ret = ssh_channel_write(info->channel, mbuf.data(), mbuf.size());
+ if (ret <= 0)
+ EXLOGE("[ssh] send to client failed (1).\n");
+ else
+ ret = len;
+ }
+ else
+ {
+ ret = ssh_channel_write(info->channel, data, len);
+ }
}
else
{