* -> krb_net_*
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@737 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
23
appl/kx/kx.c
23
appl/kx/kx.c
@@ -139,9 +139,9 @@ start_session(int xserver, int fd, des_cblock *iv,
|
|||||||
char *filename;
|
char *filename;
|
||||||
u_char zeros[6] = {0, 0, 0, 0, 0, 0};
|
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;
|
return 1;
|
||||||
if (write (xserver, beg, 6) != 6)
|
if (krb_net_write (xserver, beg, 6) != 6)
|
||||||
return 1;
|
return 1;
|
||||||
bigendianp = beg[0] == 'B';
|
bigendianp = beg[0] == 'B';
|
||||||
if (bigendianp) {
|
if (bigendianp) {
|
||||||
@@ -175,25 +175,25 @@ start_session(int xserver, int fd, des_cblock *iv,
|
|||||||
len[2] = d & 0xFF;
|
len[2] = d & 0xFF;
|
||||||
len[3] = d >> 8;
|
len[3] = d >> 8;
|
||||||
}
|
}
|
||||||
if (write (xserver, len, 6) != 6)
|
if (krb_net_write (xserver, len, 6) != 6)
|
||||||
return 1;
|
return 1;
|
||||||
if(write (xserver, auth->name, n) != n)
|
if(krb_net_write (xserver, auth->name, n) != n)
|
||||||
return 1;
|
return 1;
|
||||||
npad = (4 - (n % 4)) % 4;
|
npad = (4 - (n % 4)) % 4;
|
||||||
if (npad) {
|
if (npad) {
|
||||||
if (write (xserver, zeros, npad) != npad)
|
if (krb_net_write (xserver, zeros, npad) != npad)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (write (xserver, auth->data, d) != d)
|
if (krb_net_write (xserver, auth->data, d) != d)
|
||||||
return 1;
|
return 1;
|
||||||
dpad = (4 - (d % 4)) % 4;
|
dpad = (4 - (d % 4)) % 4;
|
||||||
if (dpad) {
|
if (dpad) {
|
||||||
if (write (xserver, zeros, dpad) != dpad)
|
if (krb_net_write (xserver, zeros, dpad) != dpad)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
XauDisposeAuth(auth);
|
XauDisposeAuth(auth);
|
||||||
} else {
|
} else {
|
||||||
if(write(xserver, zeros, 6) != 6)
|
if(krb_net_write(xserver, zeros, 6) != 6)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +261,8 @@ doit (char *host, int passivep)
|
|||||||
fprintf (stderr, "%s: listen: %s\n", prog, strerror(errno));
|
fprintf (stderr, "%s: listen: %s\n", prog, strerror(errno));
|
||||||
return 1;
|
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)) {
|
!= sizeof(newaddr.sin_port)) {
|
||||||
fprintf (stderr, "%s: write: %s\n", prog, strerror(errno));
|
fprintf (stderr, "%s: write: %s\n", prog, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
@@ -275,9 +276,11 @@ doit (char *host, int passivep)
|
|||||||
} else if (pid > 0) {
|
} else if (pid > 0) {
|
||||||
printf ("%d\t%s\n", display_num, xauthfile);
|
printf ("%d\t%s\n", display_num, xauthfile);
|
||||||
exit (0);
|
exit (0);
|
||||||
|
} else {
|
||||||
|
fclose(stdout);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rendez_vous = get_local_xsocket (1); /* XXX */
|
rendez_vous = get_local_xsocket (&display_num); /* XXX */
|
||||||
if (rendez_vous < 0)
|
if (rendez_vous < 0)
|
||||||
return 1;
|
return 1;
|
||||||
fn = active;
|
fn = active;
|
||||||
|
@@ -6,7 +6,7 @@ char *prog;
|
|||||||
|
|
||||||
static u_int32_t display_num;
|
static u_int32_t display_num;
|
||||||
static char xauthfile[MaxPathLen];
|
static char xauthfile[MaxPathLen];
|
||||||
static u_char cookie[32];
|
static u_char cookie[16];
|
||||||
static size_t cookie_len;
|
static size_t cookie_len;
|
||||||
|
|
||||||
#define COOKIE_TYPE "MIT-MAGIC-COOKIE-1"
|
#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");
|
return fatal (sock, "Cannot set uid");
|
||||||
}
|
}
|
||||||
umask(077);
|
umask(077);
|
||||||
if (write (sock, &ok, sizeof(ok)) != sizeof(ok))
|
if (krb_net_write (sock, &ok, sizeof(ok)) != sizeof(ok))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
memcpy(key, &auth.session, sizeof(des_cblock));
|
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;
|
char *protocol_name, *protocol_data;
|
||||||
u_char zeros[6] = {0, 0, 0, 0, 0, 0};
|
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;
|
return 1;
|
||||||
if (write (sock, beg, 6) != 6)
|
if (krb_net_write (sock, beg, 6) != 6)
|
||||||
return 1;
|
return 1;
|
||||||
bigendianp = beg[0] == 'B';
|
bigendianp = beg[0] == 'B';
|
||||||
if (bigendianp) {
|
if (bigendianp) {
|
||||||
@@ -103,16 +103,16 @@ start_session (int fd, int sock, des_cblock *key,
|
|||||||
dpad = (4 - (d % 4)) % 4;
|
dpad = (4 - (d % 4)) % 4;
|
||||||
protocol_name = malloc(n + npad);
|
protocol_name = malloc(n + npad);
|
||||||
protocol_data = malloc(d + dpad);
|
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;
|
return 1;
|
||||||
if (read (fd, protocol_data, d + dpad) != d + dpad)
|
if (krb_net_read (fd, protocol_data, d + dpad) != d + dpad)
|
||||||
return 1;
|
return 1;
|
||||||
if (strncmp (protocol_name, COOKIE_TYPE, strlen(COOKIE_TYPE)) != 0)
|
if (strncmp (protocol_name, COOKIE_TYPE, strlen(COOKIE_TYPE)) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (d != cookie_len ||
|
if (d != cookie_len ||
|
||||||
memcmp (protocol_data, cookie, cookie_len) != 0)
|
memcmp (protocol_data, cookie, cookie_len) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (write (sock, zeros, 6) != 6)
|
if (krb_net_write (sock, zeros, 6) != 6)
|
||||||
return 1;
|
return 1;
|
||||||
return copy_encrypted (fd, sock, key, schedule);
|
return copy_encrypted (fd, sock, key, schedule);
|
||||||
}
|
}
|
||||||
@@ -198,23 +198,23 @@ doit(int sock)
|
|||||||
|
|
||||||
if (recv_conn (sock, &key, schedule, &thataddr))
|
if (recv_conn (sock, &key, schedule, &thataddr))
|
||||||
return 1;
|
return 1;
|
||||||
if (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) {
|
||||||
localx = get_local_xsocket (&display_num);
|
localx = get_local_xsocket (&display_num);
|
||||||
if (localx < 0)
|
if (localx < 0)
|
||||||
return 1;
|
return 1;
|
||||||
tmp = htonl(display_num);
|
tmp = htonl(display_num);
|
||||||
if (write (sock, &tmp, sizeof(tmp)) != sizeof(tmp))
|
if (krb_net_write (sock, &tmp, sizeof(tmp)) != sizeof(tmp))
|
||||||
return 1;
|
return 1;
|
||||||
strncpy(xauthfile, tempnam("/tmp", NULL), sizeof(xauthfile));
|
strncpy(xauthfile, tempnam("/tmp", NULL), sizeof(xauthfile));
|
||||||
if (write (sock, xauthfile, sizeof(xauthfile)) !=
|
if (krb_net_write (sock, xauthfile, sizeof(xauthfile)) !=
|
||||||
sizeof(xauthfile))
|
sizeof(xauthfile))
|
||||||
return 1;
|
return 1;
|
||||||
if(create_and_write_cookie (xauthfile, cookie,
|
if(create_and_write_cookie (xauthfile, cookie,
|
||||||
sizeof(cookie)))
|
sizeof(cookie)))
|
||||||
return 1;
|
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))
|
!= sizeof(thataddr.sin_port))
|
||||||
return 1;
|
return 1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Reference in New Issue
Block a user