]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: ssl_sock_prepare_ssl_ctx does not return an error code
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Wed, 21 Apr 2021 13:32:46 +0000 (15:32 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 26 Apr 2021 13:57:26 +0000 (15:57 +0200)
The return value check was wrongly based on error codes when the
function actually returns an error number.
This bug was introduced by f3eedfe19592ebcbaa5b97d8c68aa162e7f6f8fa
which is a feature not present before branch 2.4.

It does not need to be backported.

src/ssl_ckch.c

index 7504c55b873158211137ad13e539141d831bf370..c41c1789cf94f6b75361e7bad6862604e9b903f7 100644 (file)
@@ -1259,6 +1259,7 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
        int y = 0;
        char *err = NULL;
        int errcode = 0;
+       int retval = 0;
        struct ckch_store *old_ckchs, *new_ckchs = NULL;
        struct ckch_inst *ckchi, *ckchis;
        struct buffer *trash = alloc_trash_chunk();
@@ -1337,8 +1338,8 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
                                        new_inst->server = ckchi->server;
                                        /* Create a new SSL_CTX and link it to the new instance. */
                                        if (new_inst->is_server_instance) {
-                                               errcode |= ssl_sock_prepare_srv_ssl_ctx(ckchi->server, new_inst->ctx);
-                                               if (errcode & ERR_CODE)
+                                               retval = ssl_sock_prepare_srv_ssl_ctx(ckchi->server, new_inst->ctx);
+                                               if (retval)
                                                        goto error;
                                        }