* -> krb_net_*

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@737 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-09-14 04:22:27 +00:00
parent ab0afe3e7c
commit 403e1eb526
2 changed files with 24 additions and 21 deletions

View File

@@ -139,9 +139,9 @@ start_session(int xserver, int fd, des_cblock *iv,
char *filename;
u_char zeros[6] = {0, 0, 0, 0, 0, 0};
if (read (fd, beg, sizeof(beg)) != sizeof(beg))
if (krb_net_read (fd, beg, sizeof(beg)) != sizeof(beg))
return 1;
if (write (xserver, beg, 6) != 6)
if (krb_net_write (xserver, beg, 6) != 6)
return 1;
bigendianp = beg[0] == 'B';
if (bigendianp) {
@@ -175,25 +175,25 @@ start_session(int xserver, int fd, des_cblock *iv,
len[2] = d & 0xFF;
len[3] = d >> 8;
}
if (write (xserver, len, 6) != 6)
if (krb_net_write (xserver, len, 6) != 6)
return 1;
if(write (xserver, auth->name, n) != n)
if(krb_net_write (xserver, auth->name, n) != n)
return 1;
npad = (4 - (n % 4)) % 4;
if (npad) {
if (write (xserver, zeros, npad) != npad)
if (krb_net_write (xserver, zeros, npad) != npad)
return 1;
}
if (write (xserver, auth->data, d) != d)
if (krb_net_write (xserver, auth->data, d) != d)
return 1;
dpad = (4 - (d % 4)) % 4;
if (dpad) {
if (write (xserver, zeros, dpad) != dpad)
if (krb_net_write (xserver, zeros, dpad) != dpad)
return 1;
}
XauDisposeAuth(auth);
} else {
if(write(xserver, zeros, 6) != 6)
if(krb_net_write(xserver, zeros, 6) != 6)
return 1;
}
@@ -261,7 +261,8 @@ doit (char *host, int passivep)
fprintf (stderr, "%s: listen: %s\n", prog, strerror(errno));
return 1;
}
if (write (otherside, &newaddr.sin_port, sizeof(newaddr.sin_port))
if (krb_net_write (otherside, &newaddr.sin_port,
sizeof(newaddr.sin_port))
!= sizeof(newaddr.sin_port)) {
fprintf (stderr, "%s: write: %s\n", prog, strerror(errno));
return 1;
@@ -275,9 +276,11 @@ doit (char *host, int passivep)
} else if (pid > 0) {
printf ("%d\t%s\n", display_num, xauthfile);
exit (0);
} else {
fclose(stdout);
}
} else {
rendez_vous = get_local_xsocket (1); /* XXX */
rendez_vous = get_local_xsocket (&display_num); /* XXX */
if (rendez_vous < 0)
return 1;
fn = active;

View File

@@ -6,7 +6,7 @@ char *prog;
static u_int32_t display_num;
static char xauthfile[MaxPathLen];
static u_char cookie[32];
static u_char cookie[16];
static size_t cookie_len;
#define COOKIE_TYPE "MIT-MAGIC-COOKIE-1"
@@ -69,7 +69,7 @@ recv_conn (int sock, des_cblock *key, des_key_schedule schedule,
return fatal (sock, "Cannot set uid");
}
umask(077);
if (write (sock, &ok, sizeof(ok)) != sizeof(ok))
if (krb_net_write (sock, &ok, sizeof(ok)) != sizeof(ok))
return 1;
memcpy(key, &auth.session, sizeof(des_cblock));
@@ -87,9 +87,9 @@ start_session (int fd, int sock, des_cblock *key,
char *protocol_name, *protocol_data;
u_char zeros[6] = {0, 0, 0, 0, 0, 0};
if (read (fd, beg, sizeof(beg)) != sizeof(beg))
if (krb_net_read (fd, beg, sizeof(beg)) != sizeof(beg))
return 1;
if (write (sock, beg, 6) != 6)
if (krb_net_write (sock, beg, 6) != 6)
return 1;
bigendianp = beg[0] == 'B';
if (bigendianp) {
@@ -103,16 +103,16 @@ start_session (int fd, int sock, des_cblock *key,
dpad = (4 - (d % 4)) % 4;
protocol_name = malloc(n + npad);
protocol_data = malloc(d + dpad);
if (read (fd, protocol_name, n + npad) != n + npad)
if (krb_net_read (fd, protocol_name, n + npad) != n + npad)
return 1;
if (read (fd, protocol_data, d + dpad) != d + dpad)
if (krb_net_read (fd, protocol_data, d + dpad) != d + dpad)
return 1;
if (strncmp (protocol_name, COOKIE_TYPE, strlen(COOKIE_TYPE)) != 0)
return 1;
if (d != cookie_len ||
memcmp (protocol_data, cookie, cookie_len) != 0)
return 1;
if (write (sock, zeros, 6) != 6)
if (krb_net_write (sock, zeros, 6) != 6)
return 1;
return copy_encrypted (fd, sock, key, schedule);
}
@@ -198,23 +198,23 @@ doit(int sock)
if (recv_conn (sock, &key, schedule, &thataddr))
return 1;
if (read (sock, &passivep, sizeof(passivep)) != sizeof(passivep))
if (krb_net_read (sock, &passivep, sizeof(passivep)) != sizeof(passivep))
return 1;
if (passivep) {
localx = get_local_xsocket (&display_num);
if (localx < 0)
return 1;
tmp = htonl(display_num);
if (write (sock, &tmp, sizeof(tmp)) != sizeof(tmp))
if (krb_net_write (sock, &tmp, sizeof(tmp)) != sizeof(tmp))
return 1;
strncpy(xauthfile, tempnam("/tmp", NULL), sizeof(xauthfile));
if (write (sock, xauthfile, sizeof(xauthfile)) !=
if (krb_net_write (sock, xauthfile, sizeof(xauthfile)) !=
sizeof(xauthfile))
return 1;
if(create_and_write_cookie (xauthfile, cookie,
sizeof(cookie)))
return 1;
if (read (sock, &thataddr.sin_port, sizeof(thataddr.sin_port))
if (krb_net_read (sock, &thataddr.sin_port, sizeof(thataddr.sin_port))
!= sizeof(thataddr.sin_port))
return 1;
for (;;) {