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 "des_locl.h"
int LEFT_JUSTIFIED = 0;
/* This has some uglies in it but it works - even over sockets. */
extern int errno;
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
* 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)
{
@@ -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_cblock *)buf,8,sched,iv,
DES_DECRYPT);
#ifdef LEFT_JUSTIFIED
memcpy(buf, buf, num);
#else
memcpy(buf, buf+(8-num), num);
#endif
if (!LEFT_JUSTIFIED)
memcpy(buf, buf+(8-num), num); /* Right justified */
}
}
return(num);

View File

@@ -5,6 +5,8 @@
#include <errno.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))
{
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 */
if (len < 8)
{
#ifdef LEFT_JUSTIFIED
p=shortbuf;
memcpy(shortbuf,buf,len);
for (i=len; i<8; i++)
shortbuf[i]=rand();
rnum=8;
#else
p=shortbuf;
for (i=0; i<8-len; i++)
shortbuf[i]=rand();
memcpy(shortbuf + 8 - len, buf, len);
rnum=8;
#endif
if (LEFT_JUSTIFIED)
{
p=shortbuf;
memcpy(shortbuf,buf,len);
for (i=len; i<8; i++)
shortbuf[i]=rand();
rnum=8;
}
else
{
p=shortbuf;
for (i=0; i<8-len; i++)
shortbuf[i]=rand();
memcpy(shortbuf + 8 - len, buf, len);
rnum=8;
}
}
else
{