This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new e67245a  Fix set manipulation in dual cert resolution (#6758)
e67245a is described below

commit e67245a34cc87c92315e493c4c4283c3d81fe065
Author: Susan Hinrichs <shinr...@yahoo-inc.com>
AuthorDate: Tue May 12 10:35:09 2020 -0500

    Fix set manipulation in dual cert resolution (#6758)
    
    Co-authored-by: Susan Hinrichs <shinr...@verizonmedia.com>
    (cherry picked from commit cc1376fff1bcbda7329d21c22e8cb8ecdaad3950)
---
 iocore/net/SSLUtils.cc | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 8c283e7..5dfcd69 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -1997,23 +1997,26 @@ 
SSLMultiCertConfigLoader::load_certs_and_cross_reference_names(std::vector<X509
       common_names = name_set;
     } else {
       // Check that all elements in common_names are in name_set
-      for (auto name : common_names) {
-        auto iter = name_set.find(name);
+      auto common_iter = common_names.begin();
+      while (common_iter != common_names.end()) {
+        auto iter = name_set.find(*common_iter);
         if (iter == name_set.end()) {
           // Common_name not in new set, move name to unique set
           auto iter = unique_names.find(cert_index - 1);
           if (iter == unique_names.end()) {
             std::set<std::string> new_set;
-            new_set.insert(name);
+            new_set.insert(*common_iter);
             unique_names.insert({cert_index - 1, new_set});
           } else {
-            iter->second.insert(name);
+            iter->second.insert(*common_iter);
           }
-          auto erase_iter = common_names.find(name);
+          auto erase_iter = common_iter;
+          ++common_iter;
           common_names.erase(erase_iter);
         } else {
           // New name already in common set, go ahead and remove it from 
further consideration
           name_set.erase(iter);
+          ++common_iter;
         }
       }
       // Anything still in name_set was not in common_names

Reply via email to