Added display' and display_size'

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@958 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-11-14 03:39:17 +00:00
parent 39656879d4
commit 760e988d3f
4 changed files with 13 additions and 8 deletions

View File

@@ -43,6 +43,8 @@ RCSID("$Id$");
char x_socket[MaxPathLen]; char x_socket[MaxPathLen];
u_int32_t display_num; u_int32_t display_num;
char display[MaxPathLen];
int display_size = sizeof(display);
char xauthfile[MaxPathLen]; char xauthfile[MaxPathLen];
int xauthfile_size = sizeof(xauthfile); int xauthfile_size = sizeof(xauthfile);
u_char cookie[16]; u_char cookie[16];

View File

@@ -187,12 +187,12 @@ connect_host (char *host, des_cblock *key, des_key_schedule schedule,
fprintf (stderr, "%s: write: %s\n", prog, strerror(errno)); fprintf (stderr, "%s: write: %s\n", prog, strerror(errno));
return -1; return -1;
} }
if (krb_net_read (s, tmp, sizeof(tmp)) != sizeof(tmp)) { if (krb_net_read (s, display, display_size) != display_size) {
fprintf (stderr, "%s: read %s\n", prog, strerror(errno)); fprintf (stderr, "%s: read: %s\n", prog, strerror(errno));
return -1; return -1;
} }
sscanf (tmp, "%u", &display_num);
if (krb_net_read (s, xauthfile, xauthfile_size) != xauthfile_size) { if (krb_net_read (s, xauthfile, xauthfile_size) != xauthfile_size) {
fprintf (stderr, "%s: read: %s\n", prog, fprintf (stderr, "%s: read: %s\n", prog,
strerror(errno)); strerror(errno));

View File

@@ -114,6 +114,8 @@ int copy_encrypted (int fd1, int fd2, des_cblock *iv,
extern char x_socket[]; extern char x_socket[];
extern u_int32_t display_num; extern u_int32_t display_num;
extern char display[];
extern int display_size;
extern char xauthfile[]; extern char xauthfile[];
extern int xauthfile_size; extern int xauthfile_size;
extern u_char cookie[]; extern u_char cookie[];

View File

@@ -227,13 +227,14 @@ doit(int sock, int tcpp)
if (krb_net_read (sock, &passivep, sizeof(passivep)) != sizeof(passivep)) if (krb_net_read (sock, &passivep, sizeof(passivep)) != sizeof(passivep))
return 1; return 1;
if (passivep) { if (passivep) {
char tmp[16];
display_num = get_xsockets (&localx, tcpp ? &tcpx : NULL); display_num = get_xsockets (&localx, tcpp ? &tcpx : NULL);
if (display_num < 0) if (display_num < 0)
return 1; return 1;
sprintf (tmp, "%u", display_num); if (tcpp)
if (krb_net_write (sock, tmp, sizeof(tmp)) != sizeof(tmp)) sprintf (display, "localhost:%u", display_num);
else
sprintf (display, ":%u", display_num);
if (krb_net_write (sock, display, display_size) != display_size)
return 1; return 1;
strncpy(xauthfile, tempnam("/tmp", NULL), xauthfile_size); strncpy(xauthfile, tempnam("/tmp", NULL), xauthfile_size);
if (krb_net_write (sock, xauthfile, xauthfile_size) != if (krb_net_write (sock, xauthfile, xauthfile_size) !=