+Mon Dec 19 15:09:57 1994 Theodore Y. Ts'o (tytso@dcl)
+
+ * krcp.c (des_write):
+ * krlogin.c (des_write):
+ * krlogind.c (v5_des_write): Fix byte swapping code (Missing shift
+ instructions).
+
+ * krlogind.c (v4_des_read, v4_des_write): Fixed byte swapping code
+ so that V4 des compatibility works on 64 bit
+ architectures.
+
Fri Nov 18 01:19:13 1994 Mark Eichin <eichin@cygnus.com>
* Makefile.in (install): add install rules for krlogind.M,
return(-1);
}
- len_buf[0] = (len & 0xff000000);
- len_buf[1] = (len & 0xff0000);
- len_buf[2] = (len & 0xff00);
+ len_buf[0] = (len & 0xff000000) >> 24;
+ len_buf[1] = (len & 0xff0000) >> 16;
+ len_buf[2] = (len & 0xff00) >> 8;
len_buf[3] = (len & 0xff);
(void) write(fd, len_buf, 4);
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
return(-1);
}
- len_buf[0] = (len & 0xff000000);
- len_buf[1] = (len & 0xff0000);
- len_buf[2] = (len & 0xff00);
+ len_buf[0] = (len & 0xff000000) >> 24;
+ len_buf[1] = (len & 0xff0000) >> 16;
+ len_buf[2] = (len & 0xff00) >> 8;
len_buf[3] = (len & 0xff);
(void) write(fd, len_buf, 4);
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
/* tell the other end the real amount, but send an 8-byte padded
packet */
- len_buf[0] = (len & 0xff000000);
- len_buf[1] = (len & 0xff0000);
- len_buf[2] = (len & 0xff00);
+ len_buf[0] = (len & 0xff000000) >> 24;
+ len_buf[1] = (len & 0xff0000) >> 16;
+ len_buf[2] = (len & 0xff00) >> 8;
len_buf[3] = (len & 0xff);
(void) write(fd, len_buf, 4);
#ifdef NOROUNDUP
*/
control(pty, cp, n)
int pty;
- char *cp;
+ unsigned char *cp;
int n;
{
struct winsize w;
int len;
{
int nreturned = 0;
- long net_len,rd_len;
+ krb5_ui_4 net_len,rd_len;
int cc,retry;
unsigned char len_buf[4];
return(-1);
}
- len_buf[0] = (len & 0xff000000);
- len_buf[1] = (len & 0xff0000);
- len_buf[2] = (len & 0xff00);
+ len_buf[0] = (len & 0xff000000) >> 24;
+ len_buf[1] = (len & 0xff0000) >> 16;
+ len_buf[2] = (len & 0xff00) >> 8;
len_buf[3] = (len & 0xff);
(void) write(fd, len_buf, 4);
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
int len;
{
int nreturned = 0;
- long net_len, rd_len;
+ krb5_ui_4 net_len, rd_len;
int cc;
+ unsigned char len_buf[4];
if (!do_encrypt)
return(read(fd, buf, len));
nstored = 0;
}
- if ((cc = krb_net_read(fd, &net_len, sizeof(net_len))) != sizeof(net_len)) {
+ if ((cc = krb_net_read(fd, (char *)&len_buf, 4)) != 4) {
/* XXX can't read enough, pipe
must have closed */
return(0);
}
- net_len = ntohl(net_len);
+ net_len = ((len_buf[0]<<24) | (len_buf[1]<<16) |
+ (len_buf[2]<<8) | len_buf[3]);
if (net_len < 0 || net_len > sizeof(des_inbuf)) {
/* XXX preposterous length, probably out of sync.
act as if pipe closed */
char *buf;
int len;
{
- long net_len;
static char garbage_buf[8];
+ unsigned char len_buf[4];
if (!do_encrypt)
return(write(fd, buf, len));
/* tell the other end the real amount, but send an 8-byte padded
packet */
- net_len = htonl(len);
- (void) write(fd, &net_len, sizeof(net_len));
+ len_buf[0] = (len & 0xff000000) >> 24;
+ len_buf[1] = (len & 0xff0000) >> 16;
+ len_buf[2] = (len & 0xff00) >> 8;
+ len_buf[3] = (len & 0xff);
+ (void) write(fd, len_buf, 4);
(void) write(fd, des_outbuf, roundup(len,8));
return(len);
}