[CXX-1163] Compiling with SSL support doesn't work Created: 13/Dec/16  Updated: 15/Dec/16  Resolved: 13/Dec/16

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Bug Priority: Critical - P2
Reporter: Samuel Rossi (Inactive) Assignee: David Golden
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Even when compiling libmongoc with SSL support, compiling the C++ driver and running code using SSL features fails.

To reproduce:

  1. Compile/install libmongoc with SSL support
  2. Compile the C++ driver as usual
  3. Compile and run the following code:

#include <bsoncxx/builder/basic/document.hpp>
#include <bsoncxx/builder/basic/kvp.hpp>
#include <bsoncxx/document/value.hpp>
#include <bsoncxx/json.hpp>
#include <iostream>
#include <mongocxx/client.hpp>
#include <mongocxx/database.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/uri.hpp>
#include <mongocxx/uri.hpp>
 
using namespace mongocxx;
using namespace bsoncxx::builder::basic;
 
int main() {
  mongocxx::instance instance{};
 
  document builder{};
  builder.append(kvp("_isSelf", 1));
  bsoncxx::document::value is_self = builder.extract();
 
  {
    client client{uri{"mongodb://snitest1.10gen.cc:27777/?ssl=true"}};
    database db = client["test"];
    std::cout << "First output: "
              << bsoncxx::to_json(db.run_command(is_self.view())) << std::endl;
  }
 
  {
    client client{uri{"mongodb://snitest2.mongodb.com:27777/?ssl=true"}};
    database db = client["test"];
    bsoncxx::document::value output = db.run_command(is_self.view());
 
    std::cout << "Second output: " << bsoncxx::to_json(output) << std::endl;
  }
}

The output will be something like this:

libc++abi.dylib: terminating with uncaught exception of type mongocxx::v_noabi::exception: SSL support not available



 Comments   
Comment by Githook User [ 14/Dec/16 ]

Author:

{u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}

Message: CXX-1163 Fix broken SSL testing

The unit tests to confirm that a pool could be configured with SSL
options never ran because the tests were guarded by a private definition
that was never included. This also concealed a bug where mocking failed
because the necessary private header wasn't included in a test helper header.

This commit adds the private header to the test helper header to fix
mocking and runs the SSL pool configuration test unconditionally if
MONGOC_ENABLE_SSL is configured. I manually verified that this commit
would have caught the original CXX-1163 bug.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/ed7fa4998fb18d537f7bf2aea8455f1fab9622b7

Comment by Githook User [ 14/Dec/16 ]

Author:

{u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}

Message: CXX-1163 Fix broken SSL testing

The unit tests to confirm that a pool could be configured with SSL
options never ran because the tests were guarded by a private definition
that was never included. This also concealed a bug where mocking failed
because the necessary private header wasn't included in a test helper header.

This commit adds the private header to the test helper header to fix
mocking and runs the SSL pool configuration test unconditionally if
MONGOC_ENABLE_SSL is configured. I manually verified that this commit
would have caught the original CXX-1163 bug.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/ed7fa4998fb18d537f7bf2aea8455f1fab9622b7

Comment by Githook User [ 13/Dec/16 ]

Author:

{u'username': u'xdg', u'name': u'David Golden', u'email': u'xdg@xdg.me'}

Message: CXX-1163 Fix non-functional SSL configuration

This was broken in merge commit 941ad9af287b0151758baa0e8da4b0826e99b1b7
possibly due to a mistake in rename detection.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/16d5b81437096972bb21747c530e9ef73f6bfb46

Generated at Wed Feb 07 22:01:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.