diff options
author | jsorg71 <jsorg71> | 2009-08-19 07:27:35 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2009-08-19 07:27:35 +0000 |
commit | df8527b2517dd3fc6794666a859d2453951d03ad (patch) | |
tree | 27afe2746450f919dba1a7682e3469eef9596a88 /sesman/libscp | |
parent | 3fd42d808adf82bd910c3e51b4dc89b3d35107fa (diff) | |
download | xrdp-proprietary-df8527b2517dd3fc6794666a859d2453951d03ad.tar.gz xrdp-proprietary-df8527b2517dd3fc6794666a859d2453951d03ad.zip |
pass domain, program, and directory to sesman and use directory and program
Diffstat (limited to 'sesman/libscp')
-rw-r--r-- | sesman/libscp/libscp_session.c | 84 | ||||
-rw-r--r-- | sesman/libscp/libscp_session.h | 9 | ||||
-rw-r--r-- | sesman/libscp/libscp_types.h | 3 | ||||
-rw-r--r-- | sesman/libscp/libscp_v0.c | 53 | ||||
-rw-r--r-- | sesman/libscp/libscp_v1s_mng.c | 3 |
5 files changed, 144 insertions, 8 deletions
diff --git a/sesman/libscp/libscp_session.c b/sesman/libscp/libscp_session.c index b0c6a4a2..35a3a2ad 100644 --- a/sesman/libscp/libscp_session.c +++ b/sesman/libscp/libscp_session.c @@ -212,6 +212,72 @@ scp_session_set_password(struct SCP_SESSION* s, char* str) /*******************************************************************/ int +scp_session_set_domain(struct SCP_SESSION* s, char* str) +{ + if (0 == str) + { + log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_domain: null domain", __LINE__); + return 1; + } + if (0 != s->domain) + { + g_free(s->domain); + } + s->domain = g_strdup(str); + if (0 == s->domain) + { + log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_domain: strdup error", __LINE__); + return 1; + } + return 0; +} + +/*******************************************************************/ +int +scp_session_set_program(struct SCP_SESSION* s, char* str) +{ + if (0 == str) + { + log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_program: null program", __LINE__); + return 1; + } + if (0 != s->program) + { + g_free(s->program); + } + s->program = g_strdup(str); + if (0 == s->program) + { + log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_program: strdup error", __LINE__); + return 1; + } + return 0; +} + +/*******************************************************************/ +int +scp_session_set_directory(struct SCP_SESSION* s, char* str) +{ + if (0 == str) + { + log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_directory: null directory", __LINE__); + return 1; + } + if (0 != s->directory) + { + g_free(s->directory); + } + s->directory = g_strdup(str); + if (0 == s->directory) + { + log_message(s_log, LOG_LEVEL_WARNING, "[session:%d] set_directory: strdup error", __LINE__); + return 1; + } + return 0; +} + +/*******************************************************************/ +int scp_session_set_hostname(struct SCP_SESSION* s, char* str) { if (0 == str) @@ -334,6 +400,24 @@ scp_session_destroy(struct SCP_SESSION* s) s->hostname = 0; } + if (s->domain) + { + g_free(s->domain); + s->domain = 0; + } + + if (s->program) + { + g_free(s->program); + s->program = 0; + } + + if (s->directory) + { + g_free(s->directory); + s->directory = 0; + } + if (s->errstr) { g_free(s->errstr); diff --git a/sesman/libscp/libscp_session.h b/sesman/libscp/libscp_session.h index f30710e3..713f80cc 100644 --- a/sesman/libscp/libscp_session.h +++ b/sesman/libscp/libscp_session.h @@ -69,6 +69,15 @@ int scp_session_set_password(struct SCP_SESSION* s, char* str); int +scp_session_set_domain(struct SCP_SESSION* s, char* str); + +int +scp_session_set_program(struct SCP_SESSION* s, char* str); + +int +scp_session_set_directory(struct SCP_SESSION* s, char* str); + +int scp_session_set_hostname(struct SCP_SESSION* s, char* str); int diff --git a/sesman/libscp/libscp_types.h b/sesman/libscp/libscp_types.h index 5cd86b96..cb31ca88 100644 --- a/sesman/libscp/libscp_types.h +++ b/sesman/libscp/libscp_types.h @@ -83,6 +83,9 @@ struct SCP_SESSION SCP_DISPLAY display; char* errstr; struct SCP_MNG_DATA* mng; + char* domain; + char* program; + char* directory; }; struct SCP_DISCONNECTED_SESSION diff --git a/sesman/libscp/libscp_v0.c b/sesman/libscp/libscp_v0.c index 6611242a..861bf1ce 100644 --- a/sesman/libscp/libscp_v0.c +++ b/sesman/libscp/libscp_v0.c @@ -33,7 +33,8 @@ extern struct log_config* s_log; /* client API */ /******************************************************************************/ -enum SCP_CLIENT_STATES_E scp_v0c_connect(struct SCP_CONNECTION* c, struct SCP_SESSION* s) +enum SCP_CLIENT_STATES_E +scp_v0c_connect(struct SCP_CONNECTION* c, struct SCP_SESSION* s) { tui32 version; tui32 size; @@ -139,7 +140,8 @@ enum SCP_CLIENT_STATES_E scp_v0c_connect(struct SCP_CONNECTION* c, struct SCP_SE /* server API */ /******************************************************************************/ -enum SCP_SERVER_STATES_E scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s, int skipVchk) +enum SCP_SERVER_STATES_E +scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s, int skipVchk) { tui32 version = 0; tui32 size; @@ -151,8 +153,9 @@ enum SCP_SERVER_STATES_E scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SES if (!skipVchk) { LOG_DBG(s_log, "[v0:%d] starting connection", __LINE__); - 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)) { + c->in_s->end = c->in_s->data + 8; in_uint32_be(c->in_s, version); if (version != 0) { @@ -170,17 +173,18 @@ enum SCP_SERVER_STATES_E scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SES in_uint32_be(c->in_s, size); init_stream(c->in_s, 8196); - if (0!=scp_tcp_force_recv(c->in_sck, c->in_s->data, size-8)) + if (0 != scp_tcp_force_recv(c->in_sck, c->in_s->data, size - 8)) { log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__); return SCP_SERVER_STATE_NETWORK_ERR; } + c->in_s->end = c->in_s->data + (size - 8); in_uint16_be(c->in_s, code); if (code == 0 || code == 10) { - session = scp_session_create(); + session = scp_session_create(); if (0 == session) { log_message(s_log, LOG_LEVEL_WARNING, "[v0:%d] connection aborted: network error", __LINE__); @@ -228,6 +232,39 @@ enum SCP_SERVER_STATES_E scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SES /* bpp */ in_uint16_be(c->in_s, sz); scp_session_set_bpp(session, (tui8)sz); + if (s_check_rem(c->in_s, 2)) + { + /* reading domain */ + in_uint16_be(c->in_s, sz); + if (sz > 0) + { + in_uint8a(c->in_s, buf, sz); + buf[sz] = '\0'; + scp_session_set_domain(session, buf); + } + } + if (s_check_rem(c->in_s, 2)) + { + /* reading program */ + in_uint16_be(c->in_s, sz); + if (sz > 0) + { + in_uint8a(c->in_s, buf, sz); + buf[sz] = '\0'; + scp_session_set_program(session, buf); + } + } + if (s_check_rem(c->in_s, 2)) + { + /* reading directory */ + in_uint16_be(c->in_s, sz); + if (sz > 0) + { + in_uint8a(c->in_s, buf, sz); + buf[sz] = '\0'; + scp_session_set_directory(session, buf); + } + } } else { @@ -240,7 +277,8 @@ enum SCP_SERVER_STATES_E scp_v0s_accept(struct SCP_CONNECTION* c, struct SCP_SES } /******************************************************************************/ -enum SCP_SERVER_STATES_E scp_v0s_allow_connection(struct SCP_CONNECTION* c, SCP_DISPLAY d) +enum SCP_SERVER_STATES_E +scp_v0s_allow_connection(struct SCP_CONNECTION* c, SCP_DISPLAY d) { out_uint32_be(c->out_s, 0); /* version */ out_uint32_be(c->out_s, 14); /* size */ @@ -260,7 +298,8 @@ enum SCP_SERVER_STATES_E scp_v0s_allow_connection(struct SCP_CONNECTION* c, SCP_ } /******************************************************************************/ -enum SCP_SERVER_STATES_E scp_v0s_deny_connection(struct SCP_CONNECTION* c) +enum SCP_SERVER_STATES_E +scp_v0s_deny_connection(struct SCP_CONNECTION* c) { out_uint32_be(c->out_s, 0); /* version */ out_uint32_be(c->out_s, 14); /* size */ diff --git a/sesman/libscp/libscp_v1s_mng.c b/sesman/libscp/libscp_v1s_mng.c index 25af2d33..80ed7360 100644 --- a/sesman/libscp/libscp_v1s_mng.c +++ b/sesman/libscp/libscp_v1s_mng.c @@ -36,7 +36,8 @@ static enum SCP_SERVER_STATES_E _scp_v1s_mng_check_response(struct SCP_CONNECTION* c, struct SCP_SESSION* s); /* server API */ -enum SCP_SERVER_STATES_E scp_v1s_mng_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s) +enum SCP_SERVER_STATES_E +scp_v1s_mng_accept(struct SCP_CONNECTION* c, struct SCP_SESSION** s) { struct SCP_SESSION* session; tui32 ipaddr; |