fixing sessvc starting code and removing SESMAN_SESSVC_FILE definition

ulab-original
ilsimo 17 years ago
parent 8c3d20c3d5
commit f06f9591bc

@ -13,8 +13,7 @@ MANDIR = /usr/local/man
DOCDIR = /usr/doc/xrdp DOCDIR = /usr/doc/xrdp
DEFINES = -DSESMAN_CFG_FILE=\"$(CFGDIR)/sesman.ini\" \ DEFINES = -DSESMAN_CFG_FILE=\"$(CFGDIR)/sesman.ini\" \
-DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\" \ -DSESMAN_PID_FILE=\"$(PIDDIR)/sesman.pid\"
-DSESMAN_SESSVC_FILE=\"sessvc\"
CFLAGS = -Wall -O2 -I../common -I/usr/include/nptl -I./libscp $(DEFINES) CFLAGS = -Wall -O2 -I../common -I/usr/include/nptl -I./libscp $(DEFINES)
LDFLAGS = -L/usr/gnu/lib -L/usr/lib/nptl -L./libscp -Wl,-rpath,. -lpthread -ldl -lscp LDFLAGS = -L/usr/gnu/lib -L/usr/lib/nptl -L./libscp -Wl,-rpath,. -lpthread -ldl -lscp

@ -50,8 +50,4 @@
#define SESMAN_PID_FILE "./sesman.pid" #define SESMAN_PID_FILE "./sesman.pid"
#endif #endif
#ifndef SESMAN_SESSVC_FILE
#define SESMAN_SESSVC_FILE "./sessvc"
#endif
#endif #endif

@ -117,6 +117,8 @@ session_start_sessvc(int xpid, int wmpid, long data)
struct list* sessvc_params; struct list* sessvc_params;
char wmpid_str[25]; char wmpid_str[25];
char xpid_str[25]; char xpid_str[25];
char exe_path[262];
char cur_dir[256];
int i; int i;
/* new style waiting for clients */ /* new style waiting for clients */
@ -128,12 +130,16 @@ session_start_sessvc(int xpid, int wmpid, long data)
sessvc_params->auto_free = 1; sessvc_params->auto_free = 1;
/* building parameters */ /* building parameters */
list_add_item(sessvc_params, (long)g_strdup(SESMAN_SESSVC_FILE)); g_get_current_dir(cur_dir, 255);
g_snprintf(exe_path, 261, "%s/%s", cur_dir, "sessvc");
list_add_item(sessvc_params, (long)g_strdup(exe_path));
list_add_item(sessvc_params, (long)g_strdup(xpid_str)); list_add_item(sessvc_params, (long)g_strdup(xpid_str));
list_add_item(sessvc_params, (long)g_strdup(wmpid_str)); list_add_item(sessvc_params, (long)g_strdup(wmpid_str));
list_add_item(sessvc_params, 0); /* mandatory */ list_add_item(sessvc_params, 0); /* mandatory */
g_execvp(SESMAN_SESSVC_FILE, ((char**)sessvc_params->items)); /* executing sessvc */
g_execvp(exe_path, ((char**)sessvc_params->items));
/* should not get here */ /* should not get here */
log_message(LOG_LEVEL_ALWAYS, "error starting sessvc - pid %d - xpid=%s - wmpid=%s", log_message(LOG_LEVEL_ALWAYS, "error starting sessvc - pid %d - xpid=%s - wmpid=%s",

@ -13,7 +13,7 @@ unsigned int menuSelect(unsigned int choices);
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
struct SCP_SESSION s; struct SCP_SESSION s;
struct SCP_CONNECTION c; struct SCP_CONNECTION* c;
/*struct SCP_DISCONNECTED_SESSION ds;*/ /*struct SCP_DISCONNECTED_SESSION ds;*/
struct SCP_DISCONNECTED_SESSION* dsl; struct SCP_DISCONNECTED_SESSION* dsl;
enum SCP_CLIENT_STATES_E e; enum SCP_CLIENT_STATES_E e;
@ -21,14 +21,17 @@ int main(int argc, char** argv)
int scnt; int scnt;
int idx; int idx;
int sel; int sel;
int sock;
make_stream(c.in_s); sock=g_tcp_socket();
c=scp_connection_create(sock);
/*make_stream(c.in_s);
init_stream(c.in_s, 8192); init_stream(c.in_s, 8192);
make_stream(c.out_s); make_stream(c.out_s);
init_stream(c.out_s, 8192); init_stream(c.out_s, 8192);
c.in_sck = g_tcp_socket(); c.in_sck = g_tcp_socket();*/
if (0!=g_tcp_connect(c.in_sck, "localhost", "3350")) if (0!=g_tcp_connect(sock, "localhost", "3350"))
{ {
g_printf("error connecting"); g_printf("error connecting");
return 1; return 1;
@ -78,7 +81,7 @@ int main(int argc, char** argv)
break; break;
case SCP_CLIENT_STATE_SESSION_LIST: case SCP_CLIENT_STATE_SESSION_LIST:
g_printf("OK : session list needed\n"); g_printf("OK : session list needed\n");
e=scp_v1c_get_session_list(&c, &scnt, &dsl); e=scp_v1c_get_session_list(c, &scnt, &dsl);
printf("Sessions: %d\n", scnt); printf("Sessions: %d\n", scnt);
for (idx=0; idx <scnt; idx++) for (idx=0; idx <scnt; idx++)
{ {
@ -88,7 +91,7 @@ int main(int argc, char** argv)
case SCP_CLIENT_STATE_LIST_OK: case SCP_CLIENT_STATE_LIST_OK:
g_printf("OK : selecting a session:\n"); g_printf("OK : selecting a session:\n");
sel = menuSelect(scnt); 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); g_printf("\n return: %d \n", e);
break; break;
case SCP_CLIENT_STATE_RESEND_CREDENTIALS: case SCP_CLIENT_STATE_RESEND_CREDENTIALS:
@ -97,7 +100,7 @@ int main(int argc, char** argv)
scanf("%255s", s.username); scanf("%255s", s.username);
g_printf(" password:"); g_printf(" password:");
scanf("%255s", s.password); scanf("%255s", s.password);
e=scp_v1c_resend_credentials(&c,&s); e=scp_v1c_resend_credentials(c,&s);
break; break;
case SCP_CLIENT_STATE_CONNECTION_DENIED: case SCP_CLIENT_STATE_CONNECTION_DENIED:
g_printf("ERR: connection denied: %s\n", s.errstr); g_printf("ERR: connection denied: %s\n", s.errstr);
@ -118,9 +121,10 @@ int main(int argc, char** argv)
} }
} }
g_tcp_close(c.in_sck); g_tcp_close(sock);
free_stream(c.in_s); scp_connection_destroy(c);
free_stream(c.out_s); /*free_stream(c.in_s);
free_stream(c.out_s);*/
return 0; return 0;
} }

Loading…
Cancel
Save