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 |
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; |
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)); |
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 |
} |
} |
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 */ |
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': |
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 |
{ |
{ |
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))) |
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) |
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) |
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"); |