+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
*/
#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
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:
* -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;
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)",
}
#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);
}