Add -x option to rcp.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@207 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Björn Groenvall
1995-12-27 22:40:48 +00:00
parent 67f906f599
commit 2de4db6a42
2 changed files with 26 additions and 19 deletions

View File

@@ -5,6 +5,8 @@
#include <errno.h> #include <errno.h>
#include "des_locl.h" #include "des_locl.h"
int LEFT_JUSTIFIED = 0;
/* This has some uglies in it but it works - even over sockets. */ /* This has some uglies in it but it works - even over sockets. */
extern int errno; extern int errno;
int des_rw_mode=DES_PCBC_MODE; int des_rw_mode=DES_PCBC_MODE;
@@ -120,7 +122,10 @@ int des_enc_read(int fd, char *buf, int len, struct des_ks_struct *sched, des_cb
/* eay 26/08/92 fix a bug that returned more /* eay 26/08/92 fix a bug that returned more
* bytes than you asked for (returned len bytes :-( */ * bytes than you asked for (returned len bytes :-( */
memcpy(buf,tmpbuf,num); if (LEFT_JUSTIFIED || (len >= 8))
memcpy(buf,tmpbuf,num);
else
memcpy(buf,tmpbuf+(8-num),num); /* Right justified */
} }
else if (num >= 8) else if (num >= 8)
{ {
@@ -143,11 +148,8 @@ int des_enc_read(int fd, char *buf, int len, struct des_ks_struct *sched, des_cb
des_cbc_encrypt((des_cblock *)net, des_cbc_encrypt((des_cblock *)net,
(des_cblock *)buf,8,sched,iv, (des_cblock *)buf,8,sched,iv,
DES_DECRYPT); DES_DECRYPT);
#ifdef LEFT_JUSTIFIED if (!LEFT_JUSTIFIED)
memcpy(buf, buf, num); memcpy(buf, buf+(8-num), num); /* Right justified */
#else
memcpy(buf, buf+(8-num), num);
#endif
} }
} }
return(num); return(num);

View File

@@ -5,6 +5,8 @@
#include <errno.h> #include <errno.h>
#include "des_locl.h" #include "des_locl.h"
extern int LEFT_JUSTIFIED;
int des_enc_write(int fd, char *buf, int len, struct des_ks_struct *sched, des_cblock (*iv)) int des_enc_write(int fd, char *buf, int len, struct des_ks_struct *sched, des_cblock (*iv))
{ {
long rnum; long rnum;
@@ -45,19 +47,22 @@ int des_enc_write(int fd, char *buf, int len, struct des_ks_struct *sched, des_c
/* pad short strings */ /* pad short strings */
if (len < 8) if (len < 8)
{ {
#ifdef LEFT_JUSTIFIED if (LEFT_JUSTIFIED)
p=shortbuf; {
memcpy(shortbuf,buf,len); p=shortbuf;
for (i=len; i<8; i++) memcpy(shortbuf,buf,len);
shortbuf[i]=rand(); for (i=len; i<8; i++)
rnum=8; shortbuf[i]=rand();
#else rnum=8;
p=shortbuf; }
for (i=0; i<8-len; i++) else
shortbuf[i]=rand(); {
memcpy(shortbuf + 8 - len, buf, len); p=shortbuf;
rnum=8; for (i=0; i<8-len; i++)
#endif shortbuf[i]=rand();
memcpy(shortbuf + 8 - len, buf, len);
rnum=8;
}
} }
else else
{ {