You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.5 KiB

  1. From 4d0ca6937f682998d16b94da74f463b18056cdea Mon Sep 17 00:00:00 2001
  2. From: Willy Tarreau <w@1wt.eu>
  3. Date: Thu, 22 Dec 2016 21:54:21 +0100
  4. Subject: [PATCH 12/19] BUG/MEDIUM: ssl: properly reset the reused_sess during
  5. a forced handshake
  6. We have a bug when SSL reuse is disabled on the server side : we reset
  7. the context but do not set it to NULL, causing a multiple free of the
  8. same entry. It seems like this bug cannot appear as-is with the current
  9. code (or the conditions to get it are not obvious) but it did definitely
  10. strike when trying to fix another bug with the SNI which forced a new
  11. handshake.
  12. This fix should be backported to 1.7, 1.6 and 1.5.
  13. (cherry picked from commit 30fd4bd8446dd7104b7d1cae9e762c7d1405171a)
  14. ---
  15. src/ssl_sock.c | 4 +++-
  16. 1 file changed, 3 insertions(+), 1 deletion(-)
  17. diff --git a/src/ssl_sock.c b/src/ssl_sock.c
  18. index 0a06adb..322488e 100644
  19. --- a/src/ssl_sock.c
  20. +++ b/src/ssl_sock.c
  21. @@ -3654,8 +3654,10 @@ reneg_ok:
  22. global.ssl_be_keys_max = global.ssl_be_keys_per_sec.curr_ctr;
  23. /* check if session was reused, if not store current session on server for reuse */
  24. - if (objt_server(conn->target)->ssl_ctx.reused_sess)
  25. + if (objt_server(conn->target)->ssl_ctx.reused_sess) {
  26. SSL_SESSION_free(objt_server(conn->target)->ssl_ctx.reused_sess);
  27. + objt_server(conn->target)->ssl_ctx.reused_sess = NULL;
  28. + }
  29. if (!(objt_server(conn->target)->ssl_ctx.options & SRV_SSL_O_NO_REUSE))
  30. objt_server(conn->target)->ssl_ctx.reused_sess = SSL_get1_session(conn->xprt_ctx);
  31. --
  32. 2.10.2