-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 0.1.0
-
Component/s: None
-
None
SetSSL unconditionally sets connection string "*Set" variables to true, even if their corresponding inputs are empty/nil. E.g. c.ConnString.SSLClientCertificateKeyFileSet = true. This is a regression of
A patch like the following should fix the problem:
- c.ConnString.SSLClientCertificateKeyFile = ssl.ClientCertificateKeyFile - c.ConnString.SSLClientCertificateKeyFileSet = true + if ssl.ClientCertificateKeyFile != "" { + c.ConnString.SSLClientCertificateKeyFile = ssl.ClientCertificateKeyFile + c.ConnString.SSLClientCertificateKeyFileSet = true + } - c.ConnString.SSLClientCertificateKeyPassword = ssl.ClientCertificateKeyPassword - c.ConnString.SSLClientCertificateKeyPasswordSet = true + if ssl.ClientCertificateKeyPassword != nil { + c.ConnString.SSLClientCertificateKeyPassword = ssl.ClientCertificateKeyPassword + c.ConnString.SSLClientCertificateKeyPasswordSet = true + } c.ConnString.SSLInsecure = ssl.Insecure c.ConnString.SSLInsecureSet = true - c.ConnString.SSLCaFile = ssl.CaFile - c.ConnString.SSLCaFileSet = true + if ssl.CaFile != "" { + c.ConnString.SSLCaFile = ssl.CaFile + c.ConnString.SSLCaFileSet = true + }
Alternatively, the SSLOpt type should gain *Set booleans, a constructor and mutators and SetSSL should check those booleans.
- duplicates
-
GODRIVER-688 ClientOptions.SetSSL() records some string options as being set even if they're empty strings
- Closed