Skip to content

Commit 8c2d93c

Browse files
apacheGH-49444: [C++][FlightRPC][ODBC] Disable DSN default values on MacOS (apache#49402)
### Rationale for this change iodbc driver manager on macOS treats default values as real values when reading from system DSN, and the driver manager ignores the actual values. * GitHub Issue: apache#49444 Lead-authored-by: justing-bq <62349012+justing-bq@users.noreply.github.com> Co-authored-by: alinalibq <alina.li@improving.com> Signed-off-by: David Li <li.davidm96@gmail.com>
1 parent dbbf7cf commit 8c2d93c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

cpp/src/arrow/flight/sql/odbc/odbc_impl/config/configuration.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,29 @@ void Configuration::LoadDsn(const std::string& dsn) {
129129
Set(FlightSqlConnection::TOKEN, ReadDsnString(dsn, FlightSqlConnection::TOKEN));
130130
Set(FlightSqlConnection::UID, ReadDsnString(dsn, FlightSqlConnection::UID));
131131
Set(FlightSqlConnection::PWD, ReadDsnString(dsn, FlightSqlConnection::PWD));
132-
Set(FlightSqlConnection::USE_ENCRYPTION,
133-
ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION, DEFAULT_ENABLE_ENCRYPTION));
134132
Set(FlightSqlConnection::TRUSTED_CERTS,
135133
ReadDsnString(dsn, FlightSqlConnection::TRUSTED_CERTS));
134+
#ifdef __APPLE__
135+
// macOS iODBC treats non-empty defaults as the real values when reading from system
136+
// DSN, so we don't pass defaults on macOS.
137+
// GH-49387 TODO: enable default values on macOS
138+
Set(FlightSqlConnection::USE_ENCRYPTION,
139+
ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION));
140+
Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
141+
ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE));
142+
Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
143+
ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION));
144+
#else
145+
// Windows and Linux
146+
Set(FlightSqlConnection::USE_ENCRYPTION,
147+
ReadDsnString(dsn, FlightSqlConnection::USE_ENCRYPTION, DEFAULT_ENABLE_ENCRYPTION));
136148
Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
137149
ReadDsnString(dsn, FlightSqlConnection::USE_SYSTEM_TRUST_STORE,
138150
DEFAULT_USE_CERT_STORE));
139151
Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
140152
ReadDsnString(dsn, FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
141153
DEFAULT_DISABLE_CERT_VERIFICATION));
154+
#endif
142155

143156
auto customKeys = ReadAllKeys(dsn);
144157
RemoveAllKnownKeys(customKeys);

0 commit comments

Comments
 (0)