Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-706

SetSSL marks value as set when they are empty/nil

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 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.

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            david.golden@mongodb.com David Golden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: