Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3723

Validate URI options on client/client pool creation

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.21.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • Labels:
      None

      URI options may be passed to a mongoc_uri_t in three ways.

      1. Through the string passed to the mongoc_uri_new call.

      uri = mongoc_uri_new ("mongodb://localhost:27017/?ssl=true");
      

       
      2. After creation, through the mongoc_uri_set_option_as_* helpers 

      uri = mongoc_uri_new ("mongodb://localhost:27017/");
      mongoc_uri_set_option_as_bool (uri, "ssl", false);
      

       
      3. Via TXT records on a mongodb+srv URI.
       
      mongoc_uri_parse_options validates that there are no conflicts between canonical and non-canonical values (e.g. having both ssl=true and tls=false). It is called for both (1) and (3).

      mongoc_uri_finalize_tls, mongoc_uri_finalize_auth, mongoc_uri_finalize_directconnection validate other state of URI options. It is only called for (1).

      Options set by (2) may not undergo validation unless they validated from options being applied by (3).

      URI options should be validated regardless of how options are set. The proposed solution is to validate URI options on client/client pool construction by introducing the new APIs:

      mongoc_client_t* mongoc_client_new_with_error (mongoc_uri_t* uri, bson_error_t* error);
      mongoc_client_pool_t* mongoc_client_pool_new_with_error (mongoc_uri_t* uri, bson_error_t* error);
      

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: