Project

General

Profile

Actions

Bug #4136

closed

PibSqlite3::setDefaultIdentity does not create the identity if it doesn't exist

Added by Anonymous over 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Security
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

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 #1

Updated by Junxiao Shi over 7 years ago

  • Category set to Security
Actions #2

Updated by Davide Pesavento over 4 years ago

  • Tags set to security
Actions #3

Updated by Alex Afanasyev over 4 years ago

  • Status changed from New to In Progress
  • Assignee set to Alex Afanasyev
  • Start date deleted (06/15/2017)
Actions #4

Updated by Alex Afanasyev over 4 years ago

  • Status changed from In Progress to Code review
  • % Done changed from 0 to 100

Implementation behavior is actually doesn't matter. I pushed the patch that makes Pib implementations to throw an error, but I could switch to a simple assert: the creation of identities when they don't exist is handled by Pib abstraction, not individual realizations.

Actions #5

Updated by Davide Pesavento over 4 years ago

  • Target version set to 0.8.0
Actions #6

Updated by Davide Pesavento over 4 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF