View | Details | Raw Unified | Return to bug 20525 | Differences between
and this patch

Collapse All | Expand All

(-)xrdp-0.5.0~20100303cvs.orig/rdp/rdp.c (+37 lines)
 Lines 21-26    Link Here 
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 */
 Lines 43-48    Link Here 
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 tmpdir[] = "/tmp";
55
  char script_path[] = "/usr/sbin/univention-dvs-sessionbroker-xrdp";
56
  char *passpath;
57
  char *command;
58
  mode_t cmask;
46
  DEBUG(("in lib_mod_connect"));
59
  DEBUG(("in lib_mod_connect"));
47
  /* clear screen */
60
  /* clear screen */
48
  mod->server_begin_update(mod);
61
  mod->server_begin_update(mod);
 Lines 50-55    Link Here 
50
  mod->server_fill_rect(mod, 0, 0, mod->width, mod->height);
63
  mod->server_fill_rect(mod, 0, 0, mod->width, mod->height);
51
  mod->server_end_update(mod);
64
  mod->server_end_update(mod);
52
  /* connect */
65
  /* connect */
66
  len = g_strlen(tmpdir) + 1 + g_strlen(mod->username);
67
  passpath = (char*)g_malloc(len + 1, 0);
68
  g_snprintf(passpath, len + 1, "%s/%s", tmpdir, mod->username);
69
  cmask = umask(S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
70
  fdpass = fopen(passpath,"w");
71
  umask(cmask);
72
  fprintf(fdpass,"%s\n",mod->password);
73
  fclose(fdpass);
74
  //strcat(command,cmd);
75
  len = g_strlen(script_path) + 4 + g_strlen(mod->username), + 4 + g_strlen(passpath);
76
  command = (char*)g_malloc(len + 1, 0);
77
  g_snprintf(command, len + 1, "%s -u %s -y %s", script_path, mod->username, passpath);
78
  mod->pid = (pid_t*) malloc(sizeof(pid_t));
79
  mod->fdpipe = popen(command, "r");
80
  fscanf(mod->fdpipe,"%i\n",mod->pid);
81
  fscanf(mod->fdpipe,"%s",mod->ip);
82
  free(command); command = NULL;
83
  // the file passpath has been read at this point, so it may be removed now
84
  remove(passpath);
85
  free(passpath); passpath = NULL;
53
  if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0)
86
  if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0)
54
  {
87
  {
55
    mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck;
88
    mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck;
 Lines 326-331    Link Here 
326
int EXPORT_CC
359
int EXPORT_CC
327
mod_exit(struct mod* mod)
360
mod_exit(struct mod* mod)
328
{
361
{
362
  kill(*(mod->pid),SIGUSR1);
363
  free(mod->pid);
364
  sleep(2);
365
  pclose(mod->fdpipe);
329
  DEBUG(("in mod_exit"));
366
  DEBUG(("in mod_exit"));
330
  g_free(mod);
367
  g_free(mod);
331
  DEBUG(("out mod_exit"));
368
  DEBUG(("out mod_exit"));

Return to bug 20525