371 |
if (!ui_init()) |
if (!ui_init()) |
372 |
return 1; |
return 1; |
373 |
|
|
374 |
|
ipc_init(); // Must be run after ui_init, we need X to be setup. |
375 |
|
|
376 |
|
if (use_rdp5) |
377 |
|
cliprdr_init(); // FIXME: Should perhaps be integrated into the channel management code? |
378 |
|
|
379 |
if (!rdp_connect(server, flags, domain, password, shell, directory)) |
if (!rdp_connect(server, flags, domain, password, shell, directory)) |
380 |
return 1; |
return 1; |
381 |
|
|
593 |
if (home == NULL) |
if (home == NULL) |
594 |
return -1; |
return -1; |
595 |
|
|
596 |
path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
597 |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
598 |
|
|
599 |
fd = open(path, O_RDONLY); |
fd = open(path, O_RDONLY); |
603 |
if (fstat(fd, &st)) |
if (fstat(fd, &st)) |
604 |
return -1; |
return -1; |
605 |
|
|
606 |
*data = (uint8*)xmalloc(st.st_size); |
*data = (uint8 *) xmalloc(st.st_size); |
607 |
length = read(fd, *data, st.st_size); |
length = read(fd, *data, st.st_size); |
608 |
close(fd); |
close(fd); |
609 |
xfree(path); |
xfree(path); |
620 |
if (home == NULL) |
if (home == NULL) |
621 |
return; |
return; |
622 |
|
|
623 |
path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
624 |
|
|
625 |
sprintf(path, "%s/.rdesktop", home); |
sprintf(path, "%s/.rdesktop", home); |
626 |
if ((mkdir(path, 0700) == -1) && errno != EEXIST) |
if ((mkdir(path, 0700) == -1) && errno != EEXIST) |
632 |
/* write licence to licence.hostname.new, then atomically rename to licence.hostname */ |
/* write licence to licence.hostname.new, then atomically rename to licence.hostname */ |
633 |
|
|
634 |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
635 |
tmppath = (char*)xmalloc(strlen(path) + sizeof(".new")); |
tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); |
636 |
strcpy(tmppath, path); |
strcpy(tmppath, path); |
637 |
strcat(tmppath, ".new"); |
strcat(tmppath, ".new"); |
638 |
|
|
639 |
fd = open(tmppath, O_WRONLY|O_CREAT|O_TRUNC, 0600); |
fd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0600); |
640 |
if (fd == -1) |
if (fd == -1) |
641 |
{ |
{ |
642 |
perror(tmppath); |
perror(tmppath); |