Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy and Move constructors/assignments of ssl_options are not handling caPath_ #337

Closed
Thiesius opened this issue Apr 28, 2021 · 1 comment
Assignees
Labels
bug Confirmed bug fix added A fix has been pushed to the repo and is being tested
Milestone

Comments

@Thiesius
Copy link

Following snippet from my code is enough to reproduce the issue.

  mqtt::ssl_options opts;
  opts.set_enable_server_cert_auth(true);
  opts.set_ssl_version(MQTT_SSL_VERSION_TLS_1_2);
  // opts.set_enabled_cipher_suites() TODO: Do we want to restrict cipher list?
  opts.set_key_store(variant.certificate);
  opts.set_private_key(variant.key);
  opts.ca_path(variant.certificateAuthorityDir);
  opts.set_error_handler([](const std::string& errMsg) {
  //...
  });
  optsBuilder.ssl(std::move(opts));
  
  auto tok = client_.connect(opts);
  tok->wait();

This should by easy to fix.

Hack-fix - in case someone having the same issue can't wait until the member variable gets copied/moved correctly in next library release:

...
 optsBuilder.ssl(std::move(opts));
 mqtt::ssl_options& sslOpts = const_cast<mqtt::ssl_options&>(opts.get_ssl_options());
 sslOpts.ca_path(tlsSetup->certificateAuthorityDir);
 auto tok = client_.connect(opts);
...
@fpagliughi fpagliughi self-assigned this Apr 28, 2021
@fpagliughi fpagliughi added the bug Confirmed bug label Apr 28, 2021
@fpagliughi fpagliughi added this to the v1.2.1 milestone Apr 28, 2021
@fpagliughi
Copy link
Contributor

Yeah, that looks like a bug. Thanks for the report!

@fpagliughi fpagliughi added the fix added A fix has been pushed to the repo and is being tested label Apr 30, 2021
@fpagliughi fpagliughi modified the milestones: v1.2.1, v1.3 Mar 16, 2023
emrahayanoglu pushed a commit to emrahayanoglu/paho.mqtt.cpp that referenced this issue May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug fix added A fix has been pushed to the repo and is being tested
Projects
None yet
Development

No branches or pull requests

2 participants