Fix a bug in policy
diff --git a/src/contact-item.cpp b/src/contact-item.cpp
index 9ce1b66..60e9a93 100644
--- a/src/contact-item.cpp
+++ b/src/contact-item.cpp
@@ -37,7 +37,10 @@
m_name = string(nameBlob->buf(), nameBlob->size());
m_alias = alias.empty() ? m_name : alias;
Ptr<const Blob> institutionBlob = profileData->getProfile().getProfileEntry("institution");
- m_institution = string(institutionBlob->buf(), institutionBlob->size());
+ if(institutionBlob != NULL)
+ m_institution = string(institutionBlob->buf(), institutionBlob->size());
+ else
+ m_institution = string();
}
ContactItem::ContactItem(const ContactItem& contactItem)
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 2203ffe..13e4adb 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -72,11 +72,16 @@
policyManager->addVerificationPolicyRule(Ptr<IdentityPolicyRule>(new IdentityPolicyRule("^([^<KEY>]*)<KEY><dsk-.*><ID-CERT>",
"^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
"==", "\\1", "\\1\\2", true)));
+ policyManager->addVerificationPolicyRule(Ptr<IdentityPolicyRule>(new IdentityPolicyRule("^(<>*)$",
+ "^([^<KEY>]*)<KEY>(<>*)<ksk-.*><ID-CERT>$",
+ ">", "\\1", "\\1\\2", true)));
+
policyManager->addSigningPolicyRule(Ptr<IdentityPolicyRule>(new IdentityPolicyRule("^([^<DNS>]*)<DNS><PROFILE>",
"^([^<KEY>]*)<KEY>(<>*)<><ID-CERT>",
"==", "\\1", "\\1\\2", true)));
+
const string TrustAnchor("BIICqgOyEIWlKzDI2xX2hdq5Azheu9IVyewcV4uM7ylfh67Y8MIxF3tDCTx5JgEn\
HYMuCaYQm6XuaXTlVfDdWff/K7Xebq8IgGxjNBeU9eMf7Gy9iIMrRAOdBG0dBHmo\
67biGs8F+P1oh1FwKu/FN1AE9vh8HSOJ94PWmjO+6PvITFIXuI3QbcCz8rhvbsfb\
@@ -280,11 +285,17 @@
void
ContactManager::onKeyUnverified(Ptr<Data> data, const Name& identity)
-{ emit contactKeyFetchFailed (identity); }
+{
+ _LOG_DEBUG("Key cannot be verified!");
+ emit contactKeyFetchFailed (identity);
+}
void
ContactManager::onKeyTimeout(Ptr<Closure> closure, Ptr<Interest> interest, const Name& identity, int retry)
-{ emit contactKeyFetchFailed(identity); }
+{
+ _LOG_DEBUG("Key timeout!");
+ emit contactKeyFetchFailed(identity);
+}
void
ContactManager::onIdCertificateVerified(Ptr<Data> data, const Name& identity)