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

wrong reported value for `policy` attribute in `users:` promise

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: 3.9.1
    • Fix Version/s: None
    • Component/s: Promise type: users
    • Labels:
      None

      Description

      Consider the following promise:

        users:
          !os_centos5::
            "root"
            uid => "0",
            password => hashed_password("$(pw)"),
            classes => if_repaired("root_password_changed");
      

      The promise should be considered incorrect as it lacks the `policy` attribute. However, both `cf-promises` and `cf-agent` happily accept it but the agent fails when trying to execute it::

         error: Unsupported user policy 'hash' in users promise
         error: Promise belongs to bundle 'rootpw' in file '...' near line 13
         error: No policy specified for 'users' promise 'root'
      

      There three issues with this IMHO:

      1. If the `policy` attribute is required, then the promise is incorrect and should be rejected as such by `cf-promises` and `cf-agent`. If `policy` has a default value, that value should be used and the above error has no reason to happen.

      2. The error message above is nonsensical: attribute `policy` is missing – does not have the value `hash`.

      3. The error message hints at a potential more serious bug: that CFEngine is reusing a string pointer that comes from elsewhere in the parse tree, or simply not initializing some variable. Depending on the actual code, this could lead to random crashes (or worse).

        Attachments

          Activity

            People

            Assignee:
            a10003 Eystein Maloy Stenberg
            Reporter:
            riccardomurri Riccardo Murri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: