45 |
char hostname[16]; |
char hostname[16]; |
46 |
char keymapname[16]; |
char keymapname[16]; |
47 |
int keylayout = 0x409; /* Defaults to US keyboard layout */ |
int keylayout = 0x409; /* Defaults to US keyboard layout */ |
48 |
int width = 800; |
int width = 800; /* If width or height are reset to zero, the geometry will |
49 |
|
be fetched from _NET_WORKAREA */ |
50 |
int height = 600; |
int height = 600; |
51 |
int tcp_port_rdp = TCP_PORT_RDP; |
int tcp_port_rdp = TCP_PORT_RDP; |
52 |
BOOL bitmap_compression = True; |
BOOL bitmap_compression = True; |
56 |
BOOL desktop_save = True; |
BOOL desktop_save = True; |
57 |
BOOL fullscreen = False; |
BOOL fullscreen = False; |
58 |
BOOL grab_keyboard = True; |
BOOL grab_keyboard = True; |
59 |
|
BOOL hide_decorations = False; |
60 |
|
|
61 |
/* Display usage information */ |
/* Display usage information */ |
62 |
static void |
static void |
81 |
fprintf(stderr, " -m: do not send motion events\n"); |
fprintf(stderr, " -m: do not send motion events\n"); |
82 |
fprintf(stderr, " -K: keep window manager key bindings\n"); |
fprintf(stderr, " -K: keep window manager key bindings\n"); |
83 |
fprintf(stderr, " -T: window title\n"); |
fprintf(stderr, " -T: window title\n"); |
84 |
|
fprintf(stderr, " -D: hide window manager decorations\n"); |
85 |
} |
} |
86 |
|
|
87 |
static BOOL |
static BOOL |
139 |
flags = RDP_LOGON_NORMAL; |
flags = RDP_LOGON_NORMAL; |
140 |
prompt_password = False; |
prompt_password = False; |
141 |
domain[0] = password[0] = shell[0] = directory[0] = 0; |
domain[0] = password[0] = shell[0] = directory[0] = 0; |
142 |
strcpy(keymapname, "us"); |
strcpy(keymapname, "en-us"); |
143 |
|
|
144 |
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKT:h?")) != -1) |
while ((c = getopt(argc, argv, "u:d:s:c:p:n:k:g:fbemKT:Dh?")) != -1) |
145 |
{ |
{ |
146 |
switch (c) |
switch (c) |
147 |
{ |
{ |
186 |
break; |
break; |
187 |
|
|
188 |
case 'g': |
case 'g': |
189 |
|
if (!strcmp(optarg, "workarea")) |
190 |
|
{ |
191 |
|
width = height = 0; |
192 |
|
break; |
193 |
|
} |
194 |
|
|
195 |
width = strtol(optarg, &p, 10); |
width = strtol(optarg, &p, 10); |
196 |
if (*p == 'x') |
if (*p == 'x') |
197 |
height = strtol(p + 1, NULL, 10); |
height = strtol(p + 1, NULL, 10); |
227 |
STRNCPY(title, optarg, sizeof(title)); |
STRNCPY(title, optarg, sizeof(title)); |
228 |
break; |
break; |
229 |
|
|
230 |
|
case 'D': |
231 |
|
hide_decorations = True; |
232 |
|
break; |
233 |
|
|
234 |
case 'h': |
case 'h': |
235 |
case '?': |
case '?': |
236 |
default: |
default: |
325 |
|
|
326 |
addr.sun_family = AF_UNIX; |
addr.sun_family = AF_UNIX; |
327 |
memcpy(addr.sun_path, EGD_SOCKET, sizeof(EGD_SOCKET)); |
memcpy(addr.sun_path, EGD_SOCKET, sizeof(EGD_SOCKET)); |
328 |
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) |
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) |
329 |
goto err; |
goto err; |
330 |
|
|
331 |
/* PRNGD and EGD use a simple communications protocol */ |
/* PRNGD and EGD use a simple communications protocol */ |
332 |
buf[0] = 1; /* Non-blocking (similar to /dev/urandom) */ |
buf[0] = 1; /* Non-blocking (similar to /dev/urandom) */ |
333 |
buf[1] = 32; /* Number of requested random bytes */ |
buf[1] = 32; /* Number of requested random bytes */ |
334 |
if (write(fd, buf, 2) != 2) |
if (write(fd, buf, 2) != 2) |
335 |
goto err; |
goto err; |
336 |
|
|
337 |
if ((read(fd, buf, 1) != 1) || (buf[0] == 0)) /* Available? */ |
if ((read(fd, buf, 1) != 1) || (buf[0] == 0)) /* Available? */ |
338 |
goto err; |
goto err; |
339 |
|
|
340 |
if (read(fd, buf, 32) != 32) |
if (read(fd, buf, 32) != 32) |
342 |
|
|
343 |
ret = True; |
ret = True; |
344 |
|
|
345 |
err: |
err: |
346 |
close(fd); |
close(fd); |
347 |
return ret; |
return ret; |
348 |
} |
} |
375 |
#endif |
#endif |
376 |
|
|
377 |
/* Otherwise use whatever entropy we can gather - ideas welcome. */ |
/* Otherwise use whatever entropy we can gather - ideas welcome. */ |
378 |
r = (uint32 *)random; |
r = (uint32 *) random; |
379 |
r[0] = (getpid()) | (getppid() << 16); |
r[0] = (getpid()) | (getppid() << 16); |
380 |
r[1] = (getuid()) | (getgid() << 16); |
r[1] = (getuid()) | (getgid() << 16); |
381 |
r[2] = times(&tmsbuf); /* system uptime (clocks) */ |
r[2] = times(&tmsbuf); /* system uptime (clocks) */ |
387 |
|
|
388 |
/* Hash both halves with MD5 to obscure possible patterns */ |
/* Hash both halves with MD5 to obscure possible patterns */ |
389 |
MD5_Init(&md5); |
MD5_Init(&md5); |
390 |
MD5_Update(&md5, random, 16); |
MD5_Update(&md5, random, 16); |
391 |
MD5_Final(random, &md5); |
MD5_Final(random, &md5); |
392 |
MD5_Update(&md5, random+16, 16); |
MD5_Update(&md5, random + 16, 16); |
393 |
MD5_Final(random+16, &md5); |
MD5_Final(random + 16, &md5); |
394 |
} |
} |
395 |
|
|
396 |
/* malloc; exit if out of memory */ |
/* malloc; exit if out of memory */ |