fix cr
Change-Id: I683943c014a8615711bd8a7b570acfe8d3b51a3e
diff --git a/src/challenge/challenge-credential.cpp b/src/challenge/challenge-credential.cpp
index a9ebe1c..cac5aa0 100644
--- a/src/challenge/challenge-credential.cpp
+++ b/src/challenge/challenge-credential.cpp
@@ -111,7 +111,7 @@
for (auto anchor : m_trustAnchors) {
if (anchor.getKeyName() == signingKeyName) {
if (security::verifySignature(credential, anchor) &&
- security::verifySignature(request.m_requestId.data(), request.m_requestId.size(), signature, signatureLen, key)) {
+ security::verifySignature(request.requestId.data(), request.requestId.size(), signature, signatureLen, key)) {
return returnWithSuccess(request);
}
}
diff --git a/src/challenge/challenge-email.cpp b/src/challenge/challenge-email.cpp
index 8b08d82..ba0a0e8 100644
--- a/src/challenge/challenge-email.cpp
+++ b/src/challenge/challenge-email.cpp
@@ -48,13 +48,13 @@
{
params.parse();
auto currentTime = time::system_clock::now();
- if (request.m_status == Status::BEFORE_CHALLENGE) {
+ if (request.status == Status::BEFORE_CHALLENGE) {
// for the first time, init the challenge
std::string emailAddress = readString(params.get(tlv::ParameterValue));
if (!isValidEmailAddress(emailAddress)) {
return returnWithNewChallengeStatus(request, INVALID_EMAIL, JsonSection(), m_maxAttemptTimes - 1, m_secretLifetime);
}
- auto lastComponentRequested = readString(request.m_cert.getIdentity().get(-1));
+ auto lastComponentRequested = readString(request.cert.getIdentity().get(-1));
if (lastComponentRequested != emailAddress) {
NDN_LOG_TRACE("Email and requested name do not match. Email " << emailAddress << "requested last component "
<< lastComponentRequested);
@@ -64,18 +64,18 @@
secretJson.add(PARAMETER_KEY_CODE, emailCode);
// send out the email
sendEmail(emailAddress, emailCode, request);
- NDN_LOG_TRACE("Secret for request " << toHex(request.m_requestId.data(), request.m_requestId.size()) << " : " << emailCode);
+ NDN_LOG_TRACE("Secret for request " << toHex(request.requestId.data(), request.requestId.size()) << " : " << emailCode);
return returnWithNewChallengeStatus(request, NEED_CODE, std::move(secretJson), m_maxAttemptTimes, m_secretLifetime);
}
- if (request.m_challengeState) {
- if (request.m_challengeState->m_challengeStatus == NEED_CODE ||
- request.m_challengeState->m_challengeStatus == WRONG_CODE) {
- NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.m_challengeState->m_challengeStatus);
+ if (request.challengeState) {
+ if (request.challengeState->challengeStatus == NEED_CODE ||
+ request.challengeState->challengeStatus == WRONG_CODE) {
+ NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.challengeState->challengeStatus);
// the incoming interest should bring the pin code
std::string givenCode = readString(params.get(tlv::ParameterValue));
- auto secret = request.m_challengeState->m_secrets;
+ auto secret = request.challengeState->secrets;
// check if run out of time
- if (currentTime - request.m_challengeState->m_timestamp >= m_secretLifetime) {
+ if (currentTime - request.challengeState->timestamp >= m_secretLifetime) {
return returnWithError(request, ErrorCode::OUT_OF_TIME, "Secret expired.");
}
// check if provided secret is correct
@@ -85,11 +85,11 @@
return returnWithSuccess(request);
}
// otherwise, check remaining attempt times
- if (request.m_challengeState->m_remainingTries > 1) {
- auto remainTime = m_secretLifetime - (currentTime - request.m_challengeState->m_timestamp);
+ if (request.challengeState->remainingTries > 1) {
+ auto remainTime = m_secretLifetime - (currentTime - request.challengeState->timestamp);
NDN_LOG_TRACE("Wrong secret code provided. Remaining Tries - 1.");
return returnWithNewChallengeStatus(request, WRONG_CODE, std::move(secret),
- request.m_challengeState->m_remainingTries - 1,
+ request.challengeState->remainingTries - 1,
time::duration_cast<time::seconds>(remainTime));
}
else {
@@ -164,8 +164,8 @@
{
std::string command = m_sendEmailScript;
command += " \"" + emailAddress + "\" \"" + secret + "\" \"" +
- request.m_caPrefix.toUri() + "\" \"" +
- request.m_cert.getName().toUri() + "\"";
+ request.caPrefix.toUri() + "\" \"" +
+ request.cert.getName().toUri() + "\"";
boost::process::child child(command);
child.wait();
if (child.exit_code() != 0) {
diff --git a/src/challenge/challenge-module.cpp b/src/challenge/challenge-module.cpp
index 8de88b6..708cbb6 100644
--- a/src/challenge/challenge-module.cpp
+++ b/src/challenge/challenge-module.cpp
@@ -75,9 +75,9 @@
std::tuple<ErrorCode, std::string>
ChallengeModule::returnWithError(ca::RequestState& request, ErrorCode errorCode, std::string&& errorInfo)
{
- request.m_status = Status::FAILURE;
- request.m_challengeType = "";
- request.m_challengeState = nullopt;
+ request.status = Status::FAILURE;
+ request.challengeType = "";
+ request.challengeState = nullopt;
return std::make_tuple(errorCode, std::move(errorInfo));
}
@@ -85,19 +85,19 @@
ChallengeModule::returnWithNewChallengeStatus(ca::RequestState& request, const std::string& challengeStatus,
JsonSection&& challengeSecret, size_t remainingTries, time::seconds remainingTime)
{
- request.m_status = Status::CHALLENGE;
- request.m_challengeType = CHALLENGE_TYPE;
- request.m_challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime,
- std::move(challengeSecret));
+ request.status = Status::CHALLENGE;
+ request.challengeType = CHALLENGE_TYPE;
+ request.challengeState = ca::ChallengeState(challengeStatus, time::system_clock::now(), remainingTries, remainingTime,
+ std::move(challengeSecret));
return std::make_tuple(ErrorCode::NO_ERROR, "");
}
std::tuple<ErrorCode, std::string>
ChallengeModule::returnWithSuccess(ca::RequestState& request)
{
- request.m_status = Status::PENDING;
- request.m_challengeType = CHALLENGE_TYPE;
- request.m_challengeState = nullopt;
+ request.status = Status::PENDING;
+ request.challengeType = CHALLENGE_TYPE;
+ request.challengeState = nullopt;
return std::make_tuple(ErrorCode::NO_ERROR, "");
}
diff --git a/src/challenge/challenge-pin.cpp b/src/challenge/challenge-pin.cpp
index 1ae6753..26e5317 100644
--- a/src/challenge/challenge-pin.cpp
+++ b/src/challenge/challenge-pin.cpp
@@ -42,23 +42,23 @@
{
params.parse();
auto currentTime = time::system_clock::now();
- if (request.m_status == Status::BEFORE_CHALLENGE) {
+ if (request.status == Status::BEFORE_CHALLENGE) {
NDN_LOG_TRACE("Challenge Interest arrives. Init the challenge");
// for the first time, init the challenge
std::string secretCode = generateSecretCode();
JsonSection secretJson;
secretJson.add(PARAMETER_KEY_CODE, secretCode);
- NDN_LOG_TRACE("Secret for request " << toHex(request.m_requestId.data(), request.m_requestId.size()) << " : " << secretCode);
+ NDN_LOG_TRACE("Secret for request " << toHex(request.requestId.data(), request.requestId.size()) << " : " << secretCode);
return returnWithNewChallengeStatus(request, NEED_CODE, std::move(secretJson), m_maxAttemptTimes, m_secretLifetime);
}
- if (request.m_challengeState) {
- if (request.m_challengeState->m_challengeStatus == NEED_CODE ||
- request.m_challengeState->m_challengeStatus == WRONG_CODE) {
- NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.m_challengeState->m_challengeStatus);
+ if (request.challengeState) {
+ if (request.challengeState->challengeStatus == NEED_CODE ||
+ request.challengeState->challengeStatus == WRONG_CODE) {
+ NDN_LOG_TRACE("Challenge Interest arrives. Challenge Status: " << request.challengeState->challengeStatus);
// the incoming interest should bring the pin code
std::string givenCode = readString(params.get(tlv::ParameterValue));
- auto secret = request.m_challengeState->m_secrets;
- if (currentTime - request.m_challengeState->m_timestamp >= m_secretLifetime) {
+ auto secret = request.challengeState->secrets;
+ if (currentTime - request.challengeState->timestamp >= m_secretLifetime) {
return returnWithError(request, ErrorCode::OUT_OF_TIME, "Secret expired.");
}
if (givenCode == secret.get<std::string>(PARAMETER_KEY_CODE)) {
@@ -66,11 +66,11 @@
return returnWithSuccess(request);
}
// check rest attempt times
- if (request.m_challengeState->m_remainingTries > 1) {
- auto remainTime = m_secretLifetime - (currentTime - request.m_challengeState->m_timestamp);
+ if (request.challengeState->remainingTries > 1) {
+ auto remainTime = m_secretLifetime - (currentTime - request.challengeState->timestamp);
NDN_LOG_TRACE("Wrong PIN code provided. Remaining Tries - 1.");
return returnWithNewChallengeStatus(request, WRONG_CODE, std::move(secret),
- request.m_challengeState->m_remainingTries - 1,
+ request.challengeState->remainingTries - 1,
time::duration_cast<time::seconds>(remainTime));
}
else {