/[rdesktop]/sourceforge.net/trunk/rdesktop/rdesktop.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdesktop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 222 by matthewc, Fri Oct 11 04:00:32 2002 UTC revision 263 by astrand, Mon Nov 18 18:12:49 2002 UTC
# Line 45  char username[16]; Line 45  char username[16];
45  char hostname[16];  char hostname[16];
46  char keymapname[16];  char keymapname[16];
47  int keylayout = 0x409;          /* Defaults to US keyboard layout */  int keylayout = 0x409;          /* Defaults to US keyboard layout */
48  int width = 800;  int width = 800;                /* If width or height are reset to zero, the geometry will
49                                       be fetched from _NET_WORKAREA */
50  int height = 600;  int height = 600;
51  int tcp_port_rdp = TCP_PORT_RDP;  int tcp_port_rdp = TCP_PORT_RDP;
52  BOOL bitmap_compression = True;  BOOL bitmap_compression = True;
# Line 55  BOOL encryption = True; Line 56  BOOL encryption = True;
56  BOOL desktop_save = True;  BOOL desktop_save = True;
57  BOOL fullscreen = False;  BOOL fullscreen = False;
58  BOOL grab_keyboard = True;  BOOL grab_keyboard = True;
59    BOOL hide_decorations = False;
60    
61  /* Display usage information */  /* Display usage information */
62  static void  static void
# Line 71  usage(char *program) Line 73  usage(char *program)
73          fprintf(stderr, "   -c: working directory\n");          fprintf(stderr, "   -c: working directory\n");
74          fprintf(stderr, "   -p: password (- to prompt)\n");          fprintf(stderr, "   -p: password (- to prompt)\n");
75          fprintf(stderr, "   -n: client hostname\n");          fprintf(stderr, "   -n: client hostname\n");
76          fprintf(stderr, "   -k: keyboard layout on terminal server (us,sv,gr etc.)\n");          fprintf(stderr, "   -k: keyboard layout on terminal server (us,sv,gr,etc.)\n");
77          fprintf(stderr, "   -g: desktop geometry (WxH)\n");          fprintf(stderr, "   -g: desktop geometry (WxH)\n");
78          fprintf(stderr, "   -f: full-screen mode\n");          fprintf(stderr, "   -f: full-screen mode\n");
79          fprintf(stderr, "   -b: force bitmap updates\n");          fprintf(stderr, "   -b: force bitmap updates\n");
80          fprintf(stderr, "   -e: disable encryption (French TS)\n");          fprintf(stderr, "   -e: disable encryption (French TS)\n");
81          fprintf(stderr, "   -m: do not send motion events\n");          fprintf(stderr, "   -m: do not send motion events\n");
82          fprintf(stderr, "   -K: keep window manager key bindings\n");          fprintf(stderr, "   -K: keep window manager key bindings\n");
83          fprintf(stderr, "   -w: window title\n");          fprintf(stderr, "   -T: window title\n");
84            fprintf(stderr, "   -D: hide window manager decorations\n");
85  }  }
86    
87  static BOOL  static BOOL
# Line 125  main(int argc, char *argv[]) Line 128  main(int argc, char *argv[])
128          char fullhostname[64];          char fullhostname[64];
129          char domain[16];          char domain[16];
130          char password[16];          char password[16];
131          char shell[32];          char shell[128];
132          char directory[32];          char directory[32];
133          BOOL prompt_password;          BOOL prompt_password;
134          struct passwd *pw;          struct passwd *pw;
# Line 136  main(int argc, char *argv[]) Line 139  main(int argc, char *argv[])
139          flags = RDP_LOGON_NORMAL;          flags = RDP_LOGON_NORMAL;
140          prompt_password = False;          prompt_password = False;
141          domain[0] = password[0] = shell[0] = directory[0] = 0;          domain[0] = password[0] = shell[0] = directory[0] = 0;
142          strcpy(keymapname, "us");          strcpy(keymapname, "en-us");
143    
144          while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKw:h?")) != -1)          while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKT:Dh?")) != -1)
145          {          {
146                  switch (c)                  switch (c)
147                  {                  {
# Line 183  main(int argc, char *argv[]) Line 186  main(int argc, char *argv[])
186                                  break;                                  break;
187    
188                          case 'g':                          case 'g':
189                                    if (!strcmp(optarg, "workarea"))
190                                    {
191                                            width = height = 0;
192                                            break;
193                                    }
194    
195                                  width = strtol(optarg, &p, 10);                                  width = strtol(optarg, &p, 10);
196                                  if (*p == 'x')                                  if (*p == 'x')
197                                          height = strtol(p + 1, NULL, 10);                                          height = strtol(p + 1, NULL, 10);
# Line 214  main(int argc, char *argv[]) Line 223  main(int argc, char *argv[])
223                                  grab_keyboard = False;                                  grab_keyboard = False;
224                                  break;                                  break;
225    
226                          case 'w':                          case 'T':
227                                  STRNCPY(title, optarg, sizeof(title));                                  STRNCPY(title, optarg, sizeof(title));
228                                  break;                                  break;
229    
230                            case 'D':
231                                    hide_decorations = True;
232                                    break;
233    
234                          case 'h':                          case 'h':
235                          case '?':                          case '?':
236                          default:                          default:
# Line 312  generate_random_egd(uint8 * buf) Line 325  generate_random_egd(uint8 * buf)
325    
326          addr.sun_family = AF_UNIX;          addr.sun_family = AF_UNIX;
327          memcpy(addr.sun_path, EGD_SOCKET, sizeof(EGD_SOCKET));          memcpy(addr.sun_path, EGD_SOCKET, sizeof(EGD_SOCKET));
328          if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1)          if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
329                  goto err;                  goto err;
330    
331          /* PRNGD and EGD use a simple communications protocol */          /* PRNGD and EGD use a simple communications protocol */
332          buf[0] = 1;  /* Non-blocking (similar to /dev/urandom) */          buf[0] = 1;             /* Non-blocking (similar to /dev/urandom) */
333          buf[1] = 32; /* Number of requested random bytes */          buf[1] = 32;            /* Number of requested random bytes */
334          if (write(fd, buf, 2) != 2)          if (write(fd, buf, 2) != 2)
335                  goto err;                  goto err;
336    
337          if ((read(fd, buf, 1) != 1) || (buf[0] == 0)) /* Available? */          if ((read(fd, buf, 1) != 1) || (buf[0] == 0))   /* Available? */
338                  goto err;                  goto err;
339    
340          if (read(fd, buf, 32) != 32)          if (read(fd, buf, 32) != 32)
# Line 329  generate_random_egd(uint8 * buf) Line 342  generate_random_egd(uint8 * buf)
342    
343          ret = True;          ret = True;
344    
345  err:        err:
346          close(fd);          close(fd);
347          return ret;          return ret;
348  }  }
# Line 362  generate_random(uint8 * random) Line 375  generate_random(uint8 * random)
375  #endif  #endif
376    
377          /* Otherwise use whatever entropy we can gather - ideas welcome. */          /* Otherwise use whatever entropy we can gather - ideas welcome. */
378          r = (uint32 *)random;          r = (uint32 *) random;
379          r[0] = (getpid()) | (getppid() << 16);          r[0] = (getpid()) | (getppid() << 16);
380          r[1] = (getuid()) | (getgid() << 16);          r[1] = (getuid()) | (getgid() << 16);
381          r[2] = times(&tmsbuf);  /* system uptime (clocks) */          r[2] = times(&tmsbuf);  /* system uptime (clocks) */
# Line 374  generate_random(uint8 * random) Line 387  generate_random(uint8 * random)
387    
388          /* Hash both halves with MD5 to obscure possible patterns */          /* Hash both halves with MD5 to obscure possible patterns */
389          MD5_Init(&md5);          MD5_Init(&md5);
390          MD5_Update(&md5, random, 16);          MD5_Update(&md5, random, 16);
391          MD5_Final(random, &md5);          MD5_Final(random, &md5);
392          MD5_Update(&md5, random+16, 16);          MD5_Update(&md5, random + 16, 16);
393          MD5_Final(random+16, &md5);          MD5_Final(random + 16, &md5);
394  }  }
395    
396  /* malloc; exit if out of memory */  /* malloc; exit if out of memory */

Legend:
Removed from v.222  
changed lines
  Added in v.263

  ViewVC Help
Powered by ViewVC 1.1.26