summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>1996-07-27 01:56:47 +0000
committerSam Hartman <hartmans@mit.edu>1996-07-27 01:56:47 +0000
commit558444b37c64554d1d67242c88de9972b87fdaff (patch)
tree6549b58fdcc9bafe98f3152116ba24dae206f58b
parent52b8d0ca3bc884064f288fc936ee82a6a7a04569 (diff)
downloadkrb5-558444b37c64554d1d67242c88de9972b87fdaff.tar.gz
krb5-558444b37c64554d1d67242c88de9972b87fdaff.tar.xz
krb5-558444b37c64554d1d67242c88de9972b87fdaff.zip
* Define a non-zero FUDGE_FACTOR for GSSAPI; I have it set to 64 now,
even though I tend to see 52 bytes of increased data because I'm not sure that the 52 bytes is constant across all implementations ands options. * When allocating outbuf, set bufsize to the size that was actually allocated; it tends not to be nbyte+FUDGE_FACTOR exactly, and you smash the heap if you store a different size than you actually allocate. * If a secure_putbyte fails, set nout to zero so you don't run off the end of the buffer next time around. * Only write out foure bytes of net_len, no matter how big it is. The right answer is to have it be some 32-bit type but I'm not sure if I should use the krb5 type, the GSSAPI type, or what. (Remember, this code has ifdefs for KerberosIV without GSSAPI) * While we're at it, if secure_write fails while writing out a file in the client, notice the error. (a break in an inner loop didn't break out quite far enough) With these changes, I am able to get and put multi-megabyte files even on an Alpha. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8847 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/appl/gssftp/ftp/ChangeLog17
-rw-r--r--src/appl/gssftp/ftp/ftp.c2
-rw-r--r--src/appl/gssftp/ftp/secure.c23
3 files changed, 33 insertions, 9 deletions
diff --git a/src/appl/gssftp/ftp/ChangeLog b/src/appl/gssftp/ftp/ChangeLog
index d73bf4c692..3533bf026b 100644
--- a/src/appl/gssftp/ftp/ChangeLog
+++ b/src/appl/gssftp/ftp/ChangeLog
@@ -1,3 +1,20 @@
+Fri Jul 26 20:55:12 1996 Sam Hartman <hartmans@tertius.mit.edu>
+
+ * secure.c (secure_putbyte): Reset nout to zero on errorso we
+ don't overflow our buffer.
+
+ * ftp.c (sendrequest): If there is an error in secure_write, break
+ out of the loop.
+
+ * secure.c(FUDGE_FACTOR): Define for GSSAPI so writes don't fail.
+ i chose a value of 64, which is larger than the apparent 52 bytes
+ of additional data but I'm not sure 52 is constant.
+
+ (secure_putbuf): Set bufsize to the size we actually allocate
+ Also, write foure bytes for net_len no matter how long it
+ actually is. I would rather declare it a 32-bit type but am not
+ sure whether to use the GSSAPI, krb4, or krb5 32-bit int.
+
Wed Jul 10 16:40:19 1996 Marc Horowitz <marc@mit.edu>
* cmdtab.c (cmdtab[]), cmds.c (delete_file): rename delete() to
diff --git a/src/appl/gssftp/ftp/ftp.c b/src/appl/gssftp/ftp/ftp.c
index a90987f9f5..0a2f4d1544 100644
--- a/src/appl/gssftp/ftp/ftp.c
+++ b/src/appl/gssftp/ftp/ftp.c
@@ -892,6 +892,8 @@ sendrequest(cmd, local, remote, printnames)
}
(void) fflush(stdout);
}
+ if (d <= 0 )
+ break;
}
if (hash && bytes > 0) {
if (bytes < HASHBYTES)
diff --git a/src/appl/gssftp/ftp/secure.c b/src/appl/gssftp/ftp/secure.c
index 6bcc491066..6500ed3308 100644
--- a/src/appl/gssftp/ftp/secure.c
+++ b/src/appl/gssftp/ftp/secure.c
@@ -54,6 +54,10 @@ static unsigned int nout, bufp; /* number of chars in ucbuf,
*/
#endif /* KERBEROS */
+#ifdef GSSAPI
+#define FUDGE_FACTOR 64 /*It appears to add 52 byts, but I'm not usre it is a constant--hartmans*/
+#endif /*GSSAPI*/
+
#ifndef FUDGE_FACTOR /* In case no auth types define it. */
#define FUDGE_FACTOR 0
#endif
@@ -136,11 +140,12 @@ unsigned char c;
int ret;
ucbuf[nout++] = c;
- if (nout == MAX - FUDGE_FACTOR)
- if (ret = secure_putbuf(fd, ucbuf, nout))
- return(ret);
- else nout = 0;
- return(c);
+ if (nout == MAX - FUDGE_FACTOR) {
+ ret = secure_putbuf(fd, ucbuf, nout);
+ nout = 0;
+ return(ret?ret:c);
+ }
+return (c);
}
/* returns:
@@ -202,11 +207,11 @@ unsigned int nbyte;
* -2 on security error
*/
secure_putbuf(fd, buf, nbyte)
-int fd;
+ int fd;
unsigned char *buf;
unsigned int nbyte;
{
- static char *outbuf; /* output ciphertext */
+ static char *outbuf; /* output ciphertext */
static unsigned int bufsize; /* size of outbuf */
long length;
u_long net_len;
@@ -217,7 +222,7 @@ unsigned int nbyte;
if (outbuf?
(outbuf = realloc(outbuf, (unsigned) (nbyte + FUDGE_FACTOR))):
(outbuf = malloc((unsigned) (nbyte + FUDGE_FACTOR)))) {
- bufsize = nbyte + FUDGE_FACTOR;
+ bufsize = out_buf.length;
} else {
bufsize = 0;
secure_error("%s (in malloc of PROT buffer)",
@@ -278,7 +283,7 @@ unsigned int nbyte;
}
#endif /* GSSAPI */
net_len = htonl((u_long) length);
- if (looping_write(fd, &net_len, sizeof(net_len)) == -1) return(-1);
+ if (looping_write(fd, &net_len, 4) == -1) return(-1);
if (looping_write(fd, outbuf, length) != length) return(-1);
return(0);
}