summaryrefslogtreecommitdiffstats
path: root/src/appl
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1994-12-19 20:15:08 +0000
committerTheodore Tso <tytso@mit.edu>1994-12-19 20:15:08 +0000
commit8d141f8aff20950fd9c7cd5bc445a01fab8e3ddb (patch)
tree04d7ddf3ee8b7d560bdfb704cfe601ecb10ed6b7 /src/appl
parent4dd88df8c309298ce8789be1d4f119082a3f89b6 (diff)
downloadkrb5-8d141f8aff20950fd9c7cd5bc445a01fab8e3ddb.tar.gz
krb5-8d141f8aff20950fd9c7cd5bc445a01fab8e3ddb.tar.xz
krb5-8d141f8aff20950fd9c7cd5bc445a01fab8e3ddb.zip
krcp.c, krlogin.c, krlogind.c (v5_des_write): Fix byte swapping code
(Missing shift instructions). krlogind.c: Fixed byte swapping code so that V4 des compatibility works on 64 bit architectures. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4734 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl')
-rw-r--r--src/appl/bsd/ChangeLog11
-rw-r--r--src/appl/bsd/krcp.c6
-rw-r--r--src/appl/bsd/krlogin.c12
-rw-r--r--src/appl/bsd/krlogind.c27
4 files changed, 36 insertions, 20 deletions
diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog
index 8cab422d6..b5fcb796c 100644
--- a/src/appl/bsd/ChangeLog
+++ b/src/appl/bsd/ChangeLog
@@ -1,3 +1,14 @@
+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,
diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c
index ccc05aa81..fad1e559c 100644
--- a/src/appl/bsd/krcp.c
+++ b/src/appl/bsd/krcp.c
@@ -1467,9 +1467,9 @@ int des_write(fd, buf, len)
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){
diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c
index d5d366802..1739fb2c7 100644
--- a/src/appl/bsd/krlogin.c
+++ b/src/appl/bsd/krlogin.c
@@ -1753,9 +1753,9 @@ int des_write(fd, buf, len)
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){
@@ -1882,9 +1882,9 @@ int des_write(fd, buf, len)
/* 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
diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c
index d8bd1f746..16bc6a852 100644
--- a/src/appl/bsd/krlogind.c
+++ b/src/appl/bsd/krlogind.c
@@ -879,7 +879,7 @@ char oobdata[] = {0};
*/
control(pty, cp, n)
int pty;
- char *cp;
+ unsigned char *cp;
int n;
{
struct winsize w;
@@ -1259,7 +1259,7 @@ v5_des_read(fd, buf, len)
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];
@@ -1364,9 +1364,9 @@ v5_des_write(fd, buf, len)
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){
@@ -1634,8 +1634,9 @@ register char *buf;
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));
@@ -1653,12 +1654,13 @@ int 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 */
@@ -1707,8 +1709,8 @@ int fd;
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));
@@ -1744,8 +1746,11 @@ int 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);
}