security: fix bugs in keylocator checker of validator config

refs: #4339
Change-Id: Icfd7314e5c6d244f558c6a7362c547d4fe1ce80c
diff --git a/src/security/v2/validator-config/checker.cpp b/src/security/v2/validator-config/checker.cpp
index 47415af..fdff8d2 100644
--- a/src/security/v2/validator-config/checker.cpp
+++ b/src/security/v2/validator-config/checker.cpp
@@ -80,13 +80,11 @@
 bool
 RegexChecker::checkNames(const Name& pktName, const Name& klName, const shared_ptr<ValidationState>& state)
 {
-  // pktName not used in this check
-  Name identity = extractIdentityFromKeyName(klName);
-  bool result = m_regex.match(identity);
+  bool result = m_regex.match(klName);
   if (!result) {
     std::ostringstream os;
     os << "KeyLocator check failed: regex " << m_regex << " for packet " << pktName << " is invalid"
-       << " (KeyLocator=" << klName << ", identity=" << identity << ")";
+       << " (KeyLocator=" << klName << ")";
     state->fail({ValidationError::POLICY_ERROR, os.str()});
   }