adding libscp to xup
some fixes for vnc mod
This commit is contained in:
parent
b1eface57f
commit
fd8ce33f59
@ -37,6 +37,7 @@ install:
|
|||||||
installdeb:
|
installdeb:
|
||||||
install libvnc.so $(DESTDIRDEB)/usr/lib/xrdp/libvnc.so
|
install libvnc.so $(DESTDIRDEB)/usr/lib/xrdp/libvnc.so
|
||||||
|
|
||||||
|
#building libscp objects
|
||||||
libscp_v0.o:
|
libscp_v0.o:
|
||||||
$(CC) $(C_OS_FLAGS) ../sesman/libscp_v0.c
|
$(CC) $(C_OS_FLAGS) ../sesman/libscp_v0.c
|
||||||
|
|
||||||
|
@ -976,6 +976,8 @@ lib_mod_connect(struct vnc* v)
|
|||||||
{
|
{
|
||||||
v->server_msg(v, "error - connecting to sesman", 0);
|
v->server_msg(v, "error - connecting to sesman", 0);
|
||||||
}
|
}
|
||||||
|
g_free(scp_s.username);
|
||||||
|
g_free(scp_s.password);
|
||||||
g_tcp_close(scp_c.in_sck);
|
g_tcp_close(scp_c.in_sck);
|
||||||
if (error != 0 || scp_s.display == 0)
|
if (error != 0 || scp_s.display == 0)
|
||||||
{
|
{
|
||||||
|
11
xup/Makefile
11
xup/Makefile
@ -1,5 +1,7 @@
|
|||||||
# libxup makefile
|
# libxup makefile
|
||||||
XUPOBJ = os_calls.o xup.o
|
LIBSCPOBJ = libscp_v0.o tcp.o
|
||||||
|
|
||||||
|
XUPOBJ = os_calls.o xup.o $(LIBSCPOBJ)
|
||||||
|
|
||||||
DESTDIR = /usr/local/xrdp
|
DESTDIR = /usr/local/xrdp
|
||||||
CFGDIR = /etc/xrdp
|
CFGDIR = /etc/xrdp
|
||||||
@ -32,3 +34,10 @@ install:
|
|||||||
|
|
||||||
installdeb:
|
installdeb:
|
||||||
install libxup.so $(DESTDIRDEB)/usr/lib/xrdp/libxup.so
|
install libxup.so $(DESTDIRDEB)/usr/lib/xrdp/libxup.so
|
||||||
|
|
||||||
|
#building libscp objects
|
||||||
|
libscp_v0.o:
|
||||||
|
$(CC) $(C_OS_FLAGS) ../sesman/libscp_v0.c
|
||||||
|
|
||||||
|
tcp.o:
|
||||||
|
$(CC) $(C_OS_FLAGS) -DLIBSCP_CLIENT ../sesman/tcp.c
|
||||||
|
111
xup/xup.c
111
xup/xup.c
@ -128,15 +128,19 @@ lib_mod_connect(struct mod* mod)
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
int len;
|
int len;
|
||||||
int display;
|
//int display;
|
||||||
int i;
|
int i;
|
||||||
int version;
|
/*int version;
|
||||||
int size;
|
int size;
|
||||||
int code;
|
int code;
|
||||||
int ok;
|
int ok;*/
|
||||||
struct stream* s;
|
struct stream* s;
|
||||||
char con_port[256];
|
char con_port[256];
|
||||||
|
|
||||||
|
struct SCP_SESSION scp_s;
|
||||||
|
struct SCP_CONNECTION scp_c;
|
||||||
|
enum SCP_CLIENT_STATES_E scp_e;
|
||||||
|
|
||||||
LIB_DEBUG(mod, "in lib_mod_connect");
|
LIB_DEBUG(mod, "in lib_mod_connect");
|
||||||
/* clear screen */
|
/* clear screen */
|
||||||
mod->server_begin_update(mod);
|
mod->server_begin_update(mod);
|
||||||
@ -160,81 +164,68 @@ lib_mod_connect(struct mod* mod)
|
|||||||
/* if port = -1, use sesman to get port / desktop */
|
/* if port = -1, use sesman to get port / desktop */
|
||||||
if (g_strncmp(mod->port, "-1", 2) == 0)
|
if (g_strncmp(mod->port, "-1", 2) == 0)
|
||||||
{
|
{
|
||||||
display = 0;
|
scp_s.type=SCP_SESSION_TYPE_XRDP;
|
||||||
|
scp_s.display=0;
|
||||||
|
scp_s.height=mod->height;
|
||||||
|
scp_s.width=mod->width;
|
||||||
|
scp_s.bpp=mod->bpp;
|
||||||
|
scp_s.username=g_strdup(mod->username);
|
||||||
|
scp_s.password=g_strdup(mod->password);
|
||||||
|
|
||||||
error = 0;
|
error = 0;
|
||||||
init_stream(s, 8192);
|
init_stream(s, 8192);
|
||||||
mod->sck = g_tcp_socket();
|
scp_c.in_sck=g_tcp_socket();
|
||||||
|
make_stream((scp_c.in_s));
|
||||||
|
make_stream((scp_c.out_s));
|
||||||
|
init_stream((scp_c.in_s), 8192);
|
||||||
|
init_stream((scp_c.out_s), 8192);
|
||||||
mod->sck_closed = 0;
|
mod->sck_closed = 0;
|
||||||
mod->server_msg(mod, "connecting to sesman", 0);
|
mod->server_msg(mod, "connecting to sesman", 0);
|
||||||
if (g_tcp_connect(mod->sck, mod->ip, "3350") == 0)
|
if (g_tcp_connect(scp_c.in_sck, mod->ip, "3350") == 0)
|
||||||
{
|
{
|
||||||
g_tcp_set_non_blocking(mod->sck);
|
error=1;
|
||||||
g_tcp_set_no_delay(mod->sck);
|
scp_e=scp_v0c_connect(&scp_c, &scp_s);
|
||||||
s_push_layer(s, channel_hdr, 8);
|
switch (scp_e)
|
||||||
out_uint16_be(s, 10); // code
|
|
||||||
i = g_strlen(mod->username);
|
|
||||||
out_uint16_be(s, i);
|
|
||||||
out_uint8a(s, mod->username, i);
|
|
||||||
i = g_strlen(mod->password);
|
|
||||||
out_uint16_be(s, i);
|
|
||||||
out_uint8a(s, mod->password, i);
|
|
||||||
out_uint16_be(s, mod->width);
|
|
||||||
out_uint16_be(s, mod->height);
|
|
||||||
out_uint16_be(s, mod->bpp);
|
|
||||||
s_mark_end(s);
|
|
||||||
s_pop_layer(s, channel_hdr);
|
|
||||||
out_uint32_be(s, 0); // version
|
|
||||||
out_uint32_be(s, s->end - s->data); // size
|
|
||||||
mod->server_msg(mod, "sending login info to sesman", 0);
|
|
||||||
error = lib_send(mod, s->data, s->end - s->data);
|
|
||||||
if (error == 0)
|
|
||||||
{
|
{
|
||||||
init_stream(s, 8192);
|
case SCP_CLIENT_STATE_CONNECTION_DENIED:
|
||||||
mod->server_msg(mod, "receiving sesman header", 0);
|
mod->server_msg(mod, "error - sesman returned no", 0);
|
||||||
error = lib_recv(mod, s->data, 8);
|
break;
|
||||||
}
|
case SCP_CLIENT_STATE_VERSION_ERR:
|
||||||
if (error == 0)
|
mod->server_msg(mod, "error - libscp version error", 0);
|
||||||
{
|
break;
|
||||||
in_uint32_be(s, version);
|
case SCP_CLIENT_STATE_SIZE_ERR:
|
||||||
in_uint32_be(s, size);
|
mod->server_msg(mod, "error - libscp size error", 0);
|
||||||
init_stream(s, 8192);
|
break;
|
||||||
mod->server_msg(mod, "receiving sesman data", 0);
|
case SCP_CLIENT_STATE_NETWORK_ERR:
|
||||||
error = lib_recv(mod, s->data, size - 8);
|
mod->server_msg(mod, "error - libscp network error", 0);
|
||||||
}
|
break;
|
||||||
if (error == 0)
|
case SCP_CLIENT_STATE_SEQUENCE_ERR:
|
||||||
{
|
mod->server_msg(mod, "error - libscp sequence error", 0);
|
||||||
if (version == 0)
|
break;
|
||||||
{
|
case SCP_CLIENT_STATE_END:
|
||||||
in_uint16_be(s, code);
|
mod->server_msg(mod, "error - sesman returned ok", 0);
|
||||||
if (code == 3)
|
error=0;
|
||||||
{
|
break;
|
||||||
in_uint16_be(s, ok);
|
default:
|
||||||
if (ok)
|
mod->server_msg(mod, "error - unknown error", 0);
|
||||||
{
|
|
||||||
in_uint16_be(s, display);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
in_uint8s(s, 2);
|
|
||||||
mod->server_msg(mod, "error - sesman returned no", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mod->server_msg(mod, "error - connecting to sesman", 0);
|
mod->server_msg(mod, "error - connecting to sesman", 0);
|
||||||
}
|
}
|
||||||
g_tcp_close(mod->sck);
|
g_free(scp_s.username);
|
||||||
if (error != 0 || display == 0)
|
g_free(scp_s.password);
|
||||||
|
g_tcp_close(scp_c.in_sck);
|
||||||
|
if (error != 0 || scp_s.display == 0)
|
||||||
{
|
{
|
||||||
mod->server_msg(mod, "error - connection failed", 0);
|
mod->server_msg(mod, "error - connection failed", 0);
|
||||||
free_stream(s);
|
free_stream(s);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
mod->server_msg(mod, "sesman started a session", 0);
|
mod->server_msg(mod, "sesman started a session", 0);
|
||||||
g_sprintf(con_port, "%d", 6200 + display);
|
g_sprintf(con_port, "%d", 6200 + scp_s.display);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "os_calls.h"
|
#include "os_calls.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
|
#include "../sesman/libscp.h"
|
||||||
|
|
||||||
struct mod
|
struct mod
|
||||||
{
|
{
|
||||||
int size; /* size of this struct */
|
int size; /* size of this struct */
|
||||||
@ -38,7 +40,7 @@ struct mod
|
|||||||
int (*mod_signal)(struct mod* v);
|
int (*mod_signal)(struct mod* v);
|
||||||
int (*mod_end)(struct mod* v);
|
int (*mod_end)(struct mod* v);
|
||||||
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
int (*mod_set_param)(struct mod* v, char* name, char* value);
|
||||||
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
long mod_dumby[100 - 6]; /* align, 100 minus the number of mod
|
||||||
functions above */
|
functions above */
|
||||||
/* server functions */
|
/* server functions */
|
||||||
int (*server_begin_update)(struct mod* v);
|
int (*server_begin_update)(struct mod* v);
|
||||||
@ -79,7 +81,7 @@ struct mod
|
|||||||
int (*server_get_channel_id)(struct mod* v, char* name);
|
int (*server_get_channel_id)(struct mod* v, char* name);
|
||||||
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
int (*server_send_to_channel)(struct mod* v, int channel_id,
|
||||||
char* data, int data_len);
|
char* data, int data_len);
|
||||||
long server_dumby[100 - 24]; /* align, 100 minus the number of server
|
long server_dumby[100 - 24]; /* align, 100 minus the number of server
|
||||||
functions above */
|
functions above */
|
||||||
/* common */
|
/* common */
|
||||||
long handle; /* pointer to self as long */
|
long handle; /* pointer to self as long */
|
||||||
|
Loading…
Reference in New Issue
Block a user