diff options
author | ilsimo <ilsimo> | 2008-07-30 10:58:30 +0000 |
---|---|---|
committer | ilsimo <ilsimo> | 2008-07-30 10:58:30 +0000 |
commit | d14b076a700e1ad87048549945f0f1e658db6cd5 (patch) | |
tree | cba23a5e8d2175796912e738164c26da4ce345b6 /sesman/tools | |
parent | a8a2f0a0b0749fa0d7376d2322b05f3984356e29 (diff) | |
download | xrdp-proprietary-d14b076a700e1ad87048549945f0f1e658db6cd5.tar.gz xrdp-proprietary-d14b076a700e1ad87048549945f0f1e658db6cd5.zip |
still more work on logging
libscp makefile fix
Diffstat (limited to 'sesman/tools')
-rw-r--r-- | sesman/tools/Makefile | 19 | ||||
-rw-r--r-- | sesman/tools/sestest.c | 76 |
2 files changed, 54 insertions, 41 deletions
diff --git a/sesman/tools/Makefile b/sesman/tools/Makefile index 7313b7fc..bde00374 100644 --- a/sesman/tools/Makefile +++ b/sesman/tools/Makefile @@ -1,10 +1,15 @@ # sesman tools makefile - -SESTESTOBJ = sestest.o os_calls.o log.o +SESTESTOBJ = sestest.o \ + os_calls.o log.o +# d3des.o list.o file.o \ +# libscp_v1c.o tcp.o SESRUNOBJ = sesrun.o config.o tcp.o \ os_calls.o d3des.o list.o file.o log.o +SESADMINOBJ = sesadmin.o \ + os_calls.o log.o + CFGDIR = /etc/xrdp PIDDIR = /var/run MANDIR = /usr/local/man @@ -17,10 +22,11 @@ DEFINES = -DLIBSCP_CLIENT CFLAGS = -Wall -g -I../../common -I../ -I/usr/include/nptl -I../libscp $(DEFINES) LDFLAGS = -L/usr/gnu/lib -L/usr/lib/nptl -L../libscp -lpthread -ldl -lscp -Wl,-rpath,$(LIBDIR) #LDFLAGS = -L /usr/gnu/lib -ldl $(DEFINES) -C_OS_FLAGS = $(CFLAGS) -c +C_OS_FLAGS = $(CFLAGS) -c -g CC = gcc -all: xrdp-sestest xrdp-sesrun +all: xrdp-sestest xrdp-sesrun +# xrdp-sesadmin xrdp-sestest: $(SESTESTOBJ) $(CC) $(LDFLAGS) -o xrdp-sestest $(SESTESTOBJ) @@ -28,8 +34,11 @@ xrdp-sestest: $(SESTESTOBJ) xrdp-sesrun: $(SESRUNOBJ) $(CC) $(LDFLAGS) -o xrdp-sesrun $(SESRUNOBJ) +xrdp-sesadmin: $(SESADMINOBJ) + $(CC) $(LDFLAGS) -o xrdp-sesadmin $(SESADMINOBJ) + clean: - rm -f *.o xrdp-sestest xrdp-sesrun + rm -f *.o xrdp-sestest xrdp-sesrun xrdp-sesadmin install: install xrdp-sesrun $(BINDIR)/xrdp-sesrun diff --git a/sesman/tools/sestest.c b/sesman/tools/sestest.c index 78f526b1..03cd1a18 100644 --- a/sesman/tools/sestest.c +++ b/sesman/tools/sestest.c @@ -1,5 +1,5 @@ -/* - * sestest.c - an scp_v1 testing tool +/* + * sestest.c - an scp_v1 testing tool * (c) 2008 Simone Fedele * */ @@ -17,7 +17,8 @@ unsigned int menuSelect(unsigned int choices); int main(int argc, char** argv) { - struct SCP_SESSION s; + char buf[256]; + struct SCP_SESSION* s; struct SCP_CONNECTION* c; /*struct SCP_DISCONNECTED_SESSION ds;*/ struct SCP_DISCONNECTED_SESSION* dsl; @@ -29,7 +30,6 @@ int main(int argc, char** argv) int sel; int sock; - log.enable_syslog=0; log.log_level=99; log.program_name=g_strdup("sestest"); @@ -38,12 +38,8 @@ int main(int argc, char** argv) scp_init(&log); sock=g_tcp_socket(); - c=scp_connection_create(sock); - /*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();*/ + s = scp_session_create(); + c = scp_connection_create(sock); if (0!=g_tcp_connect(sock, "localhost", "3350")) { @@ -53,71 +49,78 @@ int main(int argc, char** argv) g_printf("001 - send connect request\n"); -/*struct SCP_SESSION -{ - uint16_t display; - char* errstr; -};*/ - - s.type=SCP_SESSION_TYPE_XVNC; + scp_session_set_type(s, SCP_SESSION_TYPE_XVNC); + scp_session_set_version(s, 1); + scp_session_set_height(s, 600); + scp_session_set_width(s, 800); + scp_session_set_bpp(s, 16); + scp_session_set_rsr(s, 0); + scp_session_set_locale(s, "it_IT"); + scp_session_set_username(s, "prog"); + scp_session_set_password(s, "prog"); + scp_session_set_hostname(s, "odin"); +// scp_session_set_addr(s, SCP_ADDRESS_TYPE_IPV4, "127.0.0.1"); +// scp_session_set_display(struct SCP_SESSION* s, SCP_DISPLAY display); +// scp_session_set_errstr(struct SCP_SESSION* s, char* str); + + /*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; + s.errstr=0;*/ end=0; - e=scp_v1c_connect(c,&s); + e=scp_v1c_connect(c,s); while (!end) { switch (e) { case SCP_CLIENT_STATE_OK: - g_printf("OK : display is %d\n", (short int)s.display); + g_printf("OK : display is %d\n", (short int)s->display); end=1; break; case SCP_CLIENT_STATE_SESSION_LIST: g_printf("OK : session list needed\n"); e=scp_v1c_get_session_list(c, &scnt, &dsl); - printf("Sessions: %d\n", scnt); - for (idx=0; idx <scnt; idx++) - { - printf("Session \t%d - %d - %dx%dx%d - %d %d %d\n", (dsl[idx]).SID, (dsl[idx]).type, (dsl[idx]).height, (dsl[idx]).width, (dsl[idx]).bpp, (dsl[idx]).idle_days, (dsl[idx]).idle_hours, (dsl[idx]).idle_minutes); - } break; case SCP_CLIENT_STATE_LIST_OK: g_printf("OK : selecting a session:\n"); + for (idx=0; idx <scnt; idx++) + { + printf("Session \t%d - %d - %dx%dx%d - %d %d %d - %4d/%2d/%2d@%2d:%2d\n", \ + (dsl[idx]).SID, (dsl[idx]).type, (dsl[idx]).width, (dsl[idx]).height, (dsl[idx]).bpp, \ + (dsl[idx]).idle_days, (dsl[idx]).idle_hours, (dsl[idx]).idle_minutes, \ + (dsl[idx]).conn_year, (dsl[idx]).conn_month, (dsl[idx]).conn_day, (dsl[idx]).conn_hour, (dsl[idx]).conn_minute); + } sel = menuSelect(scnt); - e=scp_v1c_select_session(c, &s, dsl[sel-1].SID); + e=scp_v1c_select_session(c, s, dsl[sel-1].SID); g_printf("\n return: %d \n", e); break; case SCP_CLIENT_STATE_RESEND_CREDENTIALS: - g_printf("ERR: resend credentials - %s\n", s.errstr); + g_printf("ERR: resend credentials - %s\n", s->errstr); g_printf(" username:"); - scanf("%255s", s.username); + scanf("%255s", buf); + scp_session_set_username(s, buf); g_printf(" password:"); - scanf("%255s", s.password); - e=scp_v1c_resend_credentials(c,&s); + scanf("%255s", buf); + scp_session_set_password(s, buf); + e=scp_v1c_resend_credentials(c,s); break; case SCP_CLIENT_STATE_CONNECTION_DENIED: - g_printf("ERR: connection denied: %s\n", s.errstr); + g_printf("ERR: connection denied: %s\n", s->errstr); end=1; break; case SCP_CLIENT_STATE_PWD_CHANGE_REQ: @@ -136,6 +139,7 @@ int main(int argc, char** argv) } g_tcp_close(sock); + scp_session_destroy(s); scp_connection_destroy(c); /*free_stream(c.in_s); free_stream(c.out_s);*/ |