From ec7498b5f901abcddfba3d3bc608f67e9619bd1c Mon Sep 17 00:00:00 2001 From: ilsimo Date: Thu, 9 Feb 2006 18:01:41 +0000 Subject: [PATCH] added nicer support for Xrdp fixed some errors in Makefiles when installing --- Makefile | 4 +++- sesman/Makefile | 8 ++++++-- sesman/sesman.c | 18 ++++++++++++++---- sesman/session.c | 38 ++++++++++++++++++++++++++++++-------- sesman/session.h | 2 +- 5 files changed, 54 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 3d94d513..75c10990 100644 --- a/Makefile +++ b/Makefile @@ -19,9 +19,11 @@ base: nopam: base make -C sesman nopam + make -C sesman tools kerberos: base make -C sesman kerberos + make -C sesman tools clean: make -C vnc clean @@ -44,6 +46,6 @@ install: make -C sesman install make -C xup install make -C docs install - install instfiles/pam.d/sesman /etc/pam.d/sesman + if [ -d /etc/pam.d ]; then install instfiles/pam.d/sesman /etc/pam.d/sesman; fi install instfiles/xrdpstart.sh $(DESTDIR)/xrdpstart.sh install instfiles/xrdp_control.sh $(DESTDIR)/xrdp_control.sh diff --git a/sesman/Makefile b/sesman/Makefile index b9bb0e06..797404c7 100644 --- a/sesman/Makefile +++ b/sesman/Makefile @@ -22,7 +22,11 @@ CC = gcc all: pam tools -nopam: $(SESMANOBJ) verify_user.o +nopam: no-pam tools + +kerberos: kerberos-base tools + +no-pam: $(SESMANOBJ) verify_user.o $(CC) $(LDFLAGS) -o sesman $(SESMANOBJ) verify_user.o -ldl -lcrypt pam: $(SESMANOBJ) verify_user_pam.o @@ -31,7 +35,7 @@ pam: $(SESMANOBJ) verify_user_pam.o pam_userpass: $(SESMANOBJ) verify_user_pam_userpass.o $(CC) $(LDFLAGS) -o sesman $(SESMANOBJ) verify_user_pam_userpass.o -ldl -lpam -lpam_userpass -kerberos: $(SESMANOBJ) verify_user_kerberos.o +kerberos-base: $(SESMANOBJ) verify_user_kerberos.o $(CC) $(LDFLAGS) -o sesman $(SESMANOBJ) verify_user_kerberos.o -ldl -lkrb5 tools: $(SESRUNOBJ) diff --git a/sesman/sesman.c b/sesman/sesman.c index fb9666ce..f2d51da0 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -37,7 +37,7 @@ struct session_item g_session_items[100]; /* sesman.h */ extern int g_session_count; #endif struct config_sesman g_cfg; /* config.h */ -int g_server_type = 0; /* Xvnc 0 Xrdp 10 */ +//int g_server_type = 0; /* Xvnc 0 Xrdp 10 */ /** * @@ -137,7 +137,7 @@ sesman_main_loop() in_uint16_be(in_s, code); if (code == 0 || code == 10) /* check username - password, */ { /* start session */ - g_server_type = code; + //g_server_type = code; in_uint16_be(in_s, i); in_uint8a(in_s, user, i); user[i] = 0; @@ -165,8 +165,18 @@ sesman_main_loop() if (1==access_login_allowed(user)) { log_message(LOG_LEVEL_INFO, "granted TS access to user %s", user); - display = session_start(width, height, bpp, user, pass, - data); + if (0 == code) + { + log_message(LOG_LEVEL_INFO, "starting Xvnc session..."); + display = session_start(width, height, bpp, user, pass, + data, SESMAN_SESSION_TYPE_XVNC); + } + else + { + log_message(LOG_LEVEL_INFO, "starting Xrdp session..."); + display = session_start(width, height, bpp, user, pass, + data, SESMAN_SESSION_TYPE_XRDP); + } } else { diff --git a/sesman/session.c b/sesman/session.c index afc3c4d2..412dc317 100644 --- a/sesman/session.c +++ b/sesman/session.c @@ -27,7 +27,7 @@ extern unsigned char g_fixedkey[8]; extern struct config_sesman g_cfg; /* config.h */ -extern int g_server_type; +//extern int g_server_type; #ifdef OLDSESSION extern struct session_item g_session_items[100]; /* sesman.h */ #else @@ -98,7 +98,7 @@ x_server_running(int display) /* returns 0 if error else the display number the session was started on */ int DEFAULT_CC session_start(int width, int height, int bpp, char* username, char* password, - long data) + long data, unsigned char type) { int display; int pid; @@ -206,19 +206,24 @@ session_start(int width, int height, int bpp, char* username, char* password, { env_set_user(username, passwd_file, display); env_check_password_file(passwd_file, password); - if (g_server_type == 0) + if (type == SESMAN_SESSION_TYPE_XVNC) { g_execlp11("Xvnc", "Xvnc", screen, "-geometry", geometry, "-depth", depth, "-bs", "-rfbauth", passwd_file, 0); } - else if (g_server_type == 10) + else if (type == SESMAN_SESSION_TYPE_XRDP) { g_execlp11("Xrdp", "Xrdp", screen, "-geometry", geometry, "-depth", depth, "-bs", 0, 0, 0); } + else + { + log_message(LOG_LEVEL_ALWAYS, "bad session type - user %s - pid %d", username, g_getpid()); + g_exit(1); + } /* should not get here */ log_message(LOG_LEVEL_ALWAYS,"error doing execve for user %s - pid %d",username,g_getpid()); - g_exit(0); + g_exit(1); } else /* parent */ { @@ -245,8 +250,16 @@ session_start(int width, int height, int bpp, char* username, char* password, g_session_items[display].connect_time=g_time1(); g_session_items[display].disconnect_time=(time_t) 0; g_session_items[display].idle_time=(time_t) 0; - - g_session_items[display].type=SESMAN_SESSION_TYPE_XVNC; + + i/*if (type==0) + { + g_session_items[display].type=SESMAN_SESSION_TYPE_XVNC; + } + else + { + g_session_items[display].type=SESMAN_SESSION_TYPE_XRDP; + }*/ + g_session_items[display].type=type; g_session_items[display].status=SESMAN_SESSION_STATUS_ACTIVE; g_session_count++; @@ -263,7 +276,16 @@ session_start(int width, int height, int bpp, char* username, char* password, temp->item->disconnect_time=(time_t) 0; temp->item->idle_time=(time_t) 0; - temp->item->type=SESMAN_SESSION_TYPE_XVNC; +/* if (type==0) + { + temp->item->type=SESMAN_SESSION_TYPE_XVNC; + } + else + { + temp->item->type=SESMAN_SESSION_TYPE_XRDP; + }*/ + + temp->item->type=type; temp->item->status=SESMAN_SESSION_STATUS_ACTIVE; /*THREAD-FIX lock the chain*/ diff --git a/sesman/session.h b/sesman/session.h index 5d677911..a38300c8 100644 --- a/sesman/session.h +++ b/sesman/session.h @@ -86,7 +86,7 @@ session_get_bydata(char* name, int width, int height, int bpp); */ int DEFAULT_CC session_start(int width, int height, int bpp, char* username, char* password, - long data); + long data, unsigned char type); /** *