Skip to content

Commit

Permalink
Merge pull request #4307 from sysown/v2.x-4272
Browse files Browse the repository at this point in the history
Fix file descriptor leak introduced in x509 cache #4272
  • Loading branch information
renecannao authored Aug 1, 2023
2 parents c529525 + 24e3848 commit a97fd04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions deps/mariadb-client-library/openssl.c.sslkeylogfile.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@@ -526,12 +526,19 @@
@@ -529,12 +529,19 @@
memset(buf, 0, size);
if (userdata)
strncpy(buf, (char *)userdata, size);
Expand All @@ -18,7 +18,7 @@
char *certfile= mysql->options.ssl_cert,
*keyfile= mysql->options.ssl_key;
char *pw= (mysql->options.extension) ?
@@ -653,12 +660,13 @@
@@ -656,12 +663,13 @@
if (!(ctx= SSL_CTX_new(SSLv23_client_method())))
#endif
goto error;
Expand Down
11 changes: 7 additions & 4 deletions deps/mariadb-client-library/openssl.c.x509cache.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#if defined(_WIN32) && !defined(_OPENSSL_Applink) && defined(HAVE_OPENSSL_APPLINK_C)
#include <openssl/applink.c>
#endif
@@ -73,6 +79,81 @@
@@ -73,6 +79,84 @@
extern my_bool ma_tls_initialized;
extern unsigned int mariadb_deinitialize_ssl;

Expand Down Expand Up @@ -42,10 +42,13 @@
+ sprintf((char*)&(file_sha1[i*2]), "%02x", temp[i]);
+ }
+ munmap(fb,statbuf.st_size);
+ close(fd);
+ } else {
+ close(fd);
+ return 0;
+ }
+ } else {
+ close(fd);
+ return 0;
+ }
+
Expand Down Expand Up @@ -93,7 +96,7 @@
#define MAX_SSL_ERR_LEN 100
char tls_library_version[TLS_VERSION_LENGTH];

@@ -456,7 +537,7 @@
@@ -456,7 +540,7 @@
char *pw= (mysql->options.extension) ?
mysql->options.extension->tls_pw : NULL;
SSL_CTX *ctx= SSL_get_SSL_CTX(ssl);
Expand All @@ -102,7 +105,7 @@

/* add cipher */
if ((mysql->options.ssl_cipher &&
@@ -467,16 +548,32 @@
@@ -467,16 +551,32 @@
}

/* ca_file and ca_path */
Expand Down Expand Up @@ -139,7 +142,7 @@
if (keyfile && !certfile)
certfile= keyfile;
if (certfile && !keyfile)
@@ -566,6 +663,8 @@
@@ -566,6 +666,8 @@
SSL_CTX_sess_set_remove_cb(ctx, ma_tls_remove_session_cb);
#endif

Expand Down

0 comments on commit a97fd04

Please sign in to comment.