Suppress snprintf "output may be truncated" warnings
[hiphop-php.git] / patches / 0001-only-disable-SSL-mode-if-we-have-a-MySQL-client-lib-.patch
blobd7c7c2ec5e173902c72fe5ab4b34cb2ac1c4c277
1 From 5237d8ce57269a2f58d1b491f76684d632f96d85 Mon Sep 17 00:00:00 2001
2 From: Fred Emmott <fe@fb.com>
3 Date: Thu, 30 Aug 2018 10:58:40 -0700
4 Subject: [PATCH] only disable SSL mode if we have a MySQL client lib that
5 supports it
7 ---
8 squangle/mysql_client/AsyncMysqlClient.cpp | 2 ++
9 squangle/mysql_client/SSLOptionsProviderBase.cpp | 2 ++
10 2 files changed, 4 insertions(+)
12 diff --git a/third-party/squangle/squangle/mysql_client/AsyncMysqlClient.cpp b/third-party/squangle/squangle/mysql_client/AsyncMysqlClient.cpp
13 index ee35853..fc39541 100644
14 --- a/third-party/squangle/squangle/mysql_client/AsyncMysqlClient.cpp
15 +++ b/third-party/squangle/squangle/mysql_client/AsyncMysqlClient.cpp
16 @@ -365,9 +365,11 @@ void Connection::initMysqlOnly() {
17 mysql_connection_ = std::make_unique<MysqlConnectionHolder>(
18 mysql_client_, mysql_init(nullptr), conn_key_);
19 mysql_connection_->mysql()->options.client_flag &= ~CLIENT_LOCAL_FILES;
20 +#ifdef MYSQL_OPT_SSL_MODE
21 // Turn off SSL by default for tests that rely on this.
22 enum mysql_ssl_mode ssl_mode = SSL_MODE_DISABLED;
23 mysql_options(mysql_connection_->mysql(), MYSQL_OPT_SSL_MODE, &ssl_mode);
24 +#endif
27 void Connection::initialize(bool initMysql) {
28 diff --git a/third-party/squangle/squangle/mysql_client/SSLOptionsProviderBase.cpp b/third-party/squangle/squangle/mysql_client/SSLOptionsProviderBase.cpp
29 index 8dcfe24..44a95d8 100644
30 --- a/third-party/squangle/squangle/mysql_client/SSLOptionsProviderBase.cpp
31 +++ b/third-party/squangle/squangle/mysql_client/SSLOptionsProviderBase.cpp
32 @@ -14,8 +14,10 @@ bool SSLOptionsProviderBase::setMysqlSSLOptions(MYSQL* mysql) {
34 // We need to set ssl_mode because we set it to disabled after we call
35 // mysql_init.
36 +#ifdef MYSQL_OPT_SSL_MODE
37 enum mysql_ssl_mode ssl_mode = SSL_MODE_PREFERRED;
38 mysql_options(mysql, MYSQL_OPT_SSL_MODE, &ssl_mode);
39 +#endif
40 mysql_options(mysql, MYSQL_OPT_SSL_CONTEXT, sslContext->getSSLCtx());
41 auto sslSession = getSSLSession();
42 if (sslSession) {
43 --
44 2.13.5