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

Method Finit

src/twparser/parserhelper.cpp:133–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void cParserHelper::Finit(cGenreSpecListVector* pPolicy)
134{
135 //
136 // don't build spec list if just checking syntax
137 //
138 if (!pPolicy)
139 {
140 CleanUp();
141 return;
142 }
143
144 int nRulesInPolicy = 0;
145
146 GenreContainer::iterator i;
147 for (i = mAph.begin(); i != mAph.end(); ++i)
148 {
149 cGenreSpecListPair slp;
150 cGenre::Genre g = i->first;
151 cGenreParseInfo* pgpi = i->second;
152
153 //
154 // create the specs from rules
155 //
156 cParserUtil::CreateFCOSpecs(g, pgpi, slp.GetSpecList());
157 slp.SetGenre(g);
158
159 //
160 // get rule count for section
161 //
162 int nRulesInSection = slp.GetSpecList().Size();
163 if (0 == nRulesInSection)
164 {
165 TSTRING str = TSS_GetString(cTWParser, twparser::STR_ERR2_PARSER_NO_RULES_IN_SECTION);
166 str.append(cGenreSwitcher::GetInstance()->GenreToString(slp.GetGenre(), true));
167
168 eParserNoRulesInSection e(str);
169 e.SetFatality(false);
170 cParserHelper::GetErrorBucket()->AddError(e);
171 }
172
173 //
174 // increment rule count for policy file
175 //
176 nRulesInPolicy += slp.GetSpecList().Size();
177
178 //
179 // add to policy
180 //
181 pPolicy->push_back(slp);
182 }
183
184 CleanUp();
185
186 //
187 // check that we have some rules
188 //
189 if (0 == nRulesInPolicy)
190 throw eParserNoRules(_T(""), eParserHelper::NO_LINE);

Callers 15

WriteObjectToArchiveFunction · 0.45
ReadObjectFromArchiveFunction · 0.45
ReadConfigTextMethod · 0.45
CreateFCOMethod · 0.45
SetFCODataMethod · 0.45
TestMethod · 0.45
TestFCOSpecHelperFunction · 0.45
TestFCOSpecListFunction · 0.45
TestSerializerImplFunction · 0.45
TestSignatureBasicFunction · 0.45
TestChecksumFunction · 0.45
TestCRC32Function · 0.45

Calls 8

beginMethod · 0.80
endMethod · 0.80
SetGenreMethod · 0.80
GenreToStringMethod · 0.80
SetFatalityMethod · 0.80
SizeMethod · 0.45
GetGenreMethod · 0.45
AddErrorMethod · 0.45

Tested by 15

TestMethod · 0.36
TestFCOSpecHelperFunction · 0.36
TestFCOSpecListFunction · 0.36
TestSerializerImplFunction · 0.36
TestSignatureBasicFunction · 0.36
TestChecksumFunction · 0.36
TestCRC32Function · 0.36
TestMD5Function · 0.36
TestSHA1Function · 0.36
TestHAVALFunction · 0.36
TestSerRefCountObjFunction · 0.36
TestFCOName2Function · 0.36