74 Commits
Author SHA1 Message Date
Ikey Doherty 9535e88bd3 Reformat the entire codebase with clang-format-3.8
This is now a hard requirement for current pull requests
to ensure we don't walk back into this messy codebase
situation again.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2017-02-16 09:49:59 +00:00
Ikey Doherty 0b9c0b3f18 Add cve_string_strip utility function
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-11 21:17:47 +00:00
Ikey Doherty 10dcdee894 Add cve_string_has_{pre,suff}ix functions
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-11 19:36:56 +00:00
Ikey Doherty 160734d65e Fix up hashmap, make rpm plugin use this now
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-11 19:04:06 +00:00
Ikey Doherty 174bb08f54 Remove entirely unused load_cve_mapping function
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-11 18:41:20 +00:00
Ikey Doherty f1c1c2f844 tests: Ensure we compile again
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-11 18:25:46 +00:00
Sergey Popovich fedfc86343 template: Use and return cve_string where possible
Make template_context_process_line() and template_string()
return cve_string instead of standard C string.

These changes are prepare for upcoming changes to the
HTML output plugin where we need to access report string
length to figure out if report was truncated.

Probably other users will benefit from this change in
the future too.

Among other changes, introduced with this patch, minor
improvements to the cve_string handling is added to
template_context_process_line(), where we avoid string
unnecessary string duplication where possible and save
few CPU cycles on string copy. Check for @original string
parameter being non-NULL (in template_conext_process_line()
with cve_string_dup() and in template_string() with explicit
check).

Also fixes potential memory leak in JIRA plugin where we
resulting string from template_string() not freed.

