HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/sssd/__pycache__/source_files.cpython-36.pyc
3

Yd�i	�@s8ddlZddlZddlmZej�ZGdd�de�ZdS)�N)�ReadercsBeZdZdZ�fdd�Zdd�Zdd�Zd
d	d
�Zdd�Z�Z	S)�Filesz�
    A class used to represent a Log Files Reader

    Args:
        path -- the path where SSSD logs are to
           be read (default /var/log/sssd/)
    cs*t�j�g|_|j|�|_|j�|_dS)N)�super�__init__�	log_files�resolve_path�path�get_domain_logfiles�domains)�selfr)�	__class__��"/usr/lib/python3.6/source_files.pyrs
zFiles.__init__ccszxt|jD]j}y,t|��}x|D]
}|VqWWdQRXWqtk
rp}ztjd�tj|�wWYdd}~XqXqWdS)zH
        Yields:
            str: The next line in the log file
        Nz(Could not find domain log file, skipping)r�open�FileNotFoundError�loggerZwarning)r�files�file�line�errr
r
r�__iter__s



zFiles.__iter__cCs|jd�r|S|dSdS)N�/)�endswith)rrr
r
rr's
zFiles.resolve_pathFc	srg}ddddddddd	g	}|r0tj|jd
�}ntj|jd�}x,|D]$�t�fdd
�|D��sF|j��qFW|S)z> Retrieve list of SSSD log files, exclude rotated (.gz) files ZifpZnssZpamZsudoZautofsZsshZpacZkcmz.gzz*.logzsssd_*c3s|]}|�kVqdS)Nr
)�.0�s)rr
r�	<genexpr>7sz,Files.get_domain_logfiles.<locals>.<genexpr>)�globr�any�append)r�childZdomain_filesZexclude_listZ	file_listr
)rrr	-s

zFiles.get_domain_logfilescCs�g|_||jjkr&|jj|jd�nX||jjkrF|jj|jd�n8||jjkr~|j|�}|sdt�x|D]}|jj|�qjWdS)zb
        Switch the reader to interact with a certain SSSD component
        NSS, PAM, BE
        zsssd_nss.logzsssd_pam.logN)	rZ	ComponentZNSSrrZPAMZBEr	�IOError)rZ	componentrr
Zdomr
r
r�
set_component<s

zFiles.set_component)F)
�__name__�
__module__�__qualname__�__doc__rrrr	r!�
__classcell__r
r
)rrr	s
r)rZloggingZsssd.source_readerrZ	getLoggerrrr
r
r
r�<module>s