149 |
char password[16]; |
char password[16]; |
150 |
char shell[128]; |
char shell[128]; |
151 |
char directory[32]; |
char directory[32]; |
152 |
BOOL prompt_password; |
BOOL prompt_password, rdp_retval = False; |
153 |
struct passwd *pw; |
struct passwd *pw; |
154 |
uint32 flags; |
uint32 flags; |
155 |
char *p; |
char *p; |
366 |
|
|
367 |
#ifdef RDP2VNC |
#ifdef RDP2VNC |
368 |
rdp2vnc_connect(server, flags, domain, password, shell, directory); |
rdp2vnc_connect(server, flags, domain, password, shell, directory); |
369 |
|
return 0; |
370 |
#else |
#else |
371 |
|
|
372 |
if (!ui_init()) |
if (!ui_init()) |
373 |
return 1; |
return 1; |
374 |
|
|
375 |
|
ipc_init(); // Must be run after ui_init, we need X to be setup. |
376 |
|
|
377 |
|
if (use_rdp5) |
378 |
|
cliprdr_init(); // FIXME: Should perhaps be integrated into the channel management code? |
379 |
|
|
380 |
if (!rdp_connect(server, flags, domain, password, shell, directory)) |
if (!rdp_connect(server, flags, domain, password, shell, directory)) |
381 |
return 1; |
return 1; |
382 |
|
|
385 |
|
|
386 |
if (ui_create_window()) |
if (ui_create_window()) |
387 |
{ |
{ |
388 |
rdp_main_loop(); |
rdp_retval = rdp_main_loop(); |
389 |
ui_destroy_window(); |
ui_destroy_window(); |
390 |
} |
} |
391 |
|
|
393 |
rdp_disconnect(); |
rdp_disconnect(); |
394 |
ui_deinit(); |
ui_deinit(); |
395 |
|
|
396 |
|
if (True == rdp_retval) |
397 |
|
return 0; |
398 |
|
else |
399 |
|
return 2; |
400 |
|
|
401 |
#endif |
#endif |
402 |
|
|
|
return 0; |
|
403 |
} |
} |
404 |
|
|
405 |
#ifdef EGD_SOCKET |
#ifdef EGD_SOCKET |
598 |
if (home == NULL) |
if (home == NULL) |
599 |
return -1; |
return -1; |
600 |
|
|
601 |
path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
602 |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
603 |
|
|
604 |
fd = open(path, O_RDONLY); |
fd = open(path, O_RDONLY); |
608 |
if (fstat(fd, &st)) |
if (fstat(fd, &st)) |
609 |
return -1; |
return -1; |
610 |
|
|
611 |
*data = (uint8*)xmalloc(st.st_size); |
*data = (uint8 *) xmalloc(st.st_size); |
612 |
length = read(fd, *data, st.st_size); |
length = read(fd, *data, st.st_size); |
613 |
close(fd); |
close(fd); |
614 |
xfree(path); |
xfree(path); |
625 |
if (home == NULL) |
if (home == NULL) |
626 |
return; |
return; |
627 |
|
|
628 |
path = (char*)xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
path = (char *) xmalloc(strlen(home) + strlen(hostname) + sizeof("/.rdesktop/licence.")); |
629 |
|
|
630 |
sprintf(path, "%s/.rdesktop", home); |
sprintf(path, "%s/.rdesktop", home); |
631 |
if ((mkdir(path, 0700) == -1) && errno != EEXIST) |
if ((mkdir(path, 0700) == -1) && errno != EEXIST) |
637 |
/* write licence to licence.hostname.new, then atomically rename to licence.hostname */ |
/* write licence to licence.hostname.new, then atomically rename to licence.hostname */ |
638 |
|
|
639 |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
sprintf(path, "%s/.rdesktop/licence.%s", home, hostname); |
640 |
tmppath = (char*)xmalloc(strlen(path) + sizeof(".new")); |
tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); |
641 |
strcpy(tmppath, path); |
strcpy(tmppath, path); |
642 |
strcat(tmppath, ".new"); |
strcat(tmppath, ".new"); |
643 |
|
|
644 |
fd = open(tmppath, O_WRONLY|O_CREAT|O_TRUNC, 0600); |
fd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0600); |
645 |
if (fd == -1) |
if (fd == -1) |
646 |
{ |
{ |
647 |
perror(tmppath); |
perror(tmppath); |