<def-group>
  <definition class="compliance" id="{{{ rule_id }}}" version="1">
    {{{ oval_metadata("Although the useradd program will not let you create a duplicate User ID (UID), it is possible for an administrator to manually edit the /etc/passwd file and change the UID field.") }}}
    <criteria>
      <criterion test_ref="tst_no_duplicate_uids_exist" comment="no duplicate UIDs exist" />
    </criteria>
  </definition>
  <ind:textfilecontent54_object id="obj_uids_in_etc_passwd" version="1">
    <ind:filepath datatype="string">/etc/passwd</ind:filepath>
    <ind:pattern operation="pattern match" datatype="string">^.*?:[^:]*:([^:]*):.*$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:variable_object id="obj_num_duplicate_uids" version="1">
    <ind:var_ref>var_num_duplicate_uids_in_etc_passwd</ind:var_ref>
  </ind:variable_object>
  <ind:variable_state id="ste_no_duplicate_uids" version="1">
    <ind:value datatype="int" operation="equals">0</ind:value>
  </ind:variable_state>
  <ind:variable_test check="all" id="tst_no_duplicate_uids_exist" version="1" comment="no duplicate UIDs exist">
    <ind:object object_ref="obj_num_duplicate_uids" />
    <ind:state state_ref="ste_no_duplicate_uids" />
  </ind:variable_test>
  <local_variable datatype="int" id="var_uids_in_etc_passwd" version="1" comment="all UIDs in /etc/passwd">
    <object_component item_field="subexpression" object_ref="obj_uids_in_etc_passwd" />
  </local_variable>
  <local_variable datatype="int" id="var_num_unique_uids_in_etc_passwd" version="1" comment="number of unique UIDs in /etc/passwd">
    <count>
      <unique>
        <variable_component var_ref="var_uids_in_etc_passwd" />
      </unique>
    </count>
  </local_variable>
  <local_variable datatype="int" id="var_num_total_uids_in_etc_passwd" version="1" comment="total number of UIDs in /etc/passwd">
    <count>
        <variable_component var_ref="var_uids_in_etc_passwd" />
    </count>
  </local_variable>
  <local_variable datatype="int" id="var_num_duplicate_uids_in_etc_passwd" version="1" comment="number of duplicate UIDs">
    <arithmetic arithmetic_operation="add">
      <arithmetic arithmetic_operation="multiply">
        <literal_component datatype="int">-1</literal_component>
        <variable_component var_ref="var_num_unique_uids_in_etc_passwd" />
      </arithmetic>
      <variable_component var_ref="var_num_total_uids_in_etc_passwd" />
    </arithmetic>
  </local_variable>
</def-group>