Signed-off-by: Sergey Popovich <popovich_sergei@mail.ua>
2016-01-11 14:15:29 +00:00
Ikey Doherty 1b018efdc2 Add Hashmap implementation (issue #21)
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-08 17:28:08 +00:00
Ikey Doherty 2a809956eb Get test suites working again with recent changes
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2016-01-08 14:58:38 +00:00
Ikey Doherty 2735456c2e Fix function duplication
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-10-14 16:16:24 +01:00
Ikey Doherty 9d77b3bc63 Forgot this
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-09-12 11:43:17 +01:00
Ikey Doherty 420bcb2b4b rpm: nopatch case must be handled in rpm.spec, to match srpm behaviour
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-09-09 16:05:53 +01:00
Ikey Doherty ddaf9322cc Add editor modelines
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-08-12 15:20:05 +01:00
Ikey Doherty a9d366adb7 Resolve linking issues - ensuring cve-check-tool works with full RELRO
This is currently the temporary path we'll use, as and when the packaging
implementations switch to plugins, we can drop the current callback mechanism,
abstract util.*, and query supported package types and then determine the
plugin we'll use for the lifetime of this operation.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-08-07 15:54:13 +01:00
Ikey Doherty 168388d3ca Restore: Make clang happy
Turns out this was a ccache issue. Alternative implementation to this is
is forcing clang diagnostics via a pragma but that seems nasty, besides this
is still within C99 compliance, though it'd be nice if clang would choose the
members itself vs being told one to start with.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-07-25 16:23:01 +01:00
Ikey Doherty 70dc6733ff Revert "Make clang happy"
This reverts commit 3b57d46503.
It would seem this causes some clang versions to explode quite violently.
And in truth, parts of this change should not be necessary (the struct
zero initialisation)
2015-07-22 20:14:14 +01:00
Ikey Doherty 3b57d46503 Make clang happy
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-07-22 20:12:00 +01:00
Ikey Doherty 58728e99d5 rpm: Ensure nopatch is also case sensitive
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-07-16 16:38:29 +01:00
Ikey Doherty c771f78511 Fix broken pkgbuild
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-29 10:31:43 +01:00
Ikey Doherty fe9d49cdc2 Ensure we only recurse when we need to
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-09 17:59:51 +01:00
Ikey Doherty fa795573c7 tests: Fix leak in check-packaging
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-03 21:03:55 +01:00
Ikey Doherty c650df1430 Plug DIR leak and resolve root namespace conflicts
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-03 20:58:59 +01:00
Ikey Doherty 4093c4f426 library: Fix some template leaking on false booleans
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-03 20:18:19 +01:00
Ikey Doherty 4ebf7bbe27 tests: Incorporate dummy data
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-03 05:21:15 +01:00
Ikey Doherty 241123115f Begin migration to dedicated SQL database
This is the beginning of a large refactor to greatly improve performance
and flexibility of cve-check-tool. Core functionality is still unaltered right
now, as this change simply introduces the new initial core. This core uses
a named database to store all NVD data for later retrieval.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-06-03 05:19:30 +01:00
Ikey Doherty dd70aa62e8 tests: Slightly enhance bool check
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-05-07 16:10:04 +01:00
Ikey Doherty 673b6b9a70 tests: Add bool test for TemplateContext
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-05-07 16:05:53 +01:00
Ikey Doherty ab617bcfb6 tests: Add list check for TemplateContext
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-05-07 16:02:09 +01:00
Ikey Doherty 5764f5e729 template: Move to explicit types, for now this is just bool and string
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-30 14:37:19 +01:00
Ikey Doherty 6dc11a4aed template: Move to block-based render passes for sections
We now build a complete unexpanded section at a time whilst iterating the
document structure. As we exit each subsection, we push our block into the
parent render block. This leads to a bottom up render approach for emitting
sections, skipping non-emitters. In future this can be expanded upon by
enabling iterative conditional sections, as a full section block is available
to render as many times as required into the parent context.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-30 12:17:17 +01:00
John L. Whiteman 71866dc00c Removed hashtable functions to simplify things
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-29 13:28:22 -07:00
Ikey Doherty cb7553c4aa Revert "Make clang a bit happier"
Clang may remain somewhat depressed. Sane C syntax is preferable anyway
This reverts commit 015b496573.
2015-04-29 16:00:49 +01:00
Ikey Doherty 015b496573 Make clang a bit happier
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-29 14:42:41 +01:00
Ikey Doherty 20a7a47af1 template: Large overhaul for efficency and usage (Context)
We now swap the old code out for a new lighter "TemplateContext", which
currently now supports conditional renders via Mustache-style sections.

In the future this will be revisted further to add iteration supports,
but for now stack-traversing child contexts are supported, with a boolean
1-renderpass section support.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-29 12:59:43 +01:00
Ikey Doherty 2993bf5d17 rpm: Ensure all patches are actually applied by default
This resolves issue #6 - but would require further testing

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-27 21:13:19 +01:00
John L. Whiteman 009c95842d jira: Add more tests
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-16 16:51:43 -07:00
John L. Whiteman 0de1f972ab jira: Fix NULL check segmentation bug
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-16 13:35:04 -07:00
Ikey Doherty 4490985e30 Increase coverage via CVE ignore checks
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-16 19:12:22 +01:00
Ikey Doherty f2f774a57f Cheaply raise coverage in util
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-16 17:22:29 +01:00
John L. Whiteman c2df4a659b Added more JIRA plugin tests
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-15 17:24:34 -07:00
John L. Whiteman be1007de8e Added more dummy data files for JIRA plugin tests
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-15 13:42:34 -07:00
Ikey Doherty 3063c4c173 tests: Increase coverage through non-existent files
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-15 19:15:13 +01:00
Ikey Doherty 0044f4a467 Add initial PKGBUILD support for Arch Linux
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-15 19:09:51 +01:00
Ikey Doherty fa1c210c5d Increase coverage with is_package_list test
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-15 18:16:43 +01:00
Ikey Doherty f789f78868 tests: Only run srpm tests in presence of "rpm" binary
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-15 18:05:40 +01:00
John L. Whiteman 9c95366036 Moved dummy data for plugins into own directories
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-15 10:00:39 -07:00
John L. Whiteman ed77471a13 Added dummy json test issues json file
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
2015-04-10 12:31:13 -07:00
Ikey Doherty fb67c9c9c1 tests: Add further srpm testing
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-10 17:37:46 +01:00
Ikey Doherty 285f30db0a tests: Ensure RPM .spec count is 2 (we now carry 2.)
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-04-10 17:27:00 +01:00
Ikey Doherty e1cd4618f4 Merge pull request #2 from fenrus75/master
Pull request to increase test suite coverage
2015-04-10 17:13:15 +01:00