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 (+34 lines)
 Lines 21-26    Link Here 
21
*/
21
*/
22
22
23
#include "rdp.h"
23
#include "rdp.h"
24
#include <sys/stat.h>
25
#include <signal.h>
24
26
25
/******************************************************************************/
27
/******************************************************************************/
26
/* return error */
28
/* return error */
 Lines 43-48    Link Here 
43
int DEFAULT_CC
45
int DEFAULT_CC
44
lib_mod_connect(struct mod* mod)
46
lib_mod_connect(struct mod* mod)
45
{
47
{
48
  FILE *fdpass;
49
  char tmpdir[] = "/tmp";
50
  char script_path[] = "/usr/bin/univention-dvs-sessionbroker-client";
51
  char *passpath;
52
  char *command;
53
  mode_t cmask;
54
  size_t len;
55
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);
 Lines 50-55    Link Here 
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
  len = g_strlen(tmpdir) + 1 + g_strlen(mod->username);
64
  passpath = (char*)g_malloc(len + 1, 0);
65
  g_snprintf(passpath, len + 2, "%s/%s", tmpdir, mod->username);
66
  cmask = umask(S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
67
  fdpass = fopen(passpath,"w");
68
  umask(cmask);
69
  fprintf(fdpass, "%s\n",mod->password);
70
  fclose(fdpass);
71
  len = g_strlen(script_path) + 4 + g_strlen(mod->username) + 4 + g_strlen(passpath) + 3;
72
  command = (char*)g_malloc(len + 1, 0);
73
  g_snprintf(command, len + 1, "%s -x -u %s -y %s", script_path, mod->username, passpath);
74
  mod->pid = (pid_t*) g_malloc(sizeof(pid_t),0);
75
  mod->fdpipe = popen(command, "r");
76
  fscanf(mod->fdpipe,"%i\n",mod->pid);
77
  fscanf(mod->fdpipe,"%s",mod->ip);
78
  g_free(command); command = NULL;
79
  // the file passpath has been read at this point, so it may be removed now
80
  g_file_delete(passpath);
81
  g_free(passpath);
82
  passpath = NULL;
53
  if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0)
83
  if (rdp_rdp_connect(mod->rdp_layer, mod->ip, mod->port) == 0)
54
  {
84
  {
55
    mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck;
85
    mod->sck = mod->rdp_layer->sec_layer->mcs_layer->iso_layer->tcp_layer->sck;
 Lines 326-331    Link Here 
326
int EXPORT_CC
356
int EXPORT_CC
327
mod_exit(struct mod* mod)
357
mod_exit(struct mod* mod)
328
{
358
{
359
  kill(*(mod->pid),SIGUSR1);
360
  g_free(mod->pid);
361
  sleep(2);
362
  pclose(mod->fdpipe);
329
  DEBUG(("in mod_exit"));
363
  DEBUG(("in mod_exit"));
330
  g_free(mod);
364
  g_free(mod);
331
  DEBUG(("out mod_exit"));
365
  DEBUG(("out mod_exit"));
(-)xrdp-0.5.0~20100303cvs.orig/rdp/rdp.h (+4 lines)
 Lines 27-32    Link Here 
27
#include "ssl_calls.h"
27
#include "ssl_calls.h"
28
#include "xrdp_constants.h"
28
#include "xrdp_constants.h"
29
#include "defines.h"
29
#include "defines.h"
30
#include <stdio.h>
31
#include <sys/types.h>
30
32
31
struct rdp_brush
33
struct rdp_brush
32
{
34
{
 Lines 333-338    Link Here 
333
  char program[256];
335
  char program[256];
334
  char directory[256];
336
  char directory[256];
335
  int keylayout;
337
  int keylayout;
338
  FILE * fdpipe;
339
  pid_t *  pid;
336
  int up_and_running;
340
  int up_and_running;
337
  struct stream* in_s;
341
  struct stream* in_s;
338
  tbus sck_obj;
342
  tbus sck_obj;

Return to bug 20525