Actions
Bug #4136
closedPibSqlite3::setDefaultIdentity does not create the identity if it doesn't exist
Start date:
Due date:
% Done:
100%
Estimated time:
Tags:
Description
The documentation for setDefaultIdentity says "If identityName identity does not exist, it will be created":
https://github.com/named-data/ndn-cxx/blob/cbe72b07ace4020355f5d1df700ee671440998c9/src/security/pib/pib-impl.hpp#L124
But PibSqlite3::setDefaultIdentity does not do this:
https://github.com/named-data/ndn-cxx/blob/fe4733a1608712e389fe10b329a9fd61575ad075/src/security/pib/pib-sqlite3.cpp#L330
Suggestion: At the beginning of setDefaultIdentity, add the following lines from PibSqlite3::addIdentity:
https://github.com/named-data/ndn-cxx/blob/fe4733a1608712e389fe10b329a9fd61575ad075/src/security/pib/pib-sqlite3.cpp#L289
if (!hasIdentity(identity)) {
Sqlite3Statement statement(m_database, "INSERT INTO identities (identity) values (?)");
statement.bind(1, identity.wireEncode(), SQLITE_TRANSIENT);
statement.step();
}
Actions