/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/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/branches/seamlessrdp-branch/rdesktop/rdesktop.c

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

revision 582 by n-ki, Fri Jan 23 14:37:51 2004 UTC revision 710 by jsorg71, Tue Jun 15 22:17:08 2004 UTC
# Line 43  Line 43 
43    
44  char g_title[64] = "";  char g_title[64] = "";
45  char g_username[64];  char g_username[64];
46  char hostname[16];  char g_hostname[16];
47  char keymapname[16];  char keymapname[16];
48  int keylayout = 0x409;          /* Defaults to US keyboard layout */  int g_keylayout = 0x409;        /* Defaults to US keyboard layout */
49    
50  int g_width = 800;              /* width is special: If 0, the  int g_width = 800;              /* width is special: If 0, the
51                                     geometry will be fetched from                                     geometry will be fetched from
# Line 53  int g_width = 800;             /* width is special: Line 53  int g_width = 800;             /* width is special:
53                                     absolute value specifies the                                     absolute value specifies the
54                                     percent of the whole screen. */                                     percent of the whole screen. */
55  int g_height = 600;  int g_height = 600;
56  int tcp_port_rdp = TCP_PORT_RDP;  extern int g_tcp_port_rdp;
57  int g_server_bpp = 8;  int g_server_bpp = 8;
58  int g_win_button_size = 0;      /* If zero, disable single app mode */  int g_win_button_size = 0;      /* If zero, disable single app mode */
59  BOOL g_bitmap_compression = True;  BOOL g_bitmap_compression = True;
60  BOOL g_sendmotion = True;  BOOL g_sendmotion = True;
61  BOOL g_orders = True;  BOOL g_bitmap_cache = True;
62  BOOL g_encryption = True;  BOOL g_encryption = True;
63  BOOL packet_encryption = True;  BOOL packet_encryption = True;
64  BOOL g_desktop_save = True;  BOOL g_desktop_save = True;
# Line 68  BOOL g_hide_decorations = False; Line 68  BOOL g_hide_decorations = False;
68  BOOL g_use_rdp5 = True;  BOOL g_use_rdp5 = True;
69  BOOL g_console_session = False;  BOOL g_console_session = False;
70  BOOL g_numlock_sync = False;  BOOL g_numlock_sync = False;
71  extern BOOL g_owncolmap;  BOOL g_owncolmap = False;
72    BOOL g_ownbackstore = True;     /* We can't rely on external BackingStore */
73    uint32 g_embed_wnd;
74    uint32 g_rdp5_performanceflags =
75            RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS;
76    
77  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
78  BOOL g_rdpsnd = False;  BOOL g_rdpsnd = False;
# Line 76  BOOL g_rdpsnd = False; Line 80  BOOL g_rdpsnd = False;
80    
81  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
82  extern uint32 g_num_devices;  extern uint32 g_num_devices;
83    extern char *g_rdpdr_clientname;
84    
85  #ifdef RDP2VNC  #ifdef RDP2VNC
86  extern int rfb_port;  extern int rfb_port;
# Line 107  usage(char *program) Line 112  usage(char *program)
112          fprintf(stderr, "   -g: desktop geometry (WxH)\n");          fprintf(stderr, "   -g: desktop geometry (WxH)\n");
113          fprintf(stderr, "   -f: full-screen mode\n");          fprintf(stderr, "   -f: full-screen mode\n");
114          fprintf(stderr, "   -b: force bitmap updates\n");          fprintf(stderr, "   -b: force bitmap updates\n");
115            fprintf(stderr, "   -B: use BackingStore of X-server (if available)\n");
116          fprintf(stderr, "   -e: disable encryption (French TS)\n");          fprintf(stderr, "   -e: disable encryption (French TS)\n");
117          fprintf(stderr, "   -E: disable encryption from client to server\n");          fprintf(stderr, "   -E: disable encryption from client to server\n");
118          fprintf(stderr, "   -m: do not send motion events\n");          fprintf(stderr, "   -m: do not send motion events\n");
# Line 116  usage(char *program) Line 122  usage(char *program)
122          fprintf(stderr, "   -S: caption button size (single application mode)\n");          fprintf(stderr, "   -S: caption button size (single application mode)\n");
123          fprintf(stderr, "   -T: window title\n");          fprintf(stderr, "   -T: window title\n");
124          fprintf(stderr, "   -N: enable numlock syncronization\n");          fprintf(stderr, "   -N: enable numlock syncronization\n");
125            fprintf(stderr, "   -X: embed into another window with a given id.\n");
126          fprintf(stderr, "   -a: connection colour depth\n");          fprintf(stderr, "   -a: connection colour depth\n");
127            fprintf(stderr,
128                    "   -x: RDP5 experience (m[odem 28.8], b[roadband], l[an] or hex number)\n");
129          fprintf(stderr, "   -r: enable specified device redirection (this flag can be repeated)\n");          fprintf(stderr, "   -r: enable specified device redirection (this flag can be repeated)\n");
130          fprintf(stderr,          fprintf(stderr,
131                  "         '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n");                  "         '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n");
# Line 124  usage(char *program) Line 133  usage(char *program)
133          fprintf(stderr,          fprintf(stderr,
134                  "         '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n");                  "         '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n");
135          fprintf(stderr, "             or   A=/mnt/floppy,D=/mnt/cdrom'\n");          fprintf(stderr, "             or   A=/mnt/floppy,D=/mnt/cdrom'\n");
136            fprintf(stderr, "         '-r clientname=<client name>': Set the client name displayed\n");
137            fprintf(stderr, "             for redirected disks\n");
138          fprintf(stderr,          fprintf(stderr,
139                  "         '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n");                  "         '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n");
140          fprintf(stderr, "             or      LPT1=/dev/lp0,LPT2=/dev/lp1\n");          fprintf(stderr, "             or      LPT1=/dev/lp0,LPT2=/dev/lp1\n");
141          fprintf(stderr, "         '-r printer:mydeskjet': enable printer redirection\n");          fprintf(stderr, "         '-r printer:mydeskjet': enable printer redirection\n");
142          fprintf(stderr,          fprintf(stderr,
143                  "             or       mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");                  "             or      mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");
144          fprintf(stderr, "         '-r sound': enable sound redirection\n");          fprintf(stderr, "         '-r sound:[local|off|remote]': enable sound redirection\n");
145            fprintf(stderr, "                     remote would leave sound on server\n");
146          fprintf(stderr, "   -0: attach to console\n");          fprintf(stderr, "   -0: attach to console\n");
147          fprintf(stderr, "   -4: use RDP version 4\n");          fprintf(stderr, "   -4: use RDP version 4\n");
148          fprintf(stderr, "   -5: use RDP version 5 (default)\n");          fprintf(stderr, "   -5: use RDP version 5 (default)\n");
149  }  }
150    
151    void
152    print_disconnect_reason(uint16 reason)
153    {
154            char *text;
155    
156            switch (reason)
157            {
158                    case exDiscReasonNoInfo:
159                            text = "No information available";
160                            break;
161    
162                    case exDiscReasonAPIInitiatedDisconnect:
163                            text = "Server initiated disconnect";
164                            break;
165    
166                    case exDiscReasonAPIInitiatedLogoff:
167                            text = "Server initiated logoff";
168                            break;
169    
170                    case exDiscReasonServerIdleTimeout:
171                            text = "Server idle timeout reached";
172                            break;
173    
174                    case exDiscReasonServerLogonTimeout:
175                            text = "Server logon timeout reached";
176                            break;
177    
178                    case exDiscReasonReplacedByOtherConnection:
179                            text = "The session was replaced";
180                            break;
181    
182                    case exDiscReasonOutOfMemory:
183                            text = "The server is out of memory";
184                            break;
185    
186                    case exDiscReasonServerDeniedConnection:
187                            text = "The server denied the connection";
188                            break;
189    
190                    case exDiscReasonServerDeniedConnectionFips:
191                            text = "The server denied the connection for security reason";
192                            break;
193    
194                    case exDiscReasonLicenseInternal:
195                            text = "Internal licensing error";
196                            break;
197    
198                    case exDiscReasonLicenseNoLicenseServer:
199                            text = "No license server available";
200                            break;
201    
202                    case exDiscReasonLicenseNoLicense:
203                            text = "No valid license available";
204                            break;
205    
206                    case exDiscReasonLicenseErrClientMsg:
207                            text = "Invalid licensing message";
208                            break;
209    
210                    case exDiscReasonLicenseHwidDoesntMatchLicense:
211                            text = "Hardware id doesn't match software license";
212                            break;
213    
214                    case exDiscReasonLicenseErrClientLicense:
215                            text = "Client license error";
216                            break;
217    
218                    case exDiscReasonLicenseCantFinishProtocol:
219                            text = "Network error during licensing protocol";
220                            break;
221    
222                    case exDiscReasonLicenseClientEndedProtocol:
223                            text = "Licensing protocol was not completed";
224                            break;
225    
226                    case exDiscReasonLicenseErrClientEncryption:
227                            text = "Incorrect client license enryption";
228                            break;
229    
230                    case exDiscReasonLicenseCantUpgradeLicense:
231                            text = "Can't upgrade license";
232                            break;
233    
234                    case exDiscReasonLicenseNoRemoteConnections:
235                            text = "The server is not licensed to accept remote connections";
236                            break;
237    
238                    default:
239                            if (reason > 0x1000 && reason < 0x7fff)
240                            {
241                                    text = "Internal protocol error";
242                            }
243                            else
244                            {
245                                    text = "Unknown reason";
246                            }
247            }
248            fprintf(stderr, "disconnect: %s.\n", text);
249    }
250    
251  static BOOL  static BOOL
252  read_password(char *password, int size)  read_password(char *password, int size)
253  {  {
# Line 193  parse_server_and_port(char *server) Line 305  parse_server_and_port(char *server)
305                  if (*server == '[' && p != NULL)                  if (*server == '[' && p != NULL)
306                  {                  {
307                          if (*(p + 1) == ':' && *(p + 2) != '\0')                          if (*(p + 1) == ':' && *(p + 2) != '\0')
308                                  tcp_port_rdp = strtol(p + 2, NULL, 10);                                  g_tcp_port_rdp = strtol(p + 2, NULL, 10);
309                          /* remove the port number and brackets from the address */                          /* remove the port number and brackets from the address */
310                          *p = '\0';                          *p = '\0';
311                          strncpy(server, server + 1, strlen(server));                          strncpy(server, server + 1, strlen(server));
# Line 205  parse_server_and_port(char *server) Line 317  parse_server_and_port(char *server)
317                  p = strchr(server, ':');                  p = strchr(server, ':');
318                  if (p != NULL)                  if (p != NULL)
319                  {                  {
320                          tcp_port_rdp = strtol(p + 1, NULL, 10);                          g_tcp_port_rdp = strtol(p + 1, NULL, 10);
321                          *p = 0;                          *p = 0;
322                  }                  }
323          }          }
# Line 213  parse_server_and_port(char *server) Line 325  parse_server_and_port(char *server)
325          p = strchr(server, ':');          p = strchr(server, ':');
326          if (p != NULL)          if (p != NULL)
327          {          {
328                  tcp_port_rdp = strtol(p + 1, NULL, 10);                  g_tcp_port_rdp = strtol(p + 1, NULL, 10);
329                  *p = 0;                  *p = 0;
330          }          }
331  #endif /* IPv6 */  #endif /* IPv6 */
# Line 230  main(int argc, char *argv[]) Line 342  main(int argc, char *argv[])
342          char password[64];          char password[64];
343          char shell[128];          char shell[128];
344          char directory[32];          char directory[32];
345          BOOL prompt_password, rdp_retval = False;          BOOL prompt_password, deactivated;
346          struct passwd *pw;          struct passwd *pw;
347          uint32 flags;          uint32 flags, ext_disc_reason = 0;
348          char *p;          char *p;
349          int c;          int c;
350    
# Line 242  main(int argc, char *argv[]) Line 354  main(int argc, char *argv[])
354          prompt_password = False;          prompt_password = False;
355          domain[0] = password[0] = shell[0] = directory[0] = 0;          domain[0] = password[0] = shell[0] = directory[0] = 0;
356          strcpy(keymapname, "en-us");          strcpy(keymapname, "en-us");
357            g_embed_wnd = 0;
358    
359          g_num_devices = 0;          g_num_devices = 0;
360    
# Line 251  main(int argc, char *argv[]) Line 364  main(int argc, char *argv[])
364  #define VNCOPT  #define VNCOPT
365  #endif  #endif
366    
367          while ((c = getopt(argc, argv, VNCOPT "u:d:s:c:p:n:k:g:fbeEmCDKS:T:Na:r:045h?")) != -1)          while ((c = getopt(argc, argv, VNCOPT "u:d:s:c:p:n:k:g:fbBeEmCDKS:T:NX:a:x:r:045h?")) != -1)
368          {          {
369                  switch (c)                  switch (c)
370                  {                  {
# Line 303  main(int argc, char *argv[]) Line 416  main(int argc, char *argv[])
416                                  break;                                  break;
417    
418                          case 'n':                          case 'n':
419                                  STRNCPY(hostname, optarg, sizeof(hostname));                                  STRNCPY(g_hostname, optarg, sizeof(g_hostname));
420                                  break;                                  break;
421    
422                          case 'k':                          case 'k':
# Line 344  main(int argc, char *argv[]) Line 457  main(int argc, char *argv[])
457                                  break;                                  break;
458    
459                          case 'b':                          case 'b':
460                                  g_orders = False;                                  g_bitmap_cache = False;
461                                    break;
462    
463                            case 'B':
464                                    g_ownbackstore = False;
465                                  break;                                  break;
466    
467                          case 'e':                          case 'e':
# Line 394  main(int argc, char *argv[]) Line 511  main(int argc, char *argv[])
511                                  g_numlock_sync = True;                                  g_numlock_sync = True;
512                                  break;                                  break;
513    
514                            case 'X':
515                                    g_embed_wnd = strtol(optarg, NULL, 10);
516                                    break;
517    
518                          case 'a':                          case 'a':
519                                  g_server_bpp = strtol(optarg, NULL, 10);                                  g_server_bpp = strtol(optarg, NULL, 10);
520                                  if (g_server_bpp != 8 && g_server_bpp != 16 && g_server_bpp != 15                                  if (g_server_bpp != 8 && g_server_bpp != 16 && g_server_bpp != 15
# Line 404  main(int argc, char *argv[]) Line 525  main(int argc, char *argv[])
525                                  }                                  }
526                                  break;                                  break;
527    
528                            case 'x':
529    
530                                    if (strncmp("modem", optarg, 1) == 0)
531                                    {
532                                            g_rdp5_performanceflags =
533                                                    RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG |
534                                                    RDP5_NO_MENUANIMATIONS | RDP5_NO_THEMING;
535                                    }
536                                    else if (strncmp("broadband", optarg, 1) == 0)
537                                    {
538                                            g_rdp5_performanceflags = RDP5_NO_WALLPAPER;
539                                    }
540                                    else if (strncmp("lan", optarg, 1) == 0)
541                                    {
542                                            g_rdp5_performanceflags = RDP5_DISABLE_NOTHING;
543                                    }
544                                    else
545                                    {
546                                            g_rdp5_performanceflags = strtol(optarg, NULL, 16);
547                                    }
548                                    break;
549    
550                          case 'r':                          case 'r':
551    
552                                  if (strncmp("sound", optarg, 5) == 0)                                  if (strncmp("sound", optarg, 5) == 0)
553                                  {                                  {
554                                            optarg += 5;
555    
556                                            if (*optarg == ':')
557                                            {
558                                                    *optarg++;
559                                                    while ((p = next_arg(optarg, ',')))
560                                                    {
561                                                            if (strncmp("remote", optarg, 6) == 0)
562                                                                    flags |= RDP_LOGON_LEAVE_AUDIO;
563    
564                                                            if (strncmp("local", optarg, 5) == 0)
565    #ifdef WITH_RDPSND
566                                                                    g_rdpsnd = True;
567    #else
568                                                                    warning("Not compiled with sound support");
569    #endif
570    
571                                                            if (strncmp("off", optarg, 3) == 0)
572  #ifdef WITH_RDPSND  #ifdef WITH_RDPSND
573                                          g_rdpsnd = True;                                                                  g_rdpsnd = False;
574  #else  #else
575                                          warning("Not compiled with sound support");                                                                  warning("Not compiled with sound support");
576  #endif  #endif
577    
578                                                            optarg = p;
579                                                    }
580                                            }
581                                            else
582                                            {
583    #ifdef WITH_RDPSND
584                                                    g_rdpsnd = True;
585    #else
586                                                    warning("Not compiled with sound support");
587    #endif
588                                            }
589                                  }                                  }
590                                  else if (strncmp("disk", optarg, 4) == 0)                                  else if (strncmp("disk", optarg, 4) == 0)
591                                  {                                  {
# Line 431  main(int argc, char *argv[]) Line 604  main(int argc, char *argv[])
604                                  {                                  {
605                                          printer_enum_devices(&g_num_devices, optarg + 7);                                          printer_enum_devices(&g_num_devices, optarg + 7);
606                                  }                                  }
607                                    else if (strncmp("clientname", optarg, 7) == 0)
608                                    {
609                                            g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);
610                                            strcpy(g_rdpdr_clientname, optarg + 11);
611                                    }
612                                  else                                  else
613                                  {                                  {
614                                          warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound\n");                                          warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound\n");
# Line 457  main(int argc, char *argv[]) Line 635  main(int argc, char *argv[])
635                  }                  }
636          }          }
637    
638          if (argc - optind < 1)          if (argc - optind != 1)
639          {          {
640                  usage(argv[0]);                  usage(argv[0]);
641                  return 1;                  return 1;
# Line 478  main(int argc, char *argv[]) Line 656  main(int argc, char *argv[])
656                  STRNCPY(g_username, pw->pw_name, sizeof(g_username));                  STRNCPY(g_username, pw->pw_name, sizeof(g_username));
657          }          }
658    
659          if (hostname[0] == 0)          if (g_hostname[0] == 0)
660          {          {
661                  if (gethostname(fullhostname, sizeof(fullhostname)) == -1)                  if (gethostname(fullhostname, sizeof(fullhostname)) == -1)
662                  {                  {
# Line 490  main(int argc, char *argv[]) Line 668  main(int argc, char *argv[])
668                  if (p != NULL)                  if (p != NULL)
669                          *p = 0;                          *p = 0;
670    
671                  STRNCPY(hostname, fullhostname, sizeof(hostname));                  STRNCPY(g_hostname, fullhostname, sizeof(g_hostname));
672          }          }
673    
674          if (prompt_password && read_password(password, sizeof(password)))          if (prompt_password && read_password(password, sizeof(password)))
# Line 530  main(int argc, char *argv[]) Line 708  main(int argc, char *argv[])
708    
709          if (ui_create_window())          if (ui_create_window())
710          {          {
711                  rdp_retval = rdp_main_loop();                  rdp_main_loop(&deactivated, &ext_disc_reason);
712                  ui_destroy_window();                  ui_destroy_window();
713          }          }
714    
# Line 538  main(int argc, char *argv[]) Line 716  main(int argc, char *argv[])
716          rdp_disconnect();          rdp_disconnect();
717          ui_deinit();          ui_deinit();
718    
719          if (True == rdp_retval)          if (ext_disc_reason >= 2)
720                    print_disconnect_reason(ext_disc_reason);
721    
722            if (deactivated)
723            {
724                    /* clean disconnect */
725                  return 0;                  return 0;
726            }
727          else          else
728                  return 2;          {
729                    if (ext_disc_reason == exDiscReasonAPIInitiatedDisconnect
730                        || ext_disc_reason == exDiscReasonAPIInitiatedLogoff)
731                    {
732                            /* not so clean disconnect, but nothing to worry about */
733                            return 0;
734                    }
735                    else
736                    {
737                            /* return error */
738                            return 2;
739                    }
740            }
741    
742  #endif  #endif
743    
# Line 732  hexdump(unsigned char *p, unsigned int l Line 928  hexdump(unsigned char *p, unsigned int l
928  }  }
929    
930  /*  /*
931    input: src is the string we look in for needle    input: src is the string we look in for needle.
932             Needle may be escaped by a backslash, in
933             that case we ignore that particular needle.
934    return value: returns next src pointer, for    return value: returns next src pointer, for
935          succesive executions, like in a while loop          succesive executions, like in a while loop
936          if retval is 0, then there are no more args.          if retval is 0, then there are no more args.
# Line 814  toupper_str(char *p) Line 1012  toupper_str(char *p)
1012  #define LTOA_BUFSIZE (sizeof(long) * 8 + 1)  #define LTOA_BUFSIZE (sizeof(long) * 8 + 1)
1013    
1014  char *  char *
1015  ltoa(long N, int base)  l_to_a(long N, int base)
1016  {  {
1017          static char ret[LTOA_BUFSIZE];          static char ret[LTOA_BUFSIZE];
1018    
1019          register int i = 2;          char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf);
         long uarg;  
         char *tail, *head = ret, buf[LTOA_BUFSIZE];  
1020    
1021          if (36 < base || 2 > base)          register int divrem;
                 base = 10;  
1022    
1023          tail = &buf[LTOA_BUFSIZE - 1];          if (base < 36 || 2 > base)
1024          *tail-- = '\0';                  base = 10;
1025    
1026          if (10 == base && N < 0L)          if (N < 0)
1027          {          {
1028                  *head++ = '-';                  *head++ = '-';
1029                  uarg = -N;                  N = -N;
1030          }          }
         else  
                 uarg = N;  
1031    
1032          if (uarg)          tail = buf + sizeof(buf);
1033          {          *--tail = 0;
                 for (i = 1; uarg; ++i)  
                 {  
                         register ldiv_t r;  
1034    
1035                          r = ldiv(uarg, base);          do
1036                          *tail-- = (char) (r.rem + ((9L < r.rem) ? ('A' - 10L) : '0'));          {
1037                          uarg = r.quot;                  divrem = N % base;
1038                  }                  *--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10;
1039                    N /= base;
1040          }          }
1041          else          while (N);
                 *tail-- = '0';  
1042    
1043          memcpy(head, ++tail, i);          strcpy(head, tail);
1044          return ret;          return ret;
1045  }  }
1046    
# Line 866  load_licence(unsigned char **data) Line 1056  load_licence(unsigned char **data)
1056          if (home == NULL)          if (home == NULL)
1057                  return -1;                  return -1;
1058    
1059          path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence."));          path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence."));
1060          sprintf(path, "%s/.rdesktop/licence.%s", home, hostname);          sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname);
1061    
1062          fd = open(path, O_RDONLY);          fd = open(path, O_RDONLY);
1063          if (fd == -1)          if (fd == -1)
# Line 893  save_licence(unsigned char *data, int le Line 1083  save_licence(unsigned char *data, int le
1083          if (home == NULL)          if (home == NULL)
1084                  return;                  return;
1085    
1086          path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence."));          path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + sizeof("/.rdesktop/licence."));
1087    
1088          sprintf(path, "%s/.rdesktop", home);          sprintf(path, "%s/.rdesktop", home);
1089          if ((mkdir(path, 0700) == -1) && errno != EEXIST)          if ((mkdir(path, 0700) == -1) && errno != EEXIST)
# Line 904  save_licence(unsigned char *data, int le Line 1094  save_licence(unsigned char *data, int le
1094    
1095          /* write licence to licence.hostname.new, then atomically rename to licence.hostname */          /* write licence to licence.hostname.new, then atomically rename to licence.hostname */
1096    
1097          sprintf(path, "%s/.rdesktop/licence.%s", home, hostname);          sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname);
1098          tmppath = (char *) xmalloc(strlen(path) + sizeof(".new"));          tmppath = (char *) xmalloc(strlen(path) + sizeof(".new"));
1099          strcpy(tmppath, path);          strcpy(tmppath, path);
1100          strcat(tmppath, ".new");          strcat(tmppath, ".new");

Legend:
Removed from v.582  
changed lines
  Added in v.710

  ViewVC Help
Powered by ViewVC 1.1.26