summaryrefslogtreecommitdiffstats
path: root/sesman/tools
diff options
context:
space:
mode:
authorilsimo <ilsimo>2006-11-24 20:46:45 +0000
committerilsimo <ilsimo>2006-11-24 20:46:45 +0000
commit078b4d3f4127042b020e78bb9d9762196ff070c3 (patch)
tree9d0b7a5b0ffe2c8e2f07b2b45ebd950d43c59533 /sesman/tools
parentb681420acc6297f628d132946f6f9f94f536a358 (diff)
downloadxrdp-proprietary-078b4d3f4127042b020e78bb9d9762196ff070c3.tar.gz
xrdp-proprietary-078b4d3f4127042b020e78bb9d9762196ff070c3.zip
adding scp v1 first code, fixed passwd auth for disabled password
Diffstat (limited to 'sesman/tools')
-rw-r--r--sesman/tools/Makefile40
-rw-r--r--sesman/tools/sestest.c155
2 files changed, 195 insertions, 0 deletions
diff --git a/sesman/tools/Makefile b/sesman/tools/Makefile
new file mode 100644
index 00000000..b4902ad5
--- /dev/null
+++ b/sesman/tools/Makefile
@@ -0,0 +1,40 @@
+# sesman makefile
+SESTESTOBJ = sestest.o tcp.o \
+ os_calls.o d3des.o list.o file.o \
+ libscp_v1c.o
+
+DEFINES = -DLIBSCP_CLIENT
+
+CFLAGS = -Wall -O2 -I../../common -I../ -I/usr/include/nptl $(DEFINES)
+LDFLAGS = -L /usr/gnu/lib -I/usr/include/nptl -L/usr/lib/nptl -lpthread -ldl $(DEFINES)
+C_OS_FLAGS = $(CFLAGS) -c
+CC = gcc
+
+all: sestest
+
+sestest: $(SESTESTOBJ)
+ $(CC) $(LDFLAGS) -o sestest $(SESTESTOBJ)
+
+os_calls.o: ../../common/os_calls.c
+ $(CC) $(C_OS_FLAGS) ../../common/os_calls.c
+
+d3des.o: ../../common/d3des.c
+ $(CC) $(C_OS_FLAGS) ../../common/d3des.c
+
+list.o: ../../common/list.c
+ $(CC) $(C_OS_FLAGS) ../../common/list.c
+
+file.o: ../../common/file.c
+ $(CC) $(C_OS_FLAGS) ../../common/file.c
+
+tcp.o: ../tcp.c
+ $(CC) $(C_OS_FLAGS) ../tcp.c
+
+libscp_v1c.o: ../libscp_v1c.c
+ $(CC) $(C_OS_FLAGS) ../libscp_v1c.c
+
+clean:
+ rm $(SESTESTOBJ) sestest
+
+install:
+ #install:wq
diff --git a/sesman/tools/sestest.c b/sesman/tools/sestest.c
new file mode 100644
index 00000000..62629f3a
--- /dev/null
+++ b/sesman/tools/sestest.c
@@ -0,0 +1,155 @@
+
+
+#include "arch.h"
+#include "tcp.h"
+#include "libscp.h"
+#include "parse.h"
+
+#include <stdio.h>
+
+int inputSession(struct SCP_SESSION* s);
+unsigned int menuSelect(unsigned int choices);
+
+int main(int argc, char** argv)
+{
+ struct SCP_SESSION s;
+ struct SCP_CONNECTION c;
+ enum SCP_CLIENT_STATES_E e;
+ int end;
+
+ make_stream(c.in_s);
+ init_stream(c.in_s, 8192);
+ make_stream(c.out_s);
+ init_stream(c.out_s, 8192);
+ c.in_sck = g_tcp_socket();
+
+ if (0!=g_tcp_connect(c.in_sck, "localhost", "3350"))
+ {
+ g_printf("error connecting");
+ return 1;
+ }
+
+ g_printf("001 - send connect request\n");
+
+/*struct SCP_SESSION
+{
+ uint16_t display;
+ char* errstr;
+};*/
+
+ s.type=SCP_SESSION_TYPE_XVNC;
+ s.version=1;
+ s.height=600;
+ s.width=800;
+ s.bpp=8;
+ s.rsr=0;
+ g_strncpy(s.locale,"it_IT 0123456789",18);
+
+ s.username=g_malloc(256, 1);
+ g_strncpy(s.username,"prog",255);
+
+ s.password=g_malloc(256,1);
+ g_strncpy(s.password, "prog", 255);
+ g_printf("%s - %s\n", s.username, s.password);
+
+
+ s.hostname=g_malloc(256,1);
+ g_strncpy(s.hostname, "odin", 255);
+
+ s.addr_type=SCP_ADDRESS_TYPE_IPV4;
+ s.ipv4addr=0;
+ s.errstr=0;
+
+ end=0;
+ e=scp_v1c_connect(&c,&s);
+
+ while (!end)
+ {
+ switch (e)
+ {
+ case SCP_CLIENT_STATE_OK:
+ g_printf("OK : display is %d\n", (int)s.display);
+ end=1;
+ break;
+ case SCP_CLIENT_STATE_SESSION_LIST:
+ g_printf("OK : session list needed\n");
+ break;
+ case SCP_CLIENT_STATE_RESEND_CREDENTIALS:
+ g_printf("ERR: resend credentials - %s\n", s.errstr);
+ g_printf(" username:");
+ scanf("%255s", s.username);
+ g_printf(" password:");
+ scanf("%255s", s.password);
+ e=scp_v1c_resend_credentials(&c,&s);
+ break;
+ case SCP_CLIENT_STATE_CONNECTION_DENIED:
+ g_printf("ERR: connection denied: %s\n", s.errstr);
+ end=1;
+ break;
+ case SCP_CLIENT_STATE_PWD_CHANGE_REQ:
+ g_printf("OK : password change required\n");
+ break;
+ default:
+ g_printf("protocol error: %d\n", e);
+ end=1;
+ }
+ }
+
+ g_tcp_close(c.in_sck);
+ free_stream(c.in_s);
+ free_stream(c.out_s);
+
+ return 0;
+}
+
+int inputSession(struct SCP_SESSION* s)
+{
+ unsigned int integer;
+
+ g_printf("username: ");
+ scanf("%255s", s->username);
+ g_printf("password:");
+ scanf("%255s", s->password);
+ g_printf("hostname:");
+ scanf("%255s", s->hostname);
+
+ g_printf("session type:\n");
+ g_printf("0: Xvnc\n", SCP_SESSION_TYPE_XVNC);
+ g_printf("1: x11rdp\n", SCP_SESSION_TYPE_XRDP);
+ integer=menuSelect(1);
+ if (integer==1)
+ {
+ s->type=SCP_SESSION_TYPE_XRDP;
+ }
+ else
+ {
+ s->type=SCP_SESSION_TYPE_XVNC;
+ }
+
+ s->version=1;
+ s->height=600;
+ s->width=800;
+ s->bpp=8;
+
+ /* fixed for now */
+ s->rsr=0;
+ g_strncpy(s->locale,"it_IT 0123456789",18);
+
+ return 0;
+}
+
+unsigned int menuSelect(unsigned int choices)
+{
+ unsigned int sel;
+ int ret;
+
+ ret=scanf("%u", &sel);
+
+ while ((ret==0) || (sel > choices))
+ {
+ g_printf("invalid choice.");
+ scanf("%u", &sel);
+ }
+
+ return sel;
+}