Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2002 19:12:25 -0800 (PST)
From:      Bill Fenner <fenner@research.att.com>
To:        freebsd-current@freebsd.org
Subject:   libfetch(3) patch for SSL
Message-ID:  <200210300312.g9U3CPZs021756@stash.attlabs.att.com>

next in thread | raw e-mail | index | archive | help
Turns out my writev patch for fetch broke SSL, since it could create
iov[0].iov_len = 0, which would cause SSL_write(..,0), which would
return 0, which would look like a short write and cause an error, which
then gets ignored by http.c .  Ignoring the bigger picture of the error
checking, this fix at least gets https: working again by making sure
that _fetch_putln doesn't construct an iov with iov_len == 0.  (Yes,
this is against rev 1.40, post-brouhaha).

  Bill

Index: common.c
===================================================================
RCS file: /home/ncvs/src/lib/libfetch/common.c,v
retrieving revision 1.40
diff -u -r1.40 common.c
--- common.c	30 Oct 2002 00:17:16 -0000	1.40
+++ common.c	30 Oct 2002 03:06:58 -0000
@@ -539,13 +539,18 @@
 _fetch_putln(conn_t *conn, const char *str, size_t len)
 {
 	struct iovec iov[2];
+	int ret;
 
 	DEBUG(fprintf(stderr, ">>> %s\n", str));
 	iov[0].iov_base = __DECONST(char *, str);
 	iov[0].iov_len = len;
 	iov[1].iov_base = __DECONST(char *, ENDL);
 	iov[1].iov_len = sizeof ENDL;
-	if (_fetch_writev(conn, iov, 2) == -1)
+	if (len == 0)
+		ret = _fetch_writev(conn, &iov[1], 1);
+	else
+		ret = _fetch_writev(conn, iov, 2);
+	if (ret == -1)
 		return (-1);
 	return (0);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210300312.g9U3CPZs021756>