Make sure settings import doesn't degrade connection security

Rewrite the now obsolete values "SSL_TLS_OPTIONAL" and "STARTTLS_OPTIONAL"
 to their "*_REQUIRED" counterparts before import.
This commit is contained in:
cketti 2014-03-05 05:32:00 +01:00
parent 0a63466704
commit 75fc76773d
1 changed files with 10 additions and 0 deletions

View File

@ -1110,6 +1110,16 @@ public class SettingsImporter {
private static ConnectionSecurity convertConnectionSecurity(String connectionSecurity) {
try {
/*
* TODO:
* Add proper settings validation and upgrade capability for server settings.
* Once that exists, move this code into a SettingsUpgrader.
*/
if ("SSL_TLS_OPTIONAL".equals(connectionSecurity)) {
return ConnectionSecurity.SSL_TLS_REQUIRED;
} else if ("STARTTLS_OPTIONAL".equals(connectionSecurity)) {
return ConnectionSecurity.STARTTLS_REQUIRED;
}
return ConnectionSecurity.valueOf(connectionSecurity);
} catch (Exception e) {
return ConnectionSecurity.NONE;