|
21 |
*/ |
21 |
*/ |
22 |
|
22 |
|
23 |
#include "rdp.h" |
23 |
#include "rdp.h" |
|
|
24 |
#include <signal.h> |
25 |
#include <stdio.h> |
26 |
#include <unistd.h> |
27 |
#include <signal.h> |
28 |
#include <sys/types.h> |
29 |
#include <string.h> |
30 |
#include <stdlib.h> |
24 |
|
31 |
|
25 |
/******************************************************************************/ |
32 |
/******************************************************************************/ |
26 |
/* return error */ |
33 |
/* return error */ |
|
43 |
int DEFAULT_CC |
50 |
int DEFAULT_CC |
44 |
lib_mod_connect(struct mod* mod) |
51 |
lib_mod_connect(struct mod* mod) |
45 |
{ |
52 |
{ |
|
|
53 |
FILE *fdpass; |
54 |
char passpath[256]= "/tmp/"; |
55 |
char command[512] = "/usr/sbin/univention-dvs-sessionbroker-xrdp"; |
46 |
DEBUG(("in lib_mod_connect")); |
56 |
DEBUG(("in lib_mod_connect")); |
47 |
/* clear screen */ |
57 |
/* clear screen */ |
48 |
mod->server_begin_update(mod); |
58 |
mod->server_begin_update(mod); |
|
50 |
mod->server_fill_rect(mod, 0, 0, mod->width, mod->height); |
60 |
mod->server_fill_rect(mod, 0, 0, mod->width, mod->height); |
51 |
mod->server_end_update(mod); |
61 |
mod->server_end_update(mod); |
52 |
/* connect */ |
62 |
/* connect */ |
|
|
63 |
// hier reinhacken |
64 |
strcat(passpath,mod->username); |
65 |
fdpass = fopen(passpath,"w"); |
66 |
fprintf(fdpass,"%s\n",mod->password); |
67 |
fclose(fdpass); |
68 |
//strcat(command,cmd); |
69 |
strcat(command," -u "); |
70 |
strcat(command,mod->username); |
71 |
strcat(command," -y "); |
72 |
strcat(command,passpath); |
73 |
mod->pid = (pid_t*) malloc(sizeof(pid_t)); |
74 |
mod->fdpipe = popen(command, "r"); |
75 |
fscanf(mod->fdpipe,"%i\n",mod->pid); |
76 |
fscanf(mod->fdpipe,"%s",mod->ip); |
77 |
remove(passpath); |
53 |
if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0) |
78 |
if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0) |
54 |
{ |
79 |
{ |
55 |
mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck; |
80 |
mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck; |
|
326 |
int EXPORT_CC |
351 |
int EXPORT_CC |
327 |
mod_exit(struct mod* mod) |
352 |
mod_exit(struct mod* mod) |
328 |
{ |
353 |
{ |
|
|
354 |
kill(*(mod->pid),SIGUSR1); |
355 |
free(mod->pid); |
356 |
sleep(2); |
357 |
pclose(mod->fdpipe); |
329 |
DEBUG(("in mod_exit")); |
358 |
DEBUG(("in mod_exit")); |
330 |
g_free(mod); |
359 |
g_free(mod); |
331 |
DEBUG(("out mod_exit")); |
360 |
DEBUG(("out mod_exit")); |