]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: ssl: Return -1 on recv/send if we got EAGAIN.
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 24 Apr 2019 10:04:36 +0000 (12:04 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 24 Apr 2019 10:06:08 +0000 (12:06 +0200)
In ha_ssl_read()/ha_ssl_write(), if we couldn't send/receive data because
we got EAGAIN, return -1 and not 0, as older SSL versions expect that.
This should fix the problems with OpenSSL < 1.1.0.

src/ssl_sock.c

index 58ae8a264acc677a91e3c374e9f1a65d52b18e53..015943ee61c7990ca61005adcf4034c76d06e473 100644 (file)
@@ -271,8 +271,10 @@ static int ha_ssl_write(BIO *h, const char *buf, int num)
        tmpbuf.data = num;
        tmpbuf.head = 0;
        ret = ctx->xprt->snd_buf(ctx->conn, ctx->xprt_ctx, &tmpbuf, num, 0);
-       if (ret == 0 && !(ctx->conn->flags & CO_FL_ERROR))
+       if (ret == 0 && !(ctx->conn->flags & CO_FL_ERROR)) {
                BIO_set_retry_write(h);
+               ret = -1;
+       }
        return ret;
 }
 
@@ -304,8 +306,10 @@ static int ha_ssl_read(BIO *h, char *buf, int size)
        tmpbuf.data = 0;
        tmpbuf.head = 0;
        ret = ctx->xprt->rcv_buf(ctx->conn, ctx->xprt_ctx, &tmpbuf, size, 0);
-       if (ret == 0 && !(ctx->conn->flags & CO_FL_ERROR))
+       if (ret == 0 && !(ctx->conn->flags & CO_FL_ERROR)) {
                BIO_set_retry_read(h);
+               ret = -1;
+       }
 
        return ret;
 }