<def-group><definition class="compliance" id="service_portreserve_disabled" version="1">
    <metadata>
        <title>Disable Portreserve (portreserve)</title>
            <affected family="unix">
                <platform>multi_platform_all</platform>
            </affected>
        <description>The portreserve service should be disabled.</description>
    </metadata>
    <criteria comment="package portreserve removed or service portreserve is not configured to start" operator="OR">
      <criterion comment="portreserve removed" test_ref="service_portreserve_disabled_test_service_portreserve_package_portreserve_removed" />
      
  
      <criteria operator="OR" comment="service is not present or not configured">
        <criteria operator="AND" comment="service portreserve is not configured to start">
          <criterion test_ref="test_service_not_running_service_portreserve_disabled_portreserve"
            comment="portreserve is not running"/>
          <criterion test_ref="test_service_loadstate_is_masked_service_portreserve_disabled_portreserve"
            comment="Property LoadState of service portreserve is masked"/>
        </criteria>
        <criterion test_ref="test_service_not_found_service_portreserve_disabled_portreserve"
          comment="portreserve is not found"/>
      </criteria>

    </criteria>
  </definition>
  
  
      <linux:systemdunitproperty_test id="test_service_not_running_service_portreserve_disabled_portreserve"
        check="all" check_existence="any_exist"
        comment="Test that the portreserve service is not running" version="1">
        <linux:object object_ref="obj_service_not_running_service_portreserve_disabled_portreserve"/>
        <linux:state state_ref="state_service_not_running_service_portreserve_disabled_portreserve"/>
      </linux:systemdunitproperty_test>

    <linux:systemdunitproperty_object id="obj_service_not_running_service_portreserve_disabled_portreserve"
      comment="Retrieve the ActiveState property of portreserve" version="1">
      <linux:unit operation="pattern match">^portreserve\.(service|socket)$</linux:unit>
      <linux:property>ActiveState</linux:property>
    </linux:systemdunitproperty_object>

    <linux:systemdunitproperty_state id="state_service_not_running_service_portreserve_disabled_portreserve"
      version="1" comment="portreserve is not running">
      <linux:value operation="pattern match">inactive|failed</linux:value>
    </linux:systemdunitproperty_state>

    <linux:systemdunitproperty_test check="all" check_existence="any_exist"
      id="test_service_loadstate_is_masked_service_portreserve_disabled_portreserve"
      comment="Test that the property LoadState from the service portreserve is masked"
      version="1">
      <linux:object object_ref="obj_service_loadstate_is_masked_service_portreserve_disabled_portreserve"/>
      <linux:state state_ref="state_service_loadstate_is_masked_service_portreserve_disabled_portreserve"/>
    </linux:systemdunitproperty_test>

    <linux:systemdunitproperty_object  comment="Retrieve the LoadState property of portreserve"
      version="1" id="obj_service_loadstate_is_masked_service_portreserve_disabled_portreserve">
      <linux:unit operation="pattern match">^portreserve\.(service|socket)$</linux:unit>
      <linux:property>LoadState</linux:property>
    </linux:systemdunitproperty_object>

    <linux:systemdunitproperty_state comment="LoadState is set to masked"
      id="state_service_loadstate_is_masked_service_portreserve_disabled_portreserve"
      version="1">
      <linux:value>masked</linux:value>
    </linux:systemdunitproperty_state>


    <linux:systemdunitproperty_test check="all" check_existence="any_exist"
      id="test_service_not_found_service_portreserve_disabled_portreserve"
      comment="Test that the service portreserve is not found"
      version="1">
      <linux:object object_ref="obj_service_loadstate_is_masked_service_portreserve_disabled_portreserve"/>
      <linux:state state_ref="state_service_is_not_found_service_portreserve_disabled_portreserve"/>
    </linux:systemdunitproperty_test>

    <linux:systemdunitproperty_state comment="Service is not found"
      id="state_service_is_not_found_service_portreserve_disabled_portreserve"
      version="1">
      <linux:value>not-found</linux:value>
    </linux:systemdunitproperty_state>

  
  <linux:dpkginfo_test check="all" check_existence="none_exist"
  id="service_portreserve_disabled_test_service_portreserve_package_portreserve_removed" version="1"
  comment="package portreserve is removed">
    <linux:object object_ref="obj_service_portreserve_disabled_test_service_portreserve_package_portreserve_removed" />
  </linux:dpkginfo_test>
  <linux:dpkginfo_object id="obj_service_portreserve_disabled_test_service_portreserve_package_portreserve_removed" version="1">
    <linux:name>portreserve</linux:name>
  </linux:dpkginfo_object>


</def-group>