@@ -58,31 +58,6 @@ using Transport::SecureSession;
58
58
namespace {
59
59
Global<GroupPeerTable> gGroupPeerTable ;
60
60
61
- // / RAII class for iterators that guarantees that Release() will be called
62
- // / on the underlying type
63
- template <typename Releasable>
64
- class AutoRelease
65
- {
66
- public:
67
- AutoRelease (Releasable * iter) : mIter (iter) {}
68
- ~AutoRelease () { Release (); }
69
-
70
- Releasable * operator ->() { return mIter ; }
71
- const Releasable * operator ->() const { return mIter ; }
72
-
73
- bool IsNull () const { return mIter == nullptr ; }
74
-
75
- void Release ()
76
- {
77
- VerifyOrReturn (mIter != nullptr );
78
- mIter ->Release ();
79
- mIter = nullptr ;
80
- }
81
-
82
- private:
83
- Releasable * mIter = nullptr ;
84
- };
85
-
86
61
// Helper function that strips off the interface ID from a peer address that is
87
62
// not an IPv6 link-local address. For any other address type we should rely on
88
63
// the device's routing table to route messages sent. Forcing messages down a
@@ -908,11 +883,8 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & partialPack
908
883
909
884
// Trial decryption with GroupDataProvider
910
885
Credentials::GroupDataProvider::GroupSession groupContext;
911
-
912
- AutoRelease<Credentials::GroupDataProvider::GroupSessionIterator> iter (
913
- groups->IterateGroupSessions (partialPacketHeader.GetSessionId ()));
914
-
915
- if (iter.IsNull ())
886
+ auto iter = groups->IterateGroupSessions (partialPacketHeader.GetSessionId ());
887
+ if (iter == nullptr )
916
888
{
917
889
ChipLogError (Inet, " Failed to retrieve Groups iterator. Discarding everything" );
918
890
return ;
@@ -959,7 +931,7 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & partialPack
959
931
}
960
932
#endif // CHIP_CONFIG_PRIVACY_ACCEPT_NONSPEC_SVE2
961
933
}
962
- iter. Release ();
934
+ iter-> Release ();
963
935
964
936
if (!decrypted)
965
937
{
@@ -997,6 +969,7 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & partialPack
997
969
gGroupPeerTable ->FindOrAddPeer (groupContext.fabric_index , packetHeaderCopy.GetSourceNodeId ().Value (),
998
970
packetHeaderCopy.IsSecureSessionControlMsg (), counter))
999
971
{
972
+
1000
973
if (Credentials::GroupDataProvider::SecurityPolicy::kTrustFirst == groupContext.security_policy )
1001
974
{
1002
975
err = counter->VerifyOrTrustFirstGroup (packetHeaderCopy.GetMessageCounter ());
0 commit comments