Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New xrefs data model #225

Merged
merged 33 commits into from
May 16, 2019
Merged

Commits on May 14, 2019

  1. Introduce generic vtref struct and use for xref.

    This introduces a struct for VT references.
    The nvti objects is extended to have a list of the vtref
    objects.
    Basically the new struct is handled similar to the prefs.
    
    Also, the xref element of nvti is removed and the API
    uses the new list of vtrefs to mimic the previous behaviour.
    Actually this is transitional until all modules will use
    the new generic references.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    ee27cb0 View commit details
    Browse the repository at this point in the history
  2. Handle BID also via new ref struct.

    Also improves the xref handling slightly.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    faec053 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f372e62 View commit details
    Browse the repository at this point in the history
  4. Add vtref protos to header file.

    This makes them availble to other modules.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    515ac3b View commit details
    Browse the repository at this point in the history
  5. Add nvti_add_refs_from_csv() to API for bulk refs

    This new method allows to add a bulk of comma-separated
    references to the NVTI. All references share the same
    type and (optional) text. A typical use case is to
    add bulk of CVEs.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    8bcb429 View commit details
    Browse the repository at this point in the history
  6. Don't consider NOBID, NOCVE and NOXREF anymore.

    These exception are from old OTP times and the keywords
    should not appear anymore.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    72bfb37 View commit details
    Browse the repository at this point in the history
  7. Call nvti_add_refs_from_csv for bid and cve.

    The code in nvti_add_bid and nvti_add_cve is meanwhile
    redundant with the code in nvti_add_refs_from_csv
    and thus these methods now simply call the latter.
    Eventually they can be eliminated once gvmd does not call
    them anymore.
    
    Also occured the need to const'ify vtref_new and
    nvti_add_refs_from_csv for doing so.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    23766ee View commit details
    Browse the repository at this point in the history
  8. Use nvti_add_refs_from_csv instead of nvti_set_cve.

    And use nvti_add_refs_from_csv instead of nvti_set_bid.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    374adff View commit details
    Browse the repository at this point in the history
  9. Remove now unused functions for bid and cve.

    This removes nvti_set_cve(), nvti_set_bid(),
    nvti_add_cve() and nvti_add_bid().
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    700cad7 View commit details
    Browse the repository at this point in the history
  10. New nvti_ref() replaces nvt_bid() and nvti_cve().

    One thing that needs to be considered when changing this
    in modules using this function is to free the returned string.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    eb48d0f View commit details
    Browse the repository at this point in the history
  11. Extend nvti_refs() to replace nvti_xref().

    This enables nvti_ref() to exclude types and to use
    either simple CVS or a CSV that includes the type
    of each reference.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    ade3307 View commit details
    Browse the repository at this point in the history
  12. Extend nvti_add_refs_from_csvs.

    This allows to remove nvti_set_xref.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    e834a1c View commit details
    Browse the repository at this point in the history
  13. Rename nvti_add_refs_from_csv to nvti_add_refs.

    This makes the naming consistent with other functions.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    ff3831b View commit details
    Browse the repository at this point in the history
  14. Fix memory management bug.

    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    2d4df60 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    46824a2 View commit details
    Browse the repository at this point in the history
  16. Change CSV syntax by adding a space.

    For compatibility reason the CSV is using
    ", " instead of just ",". This is the syntax
    used before and other tools using the redis-database
    directly rely on this syntax.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    17f4eaa View commit details
    Browse the repository at this point in the history
  17. Add vtref_*(), and nvti_ref*() functions.

    This add vref_type(), vtref_id(), nvt_ref() and
    nvt_ref_len() to the API.
    These functions allow to work with the actual reference
    object rather than with the serialized strings.
    The names are choosen to be consistent with the prefs
    handling.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    4ef1e3f View commit details
    Browse the repository at this point in the history
  18. Turn "while" into "for" loop.

    This reduces the number of code lines slightly for the
    g_strsplit loops.
    Also adding missing free's for the newly allocated split strings.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    8ea2c51 View commit details
    Browse the repository at this point in the history
  19. Move vtref struct out of public interface.

    Since the element of the struct should not be used by
    other than the internal functions, move the struct out of
    the header file into the module.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    9adc3cb View commit details
    Browse the repository at this point in the history
  20. Rename nvti_add_ref() to nvti_add_vtref().

    This renaming is for consistent naming scheme.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    d42fe16 View commit details
    Browse the repository at this point in the history
  21. Drop uncessary NULL checks.

    The function g_malloc0() already does the check.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    3cbc36c View commit details
    Browse the repository at this point in the history
  22. Unload doc-strings.

    Removed the "A copy will be created" notes from the doc-string where const
    is used anyway.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    6b75dde View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    05aecb0 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    2a45e7d View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    b765fab View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    20f0a3e View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    f26dbe9 View commit details
    Browse the repository at this point in the history
  28. Removed unneeded 0-check.

    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    911003b View commit details
    Browse the repository at this point in the history
  29. Do split only once per call.

    The split was done for every refrence for the very same string.
    Now it is done only once.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    fd356c5 View commit details
    Browse the repository at this point in the history
  30. Constify where return object should not be free'd.

    Also fix a confusion about renaming function nvti_add_vtref.
    janowagner committed May 14, 2019
    Configuration menu
    Copy the full SHA
    092430a View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    2b4b969 View commit details
    Browse the repository at this point in the history

Commits on May 15, 2019

  1. Removed unneeded assignment.

    It is already done in the for ().
    janowagner committed May 15, 2019
    Configuration menu
    Copy the full SHA
    91a2e83 View commit details
    Browse the repository at this point in the history
  2. Formatting fixes.

    janowagner committed May 15, 2019
    Configuration menu
    Copy the full SHA
    60af703 View commit details
    Browse the repository at this point in the history