/[rdesktop]/jpeg/rdesktop/trunk/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 /jpeg/rdesktop/trunk/rdesktop.c

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

sourceforge.net/trunk/rdesktop/rdesktop.c revision 1391 by jsorg71, Sat Feb 10 05:29:59 2007 UTC jpeg/rdesktop/trunk/rdesktop.c revision 1508 by dpavlin, Mon Jul 20 16:47:49 2009 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     Entrypoint and utility functions     Entrypoint and utility functions
4     Copyright (C) Matthew Chapman 1999-2007     Copyright (C) Matthew Chapman 1999-2008
5    
6     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 47  Line 47 
47    
48  #include "ssl.h"  #include "ssl.h"
49    
50    /* DJ globals begin */
51    unsigned long long g_time_last_write = 0;
52    unsigned long long g_time_last_change = 0;
53    uint32 g_pixels_changed;
54    uint8 * g_bitmap_data = 0;
55    uint8 * g_bitmap_data_last_write = 0;
56    /* DJ globals end */
57    
58  char g_title[64] = "";  char g_title[64] = "";
59  char g_username[64];  char *g_username;
60  char g_hostname[16];  char g_hostname[16];
61  char g_keymapname[PATH_MAX] = "";  char g_keymapname[PATH_MAX] = "";
62  unsigned int g_keylayout = 0x409;       /* Defaults to US keyboard layout */  unsigned int g_keylayout = 0x409;       /* Defaults to US keyboard layout */
# Line 77  RD_BOOL g_bitmap_cache = True; Line 85  RD_BOOL g_bitmap_cache = True;
85  RD_BOOL g_bitmap_cache_persist_enable = False;  RD_BOOL g_bitmap_cache_persist_enable = False;
86  RD_BOOL g_bitmap_cache_precache = True;  RD_BOOL g_bitmap_cache_precache = True;
87  RD_BOOL g_encryption = True;  RD_BOOL g_encryption = True;
88  RD_BOOL packet_encryption = True;  RD_BOOL g_packet_encryption = True;
89  RD_BOOL g_desktop_save = True;  /* desktop save order */  RD_BOOL g_desktop_save = True;  /* desktop save order */
90  RD_BOOL g_polygon_ellipse_orders = True;        /* polygon / ellipse orders */  RD_BOOL g_polygon_ellipse_orders = True;        /* polygon / ellipse orders */
91  RD_BOOL g_fullscreen = False;  RD_BOOL g_fullscreen = False;
# Line 87  RD_BOOL g_use_rdp5 = True; Line 95  RD_BOOL g_use_rdp5 = True;
95  RD_BOOL g_rdpclip = True;  RD_BOOL g_rdpclip = True;
96  RD_BOOL g_console_session = False;  RD_BOOL g_console_session = False;
97  RD_BOOL g_numlock_sync = False;  RD_BOOL g_numlock_sync = False;
98  RD_BOOL lspci_enabled = False;  RD_BOOL g_lspci_enabled = False;
99  RD_BOOL g_owncolmap = False;  RD_BOOL g_owncolmap = False;
100  RD_BOOL g_ownbackstore = True;  /* We can't rely on external BackingStore */  RD_BOOL g_ownbackstore = True;  /* We can't rely on external BackingStore */
101  RD_BOOL g_seamless_rdp = False;  RD_BOOL g_seamless_rdp = False;
# Line 99  RD_BOOL g_redirect = False; Line 107  RD_BOOL g_redirect = False;
107  char g_redirect_server[64];  char g_redirect_server[64];
108  char g_redirect_domain[16];  char g_redirect_domain[16];
109  char g_redirect_password[64];  char g_redirect_password[64];
110  char g_redirect_username[64];  char *g_redirect_username;
111  char g_redirect_cookie[128];  char g_redirect_cookie[128];
112  uint32 g_redirect_flags = 0;  uint32 g_redirect_flags = 0;
113    
# Line 127  static void Line 135  static void
135  usage(char *program)  usage(char *program)
136  {  {
137          fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n");          fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n");
138          fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2007 Matt Chapman.\n");          fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2008 Matthew Chapman.\n");
139          fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");          fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n");
140    
141          fprintf(stderr, "Usage: %s [options] server[:port]\n", program);          fprintf(stderr, "Usage: %s [options] server[:port]\n", program);
# Line 473  main(int argc, char *argv[]) Line 481  main(int argc, char *argv[])
481                                  break;                                  break;
482    
483                          case 'u':                          case 'u':
484                                  STRNCPY(g_username, optarg, sizeof(g_username));                                  g_username = (char *) xmalloc(strlen(optarg) + 1);
485                                    STRNCPY(g_username, optarg, strlen(optarg) + 1);
486                                  username_option = 1;                                  username_option = 1;
487                                  break;                                  break;
488    
# Line 582  main(int argc, char *argv[]) Line 591  main(int argc, char *argv[])
591                                  g_encryption = False;                                  g_encryption = False;
592                                  break;                                  break;
593                          case 'E':                          case 'E':
594                                  packet_encryption = False;                                  g_packet_encryption = False;
595                                  break;                                  break;
596                          case 'm':                          case 'm':
597                                  g_sendmotion = False;                                  g_sendmotion = False;
# Line 633  main(int argc, char *argv[]) Line 642  main(int argc, char *argv[])
642                                  g_server_depth = strtol(optarg, NULL, 10);                                  g_server_depth = strtol(optarg, NULL, 10);
643                                  if (g_server_depth != 8 &&                                  if (g_server_depth != 8 &&
644                                      g_server_depth != 16 &&                                      g_server_depth != 16 &&
645                                      g_server_depth != 15 && g_server_depth != 24)                                      g_server_depth != 15 && g_server_depth != 24
646                                        && g_server_depth != 32)
647                                  {                                  {
648                                          error("Invalid server colour depth.\n");                                          error("Invalid server colour depth.\n");
649                                          return 1;                                          return 1;
# Line 726  main(int argc, char *argv[]) Line 736  main(int argc, char *argv[])
736                                  }                                  }
737                                  else if (str_startswith(optarg, "lspci"))                                  else if (str_startswith(optarg, "lspci"))
738                                  {                                  {
739                                          lspci_enabled = True;                                          g_lspci_enabled = True;
740                                  }                                  }
741                                  else if (str_startswith(optarg, "lptport"))                                  else if (str_startswith(optarg, "lptport"))
742                                  {                                  {
# Line 845  main(int argc, char *argv[]) Line 855  main(int argc, char *argv[])
855                          error("could not determine username, use -u\n");                          error("could not determine username, use -u\n");
856                          return 1;                          return 1;
857                  }                  }
858                    /* +1 for trailing \0 */
859                  STRNCPY(g_username, pw->pw_name, sizeof(g_username));                  int pwlen = strlen(pw->pw_name) + 1;
860                    g_username = (char *) xmalloc(pwlen);
861                    STRNCPY(g_username, pw->pw_name, pwlen);
862          }          }
863    
864  #ifdef HAVE_ICONV  #ifdef HAVE_ICONV
# Line 920  main(int argc, char *argv[]) Line 932  main(int argc, char *argv[])
932          }          }
933  #endif  #endif
934    
935          if (lspci_enabled)          if (g_lspci_enabled)
936                  lspci_init();                  lspci_init();
937    
938          rdpdr_init();          rdpdr_init();
# Line 938  main(int argc, char *argv[]) Line 950  main(int argc, char *argv[])
950    
951                  /* By setting encryption to False here, we have an encrypted login                  /* By setting encryption to False here, we have an encrypted login
952                     packet but unencrypted transfer of other packets */                     packet but unencrypted transfer of other packets */
953                  if (!packet_encryption)                  if (!g_packet_encryption)
954                          g_encryption = False;                          g_encryption = False;
955    
956    
# Line 961  main(int argc, char *argv[]) Line 973  main(int argc, char *argv[])
973                          rdesktop_reset_state();                          rdesktop_reset_state();
974    
975                          STRNCPY(domain, g_redirect_domain, sizeof(domain));                          STRNCPY(domain, g_redirect_domain, sizeof(domain));
976                            xfree(g_username);
977                            g_username = (char *) xmalloc(strlen(g_redirect_username) + 1);
978                          STRNCPY(g_username, g_redirect_username, sizeof(g_username));                          STRNCPY(g_username, g_redirect_username, sizeof(g_username));
979                          STRNCPY(password, g_redirect_password, sizeof(password));                          STRNCPY(password, g_redirect_password, sizeof(password));
980                          STRNCPY(server, g_redirect_server, sizeof(server));                          STRNCPY(server, g_redirect_server, sizeof(server));
# Line 1005  main(int argc, char *argv[]) Line 1019  main(int argc, char *argv[])
1019          }          }
1020    
1021  #endif  #endif
1022            if (g_redirect_username)
1023                    xfree(g_redirect_username);
1024    
1025            xfree(g_username);
1026  }  }
1027    
1028  #ifdef EGD_SOCKET  #ifdef EGD_SOCKET
# Line 1130  xstrdup(const char *s) Line 1147  xstrdup(const char *s)
1147    
1148  /* realloc; exit if out of memory */  /* realloc; exit if out of memory */
1149  void *  void *
1150  xrealloc(void *oldmem, int size)  xrealloc(void *oldmem, size_t size)
1151  {  {
1152          void *mem;          void *mem;
1153    
1154          if (size < 1)          if (size == 0)
1155                  size = 1;                  size = 1;
1156          mem = realloc(oldmem, size);          mem = realloc(oldmem, size);
1157          if (mem == NULL)          if (mem == NULL)
1158          {          {
1159                  error("xrealloc %d\n", size);                  error("xrealloc %ld\n", size);
1160                  exit(1);                  exit(1);
1161          }          }
1162          return mem;          return mem;

Legend:
Removed from v.1391  
changed lines
  Added in v.1508

  ViewVC Help
Powered by ViewVC 1.1.26