'Return PamConfigEntries it finds as it recursively follows PAM configs.
Args:
service: A string containing the service name we are processing.
path: A string containing the file path name we want.
cache: A dictionary keyed on path, with the file contents (list of str).
filter_type: A string containing type name of the results we want.
Returns:
A tuple of a list of RDFValue PamConfigEntries found & a list of strings
which are the external config references found.'

def EnumerateConfig(self, service, path, cache, filter_type=None):

    result = []
    external = []
    path = self._FixPath(path)
    if (path not in cache):
        external.append('%s    ->    %s', self.OLD_PAMCONF_FILENAME, path)
        return (result, external)
    for tokens in self.ParseEntries(cache[path]):
        if (path == self.OLD_PAMCONF_FILENAME):
            try:
                service = tokens[0]
                tokens = tokens[1:]
            except IndexError:
                continue
        new_path = None
        filter_request = None
        try:
            if (tokens[0] == '@include'):
                new_path = tokens[1]
            elif (tokens[1] in ['include', 'substack']):
                new_path = tokens[2]
                filter_request = tokens[0]
        except IndexError:
            pass
        if new_path:
            new_path = self._FixPath(new_path)
            if (new_path not in cache):
                external.append(('%s    ->    %s' % (path, new_path)))
                continue
            (r, e) = self.EnumerateConfig(service, new_path, cache, filter_request)
            result.extend(r)
            external.extend(e)
        else:
            if (filter_type and (tokens[0] != filter_type)):
                continue
            match = self.PAMCONF_RE.match('    '.join(tokens))
            if match:
                (p_type, control, module_path, module_args) = match.group(1, 2, 3, 4)
                if p_type.startswith('-'):
                    p_type = p_type[1:]
                result.append(rdf_config_file.PamConfigEntry(service=service, type=p_type, control=control, module_path=module_path, module_args=module_args))
    return (result, external)
