MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / ReadPolicyText

Method ReadPolicyText

src/tw/twutil.cpp:709–726  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// ReadPolicyText Read the policy file. Read the text of a policy language into configText Will throw eError on failure. //////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

707// Will throw eError on failure.
708///////////////////////////////////////////////////////////////////////////////
709void cTWUtil::ReadPolicyText(const TCHAR* filename, std::string& polText, const cElGamalSigPublicKey* pPublicKey)
710{
711 cSerializableNString nstring;
712
713 cFileUtil::TestFileExists(filename);
714
715 bool bEncrypted;
716 ReadObject(filename, NULL, nstring, cPolicyFile::GetFileHeaderID(), pPublicKey, bEncrypted);
717
718 // check 8 byte header
719 if (nstring.mString.compare(0, 8 * sizeof(byte), POLICY_FILE_MAGIC_8BYTE) != 0)
720 ThrowAndAssert(eSerializerInputStreamFmt(_T(""), filename, eSerializer::TY_FILE));
721
722 // remove 8 byte header
723 nstring.mString.assign(nstring.mString.substr(8));
724
725 polText = nstring.mString;
726}
727
728
729///////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 3

ReadObjectFunction · 0.85
assignMethod · 0.80
compareMethod · 0.45

Tested by

no test coverage detected