Skip to content

Commit 83d3c6c

Browse files
authored
Fix bug of system trust store not loaded properly
* Bug: system trust store has default value of "true" regardless of "encryption" value. * But if encryption is set to false, system trust store cannot be used, so system trust store should be saved as false if user does not enable encryption. * It may confuse the user if they see encryption is set to false but system trust store is set to true. In this case, the driver will not do system trust store verification. The DSN window should reflect this accurately.
1 parent 3df5d2f commit 83d3c6c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cpp/src/arrow/flight/sql/odbc/flight_sql/ui/dsn_configuration_window.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ int DsnConfigurationWindow::CreateEncryptionSettingsGroup(int posX, int posY, in
246246

247247
std::string val = config.Get(FlightSqlConnection::USE_ENCRYPTION);
248248

249+
// Enable encryption default value is true
249250
const bool enableEncryption = driver::odbcabstraction::AsBool(val).value_or(true);
250251
labels.push_back(CreateLabel(labelPosX, rowPos, LABEL_WIDTH, ROW_HEIGHT,
251252
L"Use Encryption:", ChildId::ENABLE_ENCRYPTION_LABEL));
@@ -270,6 +271,7 @@ int DsnConfigurationWindow::CreateEncryptionSettingsGroup(int posX, int posY, in
270271

271272
val = config.Get(FlightSqlConnection::USE_SYSTEM_TRUST_STORE).c_str();
272273

274+
// System trust store default value is true
273275
const bool useSystemCertStore = driver::odbcabstraction::AsBool(val).value_or(true);
274276
labels.push_back(CreateLabel(labelPosX, rowPos, LABEL_WIDTH, 2 * ROW_HEIGHT,
275277
L"Use System Certificate Store:",
@@ -297,6 +299,11 @@ int DsnConfigurationWindow::CreateEncryptionSettingsGroup(int posX, int posY, in
297299
CreateGroupBox(posX, posY, sizeX, rowPos - posY, L"Encryption settings",
298300
ChildId::AUTH_SETTINGS_GROUP_BOX);
299301

302+
certificateEdit->SetEnabled(enableEncryption);
303+
certificateBrowseButton->SetEnabled(enableEncryption);
304+
useSystemCertStoreCheckBox->SetEnabled(enableEncryption);
305+
disableCertVerificationCheckBox->SetEnabled(enableEncryption);
306+
300307
return rowPos - posY;
301308
}
302309

@@ -435,7 +442,9 @@ void DsnConfigurationWindow::SaveParameters(Configuration& targetConfig) {
435442
targetConfig.Set(FlightSqlConnection::DISABLE_CERTIFICATE_VERIFICATION,
436443
disableCertVerificationCheckBox->IsChecked() ? TRUE_STR : FALSE_STR);
437444
} else {
445+
// System trust store verification requires encryption
438446
targetConfig.Set(FlightSqlConnection::USE_ENCRYPTION, FALSE_STR);
447+
targetConfig.Set(FlightSqlConnection::USE_SYSTEM_TRUST_STORE, FALSE_STR);
439448
}
440449

441450
// Get all the list properties.

0 commit comments

Comments
 (0)