Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package aws-crt-cpp for openSUSE:Factory checked in at 2025-07-09 17:28:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/aws-crt-cpp (Old) and /work/SRC/openSUSE:Factory/.aws-crt-cpp.new.7373 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "aws-crt-cpp" Wed Jul 9 17:28:55 2025 rev:31 rq:1291443 version:0.32.10 Changes: -------- --- /work/SRC/openSUSE:Factory/aws-crt-cpp/aws-crt-cpp.changes 2025-06-06 22:45:10.822084133 +0200 +++ /work/SRC/openSUSE:Factory/.aws-crt-cpp.new.7373/aws-crt-cpp.changes 2025-07-09 17:30:00.679562240 +0200 @@ -1,0 +2,10 @@ +Wed Jul 9 08:51:20 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to version 0.32.10 + * Update eventstream submodule: by @bretambrose in (#748) +- from version 0.32.9 + * Use smart pointers in MQTT5 builder by @sfod in (#742) + * Remove windows-2019 and latest submodules by @TingDaoK in (#745) + * Update submodules by @sfod in (#746) + +------------------------------------------------------------------- Old: ---- v0.32.8.tar.gz New: ---- v0.32.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ aws-crt-cpp.spec ++++++ --- /var/tmp/diff_new_pack.BYmslW/_old 2025-07-09 17:30:01.243585774 +0200 +++ /var/tmp/diff_new_pack.BYmslW/_new 2025-07-09 17:30:01.243585774 +0200 @@ -20,7 +20,7 @@ %define library_soversion 1 Name: aws-crt-cpp -Version: 0.32.8 +Version: 0.32.10 Release: 0 Summary: AWS C++ wrapper for AWS SDK C libraries License: Apache-2.0 ++++++ v0.32.8.tar.gz -> v0.32.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/.github/workflows/ci.yml new/aws-crt-cpp-0.32.10/.github/workflows/ci.yml --- old/aws-crt-cpp-0.32.8/.github/workflows/ci.yml 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/.github/workflows/ci.yml 2025-06-24 17:26:14.000000000 +0200 @@ -225,7 +225,7 @@ ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build -p ${{ env.PACKAGE_NAME }} --cmake-extra=-DUSE_CPU_EXTENSIONS=OFF --cmake-extra=-DUSE_OPENSSL=ON windows: - runs-on: windows-2022 # latest + runs-on: windows-2025 # latest steps: - uses: aws-actions/configure-aws-credentials@v4 with: @@ -238,8 +238,8 @@ python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" python builder.pyz build -p ${{ env.PACKAGE_NAME }} - windows-vs14: - runs-on: windows-2019 # windows-2019 is last env with Visual Studio 2015 (v14.0) + windows-vc17: + runs-on: windows-2025 # latest strategy: matrix: arch: [x86, x64] @@ -253,10 +253,10 @@ md D:\a\work cd D:\a\work python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" - python builder.pyz build -p ${{ env.PACKAGE_NAME }} --compiler msvc-14 --target windows-${{ matrix.arch }} + python builder.pyz build -p ${{ env.PACKAGE_NAME }} --compiler msvc-17 --target windows-${{ matrix.arch }} windows-shared-libs: - runs-on: windows-2022 # latest + runs-on: windows-2025 # latest steps: - uses: aws-actions/configure-aws-credentials@v4 with: @@ -274,7 +274,7 @@ # This will cause linker errors in the tests if an API is built wrong (assuming the API is tested). # Usually the problem is extern global variables, and the fix is offering getter functions instead. windows-delayload-dll: - runs-on: windows-2022 # latest + runs-on: windows-2025 # latest env: LDFLAGS: /DELAYLOAD:aws-crt-cpp.dll steps: @@ -290,7 +290,7 @@ python builder.pyz build -p ${{ env.PACKAGE_NAME }} --cmake-extra=-DBUILD_SHARED_LIBS=ON windows-no-cpu-extensions: - runs-on: windows-2022 # latest + runs-on: windows-2025 # latest steps: - uses: aws-actions/configure-aws-credentials@v4 with: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/VERSION new/aws-crt-cpp-0.32.10/VERSION --- old/aws-crt-cpp-0.32.8/VERSION 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/VERSION 2025-06-24 17:26:14.000000000 +0200 @@ -1 +1 @@ -0.32.8 +0.32.10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/bin/mqtt5_canary/main.cpp new/aws-crt-cpp-0.32.10/bin/mqtt5_canary/main.cpp --- old/aws-crt-cpp-0.32.8/bin/mqtt5_canary/main.cpp 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/bin/mqtt5_canary/main.cpp 2025-06-24 17:26:14.000000000 +0200 @@ -589,7 +589,7 @@ ++g_statistic.totalOperations; ++g_statistic.publish_attempt; - if (testClient->client->Publish(packetPublish, [testClient](int errorcode, std::shared_ptr<PublishResult> packet) { + if (testClient->client->Publish(packetPublish, [testClient](int errorcode, std::shared_ptr<PublishResult> ) { if (errorcode != 0) { ++g_statistic.publish_failed; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/include/aws/iot/Mqtt5Client.h new/aws-crt-cpp-0.32.10/include/aws/iot/Mqtt5Client.h --- old/aws-crt-cpp-0.32.8/include/aws/iot/Mqtt5Client.h 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/include/aws/iot/Mqtt5Client.h 2025-06-24 17:26:14.000000000 +0200 @@ -131,10 +131,10 @@ * @param pkeyPath path to the private key (pem file) to use * @param allocator memory allocator to use * - * @return Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsFromPath( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithMtlsFromPath( + const Crt::String &hostName, const char *certPath, const char *pkeyPath, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; @@ -144,16 +144,16 @@ * format. * * @param hostName - AWS IoT endpoint to connect to - * @param certPath buffer containing the X509 certificate in a PEM format - * @param pkeyPath buffer containing the private key in a PEM format + * @param cert buffer containing the X509 certificate in a PEM format + * @param pkey buffer containing the private key in a PEM format * @param allocator memory allocator to use * - * @return Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsFromMemory( - const Crt::String hostName, - const Crt::ByteCursor &certPath, - const Crt::ByteCursor &pkeyPath, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithMtlsFromMemory( + const Crt::String &hostName, + const Crt::ByteCursor &cert, + const Crt::ByteCursor &pkey, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; /** @@ -165,10 +165,10 @@ * @param pkcs11Options PKCS#11 options * @param allocator memory allocator to use * - * @return Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsPkcs11( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithMtlsPkcs11( + const Crt::String &hostName, const Crt::Io::TlsContextPkcs11Options &pkcs11Options, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; @@ -181,10 +181,10 @@ * @param options The PKCS12 options to use. * @param allocator - memory allocator to use * - * @return Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsPkcs12( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithMtlsPkcs12( + const Crt::String &hostName, const struct Pkcs12Options &options, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; @@ -199,10 +199,10 @@ * Example: `CurrentUser\MY\A11F8A9B5DF5B98BA3508FBCA575D09570E0D2C6` * @param allocator memory allocator to use * - * @return Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithWindowsCertStorePath( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithWindowsCertStorePath( + const Crt::String &hostName, const char *windowsCertStorePath, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; @@ -213,10 +213,10 @@ * @param config websocket configuration information * @param allocator memory allocator to use * - * Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithWebsocket( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithWebsocket( + const Crt::String &hostName, const WebsocketConfig &config, Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; @@ -227,10 +227,10 @@ * @param customAuthConfig custom authorization configuration information * @param allocator memory allocator to use * - * Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithCustomAuthorizer( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithCustomAuthorizer( + const Crt::String &hostName, const Mqtt5CustomAuthConfig &customAuthConfig, Crt::Allocator *allocator) noexcept; @@ -242,10 +242,10 @@ * @param config websocket configuration information * @param allocator memory allocator to use * - * Mqtt5ClientBuilder + * @return std::shared_ptr of Mqtt5ClientBuilder. */ - static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( - const Crt::String hostName, + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + const Crt::String &hostName, const Mqtt5CustomAuthConfig &customAuthConfig, const WebsocketConfig &config, Crt::Allocator *allocator) noexcept; @@ -540,12 +540,85 @@ */ Mqtt5ClientBuilder &WithPublishReceivedCallback(OnPublishReceivedHandler callback) noexcept; + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsFromPath( + const Crt::String hostName, + const char *certPath, + const char *pkeyPath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromMemory instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsFromMemory( + const Crt::String hostName, + const Crt::ByteCursor &cert, + const Crt::ByteCursor &pkey, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs11 instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsPkcs11( + const Crt::String hostName, + const Crt::Io::TlsContextPkcs11Options &pkcs11Options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs12 instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithMtlsPkcs12( + const Crt::String hostName, + const struct Pkcs12Options &options, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWindowsCertStorePath instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithWindowsCertStorePath( + const Crt::String hostName, + const char *windowsCertStorePath, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithWebsocket( + const Crt::String hostName, + const WebsocketConfig &config, + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithCustomAuthorizer( + const Crt::String hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + Crt::Allocator *allocator) noexcept; + + /** + * @deprecated Use Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket instead. + */ + static Mqtt5ClientBuilder *NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + const Crt::String hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + const WebsocketConfig &config, + Crt::Allocator *allocator) noexcept; + private: // Common setup shared by all valid constructors Mqtt5ClientBuilder(Crt::Allocator *allocator) noexcept; // Common setup shared by all valid constructors Mqtt5ClientBuilder(int error, Crt::Allocator *allocator) noexcept; + /* + * Creates a new Mqtt5ClientBuilder instance with default values. + */ + static std::shared_ptr<Mqtt5ClientBuilder> CreateMqtt5ClientBuilder( + Crt::Allocator *allocator = Crt::ApiAllocator()) noexcept; + Crt::Allocator *m_allocator; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/source/iot/Mqtt5Client.cpp new/aws-crt-cpp-0.32.10/source/iot/Mqtt5Client.cpp --- old/aws-crt-cpp-0.32.8/source/iot/Mqtt5Client.cpp 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/source/iot/Mqtt5Client.cpp 2025-06-24 17:26:14.000000000 +0200 @@ -115,191 +115,193 @@ { } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilder( + Crt::Allocator *allocator) noexcept + { + auto *builder = + reinterpret_cast<Mqtt5ClientBuilder *>(aws_mem_acquire(allocator, sizeof(Mqtt5ClientBuilder))); + new (builder) Mqtt5ClientBuilder(allocator); + return std::shared_ptr<Mqtt5ClientBuilder>( + builder, [allocator](Mqtt5ClientBuilder *obj) { Crt::Delete(obj, allocator); }); + } + + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( + const Crt::String &hostName, const char *certPath, const char *pkeyPath, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtls(certPath, pkeyPath, allocator); - if (!result->m_tlsConnectionOptions.value()) + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - return result; + builder->WithHostName(hostName); + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromMemory( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromMemory( + const Crt::String &hostName, const Crt::ByteCursor &cert, const Crt::ByteCursor &pkey, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtls(cert, pkey, allocator); - if (!result->m_tlsConnectionOptions.value()) + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtls(cert, pkey, allocator); + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - return result; + builder->WithHostName(hostName); + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs11( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs11( + const Crt::String &hostName, const Crt::Io::TlsContextPkcs11Options &pkcs11Options, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtlsPkcs11(pkcs11Options, allocator); - if (!result->m_tlsConnectionOptions.value()) + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - return result; + builder->WithHostName(hostName); + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs12( - const Crt::String hostName, - const struct Pkcs12Options &options, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs12( + const Crt::String &hostName, + const Pkcs12Options &options, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtlsPkcs12( + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtlsPkcs12( options.pkcs12_file.c_str(), options.pkcs12_password.c_str(), allocator); - if (!result->m_tlsConnectionOptions.value()) + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - return result; + builder->WithHostName(hostName); + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWindowsCertStorePath( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWindowsCertStorePath( + const Crt::String &hostName, const char *windowsCertStorePath, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtlsSystemPath(windowsCertStorePath, allocator); - if (!result->m_tlsConnectionOptions.value()) + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - return result; + builder->WithHostName(hostName); + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( + const Crt::String &hostName, const WebsocketConfig &config, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); - if (!result->m_tlsConnectionOptions.value()) + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - result->m_websocketConfig = config; - return result; + builder->WithHostName(hostName); + builder->m_websocketConfig = config; + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer( + const Crt::String &hostName, const Mqtt5CustomAuthConfig &customAuthConfig, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); - if (!result->m_tlsConnectionOptions.value()) + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - result->WithCustomAuthorizer(customAuthConfig); - return result; + builder->WithHostName(hostName); + builder->WithCustomAuthorizer(customAuthConfig); + return builder; } - Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( - const Crt::String hostName, + std::shared_ptr<Mqtt5ClientBuilder> Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + const Crt::String &hostName, const Mqtt5CustomAuthConfig &customAuthConfig, const WebsocketConfig &config, Crt::Allocator *allocator) noexcept { - Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); - result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); - if (!result->m_tlsConnectionOptions.value()) + auto builder = CreateMqtt5ClientBuilder(allocator); + builder->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); + if (!builder->m_tlsConnectionOptions.value()) { - int error_code = result->m_tlsConnectionOptions->LastError(); + int error_code = builder->m_tlsConnectionOptions->LastError(); AWS_LOGF_ERROR( AWS_LS_MQTT5_GENERAL, "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", error_code, aws_error_debug_str(error_code)); - delete result; return nullptr; } - result->WithHostName(hostName); - result->m_websocketConfig = config; - result->WithCustomAuthorizer(customAuthConfig); - return result; + builder->WithHostName(hostName); + builder->m_websocketConfig = config; + builder->WithCustomAuthorizer(customAuthConfig); + return builder; } Mqtt5ClientBuilder &Mqtt5ClientBuilder::WithHostName(const Crt::String hostName) @@ -780,6 +782,193 @@ return *this; } + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + const Crt::String hostName, + const char *certPath, + const char *pkeyPath, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = + Crt::Io::TlsContextOptions::InitClientWithMtls(certPath, pkeyPath, allocator); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromMemory( + const Crt::String hostName, + const Crt::ByteCursor &cert, + const Crt::ByteCursor &pkey, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtls(cert, pkey, allocator); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs11( + const Crt::String hostName, + const Crt::Io::TlsContextPkcs11Options &pkcs11Options, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = + Crt::Io::TlsContextOptions::InitClientWithMtlsPkcs11(pkcs11Options, allocator); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs12( + const Crt::String hostName, + const struct Pkcs12Options &options, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitClientWithMtlsPkcs12( + options.pkcs12_file.c_str(), options.pkcs12_password.c_str(), allocator); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWindowsCertStorePath( + const Crt::String hostName, + const char *windowsCertStorePath, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = + Crt::Io::TlsContextOptions::InitClientWithMtlsSystemPath(windowsCertStorePath, allocator); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + const Crt::String hostName, + const WebsocketConfig &config, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + result->m_websocketConfig = config; + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer( + const Crt::String hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + result->WithCustomAuthorizer(customAuthConfig); + return result; + } + + Mqtt5ClientBuilder *Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + const Crt::String hostName, + const Mqtt5CustomAuthConfig &customAuthConfig, + const WebsocketConfig &config, + Crt::Allocator *allocator) noexcept + { + Mqtt5ClientBuilder *result = new Mqtt5ClientBuilder(allocator); + result->m_tlsConnectionOptions = Crt::Io::TlsContextOptions::InitDefaultClient(); + if (!result->m_tlsConnectionOptions.value()) + { + int error_code = result->m_tlsConnectionOptions->LastError(); + AWS_LOGF_ERROR( + AWS_LS_MQTT5_GENERAL, + "Mqtt5ClientBuilder: Failed to setup TLS connection options with error %d:%s", + error_code, + aws_error_debug_str(error_code)); + delete result; + return nullptr; + } + result->WithHostName(hostName); + result->m_websocketConfig = config; + result->WithCustomAuthorizer(customAuthConfig); + return result; + } + } // namespace Iot } // namespace Aws diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/tests/Mqtt5ClientCredentialsTest.cpp new/aws-crt-cpp-0.32.10/tests/Mqtt5ClientCredentialsTest.cpp --- old/aws-crt-cpp-0.32.8/tests/Mqtt5ClientCredentialsTest.cpp 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/tests/Mqtt5ClientCredentialsTest.cpp 2025-06-24 17:26:14.000000000 +0200 @@ -118,7 +118,7 @@ // Test Helper static void s_setupConnectionLifeCycle( - Aws::Iot::Mqtt5ClientBuilder *mqtt5Builder, + const std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> &mqtt5Builder, std::promise<bool> &connectionPromise, std::promise<void> &stoppedPromise, const char *clientName = "Client") @@ -181,7 +181,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( aws_string_c_str(endpoint), aws_string_c_str(cert), aws_string_c_str(key), allocator); ASSERT_TRUE(builder); @@ -195,7 +195,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(cert); aws_string_destroy(key); @@ -230,7 +229,7 @@ ASSERT_TRUE(provider); Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region), provider); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( aws_string_c_str(endpoint), websocketConfig, allocator); ASSERT_TRUE(builder); @@ -243,7 +242,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(region); return AWS_OP_SUCCESS; @@ -295,7 +293,7 @@ authConfig.WithTokenValue(aws_string_c_str(tokenValue)); authConfig.WithTokenSignature(aws_string_c_str(signature)); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer( aws_string_c_str(endpoint), authConfig, allocator); ASSERT_TRUE(builder); @@ -316,7 +314,6 @@ aws_string_destroy(tokenKeyName); aws_string_destroy(tokenValue); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(IoTMqtt5ConnectWithSigningCustomAuth, s_TestIoTMqtt5ConnectWithSigningCustomAuth) @@ -366,7 +363,7 @@ authConfig.WithTokenValue(aws_string_c_str(tokenValue)); authConfig.WithTokenSignature(aws_string_c_str(unencodedSignature)); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer( aws_string_c_str(endpoint), authConfig, allocator); ASSERT_TRUE(builder); @@ -387,7 +384,6 @@ aws_string_destroy(tokenKeyName); aws_string_destroy(tokenValue); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(IoTMqtt5ConnectWithSigningCustomAuthUnencoded, s_TestIoTMqtt5ConnectWithSigningCustomAuthUnencoded) @@ -423,7 +419,7 @@ authConfig.WithUsername(aws_string_c_str(username)); authConfig.WithPassword(ByteCursorFromString(aws_string_c_str(password))); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizer( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizer( aws_string_c_str(endpoint), authConfig, allocator); ASSERT_TRUE(builder); std::promise<bool> connectionPromise; @@ -440,7 +436,6 @@ aws_string_destroy(username); aws_string_destroy(password); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(IoTMqtt5ConnectWithNoSigningCustomAuth, s_TestIoTMqtt5ConnectWithNoSigningCustomAuth) @@ -481,9 +476,8 @@ Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region)); - Aws::Iot::Mqtt5ClientBuilder *builder = - Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( - aws_string_c_str(endpoint), authConfig, websocketConfig, allocator); + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + aws_string_c_str(endpoint), authConfig, websocketConfig, allocator); ASSERT_TRUE(builder); std::promise<bool> connectionPromise; std::promise<void> stoppedPromise; @@ -500,7 +494,6 @@ aws_string_destroy(username); aws_string_destroy(password); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(IoTMqtt5ConnectWithNoSigningCustomAuthWebsockets, s_TestIoTMqtt5ConnectWithNoSigningCustomAuthWebsockets) @@ -553,9 +546,8 @@ Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region)); - Aws::Iot::Mqtt5ClientBuilder *builder = - Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( - aws_string_c_str(endpoint), authConfig, websocketConfig, allocator); + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + aws_string_c_str(endpoint), authConfig, websocketConfig, allocator); ASSERT_TRUE(builder); std::promise<bool> connectionPromise; std::promise<void> stoppedPromise; @@ -575,7 +567,6 @@ aws_string_destroy(tokenValue); aws_string_destroy(signature); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(IoTMqtt5ConnectWithSigningCustomAuthWebsockets, s_TestIoTMqtt5ConnectWithSigningCustomAuthWebsockets) @@ -629,9 +620,8 @@ Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region)); - Aws::Iot::Mqtt5ClientBuilder *builder = - Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithCustomAuthorizerWebsocket( - aws_string_c_str(endpoint), authConfig, websocketConfig, allocator); + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithCustomAuthorizerWebsocket( + aws_string_c_str(endpoint), authConfig, websocketConfig, allocator); ASSERT_TRUE(builder); std::promise<bool> connectionPromise; std::promise<void> stoppedPromise; @@ -651,7 +641,6 @@ aws_string_destroy(tokenValue); aws_string_destroy(unencodedSignature); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE( @@ -710,7 +699,7 @@ pkcs11Options.SetTokenLabel(aws_string_c_str(pkcs11_tokenLabel)); pkcs11Options.SetPrivateKeyObjectLabel(aws_string_c_str(pkcs11_privateKeyLabel)); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs11( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs11( aws_string_c_str(endpoint), pkcs11Options, allocator); builder->WithPort(8883); @@ -727,7 +716,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(pkcs11_lib); aws_string_destroy(pkcs11_cert); @@ -778,7 +766,7 @@ testPkcs12Options.pkcs12_file = aws_string_c_str(pkcs12_key); testPkcs12Options.pkcs12_password = aws_string_c_str(pkcs12_password); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsPkcs12( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsPkcs12( aws_string_c_str(endpoint), testPkcs12Options, allocator); ASSERT_TRUE(builder); @@ -792,7 +780,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(pkcs12_key); aws_string_destroy(pkcs12_password); @@ -832,7 +819,7 @@ Aws::Crt::ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWindowsCertStorePath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWindowsCertStorePath( aws_string_c_str(endpoint), aws_string_c_str(windows_cert), allocator); ASSERT_TRUE(builder); @@ -846,7 +833,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(windows_cert); aws_string_destroy(codebuild_buildID); @@ -892,7 +878,7 @@ ASSERT_TRUE(provider); Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region), provider); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( aws_string_c_str(endpoint), websocketConfig, allocator); ASSERT_TRUE(builder); @@ -905,7 +891,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(region); aws_string_destroy(accessKeyId); @@ -952,7 +937,7 @@ ASSERT_TRUE(provider); Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region), provider); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( aws_string_c_str(endpoint), websocketConfig, allocator); ASSERT_TRUE(builder); @@ -965,7 +950,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(region); aws_string_destroy(cognitoEndpoint); @@ -1008,7 +992,7 @@ ASSERT_TRUE(provider); Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region), provider); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( aws_string_c_str(endpoint), websocketConfig, allocator); ASSERT_TRUE(builder); @@ -1021,7 +1005,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(region); aws_string_destroy(profileCredentials); @@ -1065,7 +1048,7 @@ ASSERT_TRUE(provider); Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region), provider); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( aws_string_c_str(endpoint), websocketConfig, allocator); ASSERT_TRUE(builder); @@ -1078,7 +1061,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(region); aws_string_destroy(accessKey); @@ -1155,7 +1137,7 @@ ASSERT_TRUE(provider); Aws::Iot::WebsocketConfig websocketConfig(aws_string_c_str(region), provider); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithWebsocket( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithWebsocket( aws_string_c_str(endpoint), websocketConfig, allocator); ASSERT_TRUE(builder); @@ -1168,7 +1150,6 @@ ASSERT_SUCCESS(s_CheckClientAndStop(mqtt5Client, &connectionPromise, &stoppedPromise)); - delete builder; aws_string_destroy(endpoint); aws_string_destroy(region); aws_string_destroy(x509Endpoint); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.32.8/tests/Mqtt5ClientTest.cpp new/aws-crt-cpp-0.32.10/tests/Mqtt5ClientTest.cpp --- old/aws-crt-cpp-0.32.8/tests/Mqtt5ClientTest.cpp 2025-05-30 02:07:25.000000000 +0200 +++ new/aws-crt-cpp-0.32.10/tests/Mqtt5ClientTest.cpp 2025-06-24 17:26:14.000000000 +0200 @@ -449,7 +449,7 @@ // Test Helper ////////////////////////////////////////////////////////// static void s_setupConnectionLifeCycle( - Aws::Iot::Mqtt5ClientBuilder *mqtt5Builder, + std::shared_ptr<Aws::Iot::Mqtt5ClientBuilder> &mqtt5Builder, std::promise<bool> &connectionPromise, std::promise<void> &stoppedPromise, const char *clientName = "Client") @@ -1994,12 +1994,11 @@ std::condition_variable receivedMessagesSignal; std::vector<int> receivedMessages; - Aws::Iot::Mqtt5ClientBuilder *subscribe_builder = - Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( - mqtt5TestVars.m_hostname_string, - mqtt5TestVars.m_certificate_path_string.c_str(), - mqtt5TestVars.m_private_key_path_string.c_str(), - allocator); + auto subscribe_builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( + mqtt5TestVars.m_hostname_string, + mqtt5TestVars.m_certificate_path_string.c_str(), + mqtt5TestVars.m_private_key_path_string.c_str(), + allocator); ASSERT_TRUE(subscribe_builder); auto on_message_callback1 = [&](const PublishReceivedEventData &eventData) @@ -2026,16 +2025,15 @@ subscribe_builder->WithPublishReceivedCallback(on_message_callback1); - Aws::Iot::Mqtt5ClientBuilder *subscribe_builder2 = - Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( - mqtt5TestVars.m_hostname_string, - mqtt5TestVars.m_certificate_path_string.c_str(), - mqtt5TestVars.m_private_key_path_string.c_str(), - allocator); + auto subscribe_builder2 = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( + mqtt5TestVars.m_hostname_string, + mqtt5TestVars.m_certificate_path_string.c_str(), + mqtt5TestVars.m_private_key_path_string.c_str(), + allocator); ASSERT_TRUE(subscribe_builder2); subscribe_builder2->WithPublishReceivedCallback(on_message_callback2); - Aws::Iot::Mqtt5ClientBuilder *publish_builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto publish_builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -2146,10 +2144,6 @@ stoppedPromise2.get_future().get(); stoppedPromise3.get_future().get(); - delete subscribe_builder; - delete subscribe_builder2; - delete publish_builder; - return AWS_OP_SUCCESS; } @@ -2565,7 +2559,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -2595,7 +2589,6 @@ ASSERT_TRUE(mqtt5Client->Stop()); stoppedPromise.get_future().get(); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(Mqtt5InterruptSub, s_TestMqtt5InterruptSub) @@ -2614,7 +2607,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -2645,7 +2638,6 @@ ASSERT_TRUE(mqtt5Client->Stop()); stoppedPromise.get_future().get(); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(Mqtt5InterruptUnsub, s_TestMqtt5InterruptUnsub) @@ -2664,7 +2656,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -2694,7 +2686,6 @@ ASSERT_TRUE(mqtt5Client->Stop()); stoppedPromise.get_future().get(); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(Mqtt5InterruptPublishQoS1, s_TestMqtt5InterruptPublishQoS1) @@ -3052,7 +3043,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -3066,7 +3057,6 @@ std::shared_ptr<Aws::Crt::Mqtt::MqttConnection> mqttConnection = Mqtt::MqttConnection::NewConnectionFromMqtt5Client(mqtt5Client); ASSERT_TRUE(mqttConnection); - delete builder; int connectResult = s_ConnectAndDisconnectThroughMqtt3(mqttConnection); ASSERT_SUCCESS(connectResult); @@ -3238,7 +3228,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -3264,7 +3254,6 @@ ASSERT_TRUE(mqtt5Client->Stop()); stoppedPromise.get_future().get(); - delete builder; return AWS_OP_SUCCESS; } AWS_TEST_CASE(Mqtt5to3AdapterWithIoTConnectionThroughMqtt5, s_TestMqtt5to3AdapterWithIoTConnectionThroughMqtt5) @@ -3317,7 +3306,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -3423,8 +3412,6 @@ ASSERT_TRUE(mqtt5Client->Stop()); stoppedPromise.get_future().get(); - delete builder; - ASSERT_TRUE(received == 1); return AWS_OP_SUCCESS; } @@ -3445,7 +3432,7 @@ ApiHandle apiHandle(allocator); - Aws::Iot::Mqtt5ClientBuilder *builder = Aws::Iot::Mqtt5ClientBuilder::NewMqtt5ClientBuilderWithMtlsFromPath( + auto builder = Aws::Iot::Mqtt5ClientBuilder::CreateMqtt5ClientBuilderWithMtlsFromPath( mqtt5TestVars.m_hostname_string, mqtt5TestVars.m_certificate_path_string.c_str(), mqtt5TestVars.m_private_key_path_string.c_str(), @@ -3466,8 +3453,6 @@ // Publish an offline message to create an incomplete publish operation mqttConnection->Publish(testTopic.c_str(), Mqtt::QOS::AWS_MQTT_QOS_AT_LEAST_ONCE, false, testPayload, NULL); - delete builder; - // If the incomplete operation callback was not called, there would be a memory leak as the callback data was not // released return AWS_OP_SUCCESS;