mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix parsing of node public keys in manifest CLI:
The existing code attempts to validate the provided node public key using a function that assumes that the encoded public key is for an account. This causes the parsing to fail. This commit fixes #3317 by letting the caller specify the type of the public key being checked.
This commit is contained in:
@@ -1915,6 +1915,7 @@ NetworkOPsImp::pubManifest(Manifest const& mo)
|
|||||||
jvObj[jss::master_signature] = strHex(mo.getMasterSignature());
|
jvObj[jss::master_signature] = strHex(mo.getMasterSignature());
|
||||||
if (!mo.domain.empty())
|
if (!mo.domain.empty())
|
||||||
jvObj[jss::domain] = mo.domain;
|
jvObj[jss::domain] = mo.domain;
|
||||||
|
jvObj[jss::manifest] = strHex(mo.serialized);
|
||||||
|
|
||||||
for (auto i = mStreamMaps[sManifests].begin();
|
for (auto i = mStreamMaps[sManifests].begin();
|
||||||
i != mStreamMaps[sManifests].end();)
|
i != mStreamMaps[sManifests].end();)
|
||||||
|
|||||||
@@ -151,9 +151,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
validPublicKey(std::string const& strPk)
|
validPublicKey(
|
||||||
|
std::string const& strPk,
|
||||||
|
TokenType type = TokenType::AccountPublic)
|
||||||
{
|
{
|
||||||
if (parseBase58<PublicKey>(TokenType::AccountPublic, strPk))
|
if (parseBase58<PublicKey>(type, strPk))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto pkHex = strUnHex(strPk);
|
auto pkHex = strUnHex(strPk);
|
||||||
@@ -235,7 +237,7 @@ private:
|
|||||||
Json::Value jvRequest(Json::objectValue);
|
Json::Value jvRequest(Json::objectValue);
|
||||||
|
|
||||||
std::string const strPk = jvParams[0u].asString();
|
std::string const strPk = jvParams[0u].asString();
|
||||||
if (!validPublicKey(strPk))
|
if (!validPublicKey(strPk, TokenType::NodePublic))
|
||||||
return rpcError(rpcPUBLIC_MALFORMED);
|
return rpcError(rpcPUBLIC_MALFORMED);
|
||||||
|
|
||||||
jvRequest[jss::public_key] = strPk;
|
jvRequest[jss::public_key] = strPk;
|
||||||
|
|||||||
Reference in New Issue
Block a user