<def-group>
  <definition class="compliance" id="{{{ rule_id }}}" version="1">
    {{{ oval_metadata("The DConf User and gdm profiles should have the correct DB configured.") }}}
    <criteria operator="OR">
      <extend_definition comment="dconf installed" definition_ref="package_dconf_installed" negate="true" />
      <criteria operator="AND">
        <criterion comment="dconf gdm profile exists" test_ref="test_dconf_gdm_profile" />
        <criterion comment="dconf user profile exists" test_ref="test_dconf_user_profile" />
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
      comment="dconf gdm profile exists and uses gdm.d database"
      id="test_dconf_gdm_profile" version="1">
    <ind:object object_ref="obj_dconf_gdm_profile" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="obj_dconf_gdm_profile" version="1">
    <ind:filepath>/etc/dconf/profile/gdm</ind:filepath>
    <ind:pattern operation="pattern match">(?ms)^\s*user-db:user\s*.*\n\s*system-db:gdm\s*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
      comment="dconf user profile exists and uses local.d database"
      id="test_dconf_user_profile" version="1">
    <ind:object object_ref="obj_dconf_user_profile" />
  </ind:textfilecontent54_test>

  <ind:textfilecontent54_object id="obj_dconf_user_profile" version="1">
    <ind:filepath>/etc/dconf/profile/user</ind:filepath>
    <ind:pattern operation="pattern match">(?ms)^\s*user-db:user\s*.*\n\s*system-db:local\s*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
