Next / Previous / Contents / TCC Help System / NM Tech homepage

25.5. ClientSet.__processLdapEntry(): Process one LDAP client record

This function examines one of the results returned from the LDAP search that describes a client machine. If the result describes an office machine, it is ignored. Otherwise an entry is added to the ldapMap whose key is the host name and whose value is the tccSpecialOS attribute.

hwscan3.py
# - - -   C l i e n t S e t . _ _ p r o c e s s L d a p E n t r y

    def __processLdapEntry ( self, ldapMap, attrMap ):
        '''Examine one client record.

          [ attrMap is a dictionary whose keys are LDAP
            attribute names from RESULT_LIST, and each
            corresponding value is a list of the values of
            that attribute ->
              if attrMap[OFFICE_ATTR][0] != LDAP_TRUE ->
                ldapMap  :=  ldapMap with an entry added
                    whose key is the CN_ATTR attribute from
                    attrMap and whose corresponding value is
                    the OS_ATTR value from attrMap,
                    defaulting to ''
              else -> I ]          
        '''

First we eliminate the office machines. See Section 6.17, “OFFICE_ATTR and Section 6.15, “LDAP_TRUE.

hwscan3.py
        #-- 1 --
        if attrMap[OFFICE_ATTR][0] == LDAP_TRUE:
            return

At this point, we know that the client is publicly accessible. Find its tccSpecialOS attribute, if it has one; the default value is the empty string. Finally, add an entry to ldapMap.

hwscan3.py
        #-- 2 --
        # [ if attrMap has an entry for key OS_ATTR ->
        #       os  :=  attrMap[OS_ATTR][0]
        #   else ->
        #       os  :=  '' ]
        try:
            os  =  attrMap[OS_ATTR][0]
        except KeyError:
            os  =  ''

        #-- 3 --
        # [ ldapMap  :=  ldapMap with a new entry whose key is
        #       attrMap[CN_ATTR][0] and whose values is os ]
        cn  =  attrMap[CN_ATTR][0]
        ldapMap[cn]  =  os