Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3677

Implement a proper StringIsLocalhostIP() function

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: libutils
    • Labels:

      Description

      As part of https://github.com/cfengine/core/pull/4680 a naive implementation of StringIsLocalhostIP() function was introduced. It was only used as a helper recognition function in the code there so it didn't have to be bullet-proof. Nevertheless, a proper function with unit tests and also recognizing IPv6 localhost addresses would be better.

      Acceptance criteria:

      • a new StringIsLocalhostIP() function added to libntech/libutils
      • function properly checks if the given string is a localhost IP address or not
      • IPv6 localhost addresses are recognized
      • the function has an extensive unit test coverage for both valid and invalid strings
      • (optional) the function should only iterate over the string once (keep in mind that things like strlen() also iterate over the string)
      • the function is used in cf-execd/cf-execd-runagent.c instead of the naive implementation
      • manual checks are performed to see if it can be used somewhere else where we already do localhost IP address recognition/validation

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vpodzime Vratislav Podzimek
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel