Ë
    ojµ  ã                   óÀ   — d Z ddlmZ  G d„ de«      Z G d„ de«      Z G d„ de«      Z G d	„ d
e«      Z G d„ d«      Z G d„ d«      Z	 G d„ de«      Z
 G d„ de«      Zy)z
Parser for inetd.conf files
é    )ÚOptionalc                   ó   — e Zd ZdZy)ÚInvalidConfErrorz$
    Invalid configuration file
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú:/usr/lib/python3/dist-packages/twisted/runner/inetdconf.pyr   r      ó   „ òr   r   c                   ó   — e Zd ZdZy)ÚInvalidInetdConfErrorz!
    Invalid inetd.conf file
    Nr   r   r   r   r   r      r   r   r   c                   ó   — e Zd ZdZy)ÚInvalidServicesConfErrorz
    Invalid services file
    Nr   r   r   r   r   r      r   r   r   c                   ó   — e Zd ZdZy)ÚUnknownServicez
    Unknown service name
    Nr   r   r   r   r   r      r   r   r   c                   ó>   — e Zd ZU dZdZdZee   ed<   dd„Z	d„ Z
d„ Zy)	ÚSimpleConfFilezÒ
    Simple configuration file parser superclass.

    Filters out comments and empty lines (which includes lines that only
    contain comments).

    To use this class, override parseLine or parseFields.
    ú#NÚdefaultFilenamec                 óh  — d}|€#| j                   rt        | j                   «      }d}	 |j                  «       D ]K  }|j                  | j                  «      }|dk7  r|d| }|j                  «       }|sŒ;| j                  |«       ŒM 	 |r|j                  «        yy# |r|j                  «        w w xY w)z—
        Parse a configuration file

        If file is None and self.defaultFilename is set, it will open
        defaultFilename and use it.
        FNTéÿÿÿÿ)r   ÚopenÚ	readlinesÚfindÚcommentCharÚstripÚ	parseLineÚclose)ÚselfÚfiler!   ÚlineÚcomments        r   Ú	parseFilezSimpleConfFile.parseFile2   s²   € ð ˆØˆ<˜D×0Ò0Ü˜×,Ñ,Ó-ˆDØˆEð	ØŸ™Ó(ò %�àŸ)™) D×$4Ñ$4Ó5�Ø˜b’=Ø  ˜>�Dð —z‘z“|�ñ Øà—‘˜tÕ$ñ%ñ Ø—
‘
•ð ø‰uØ—
‘
•ð ús   ©AB ÂB1c                 óˆ   — 	  | j                   |j                  «       Ž  y# t        $ r t        dt	        |«      z   «      ‚w xY w)z•
        Override this.

        By default, this will split the line on whitespace and call
        self.parseFields (catching any errors).
        zInvalid line: N)ÚparseFieldsÚsplitÚ
ValueErrorr   Úrepr)r"   r$   s     r   r    zSimpleConfFile.parseLineQ   sD   € ð	GØˆD×Ñ˜dŸj™j›lÒ+øÜò 	GÜ'Ð(8¼4À»:Ñ(EÓFÐFð	Gús	   ‚   !Ac                  ó   — y)z 
        Override this.
        Nr   )r"   Úfieldss     r   r(   zSimpleConfFile.parseFields]   s   � r   ©N)r   r   r	   r
   r   r   r   ÚstrÚ__annotations__r&   r    r(   r   r   r   r   r   %   s,   … ñð €KØ%)€O�X˜c‘]Ó)óò>
Gór   r   c                   ó:   — e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZd„ Zy)ÚInetdServicez3
    A simple description of an inetd service.
    Nc
                 ó‚   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y r.   )	ÚnameÚportÚ
socketTypeÚprotocolÚwaitÚuserÚgroupÚprogramÚprogramArgs)
r"   r4   r5   r6   r7   r8   r9   r:   r;   r<   s
             r   Ú__init__zInetdService.__init__r   sD   € ð ˆŒ	ØˆŒ	Ø$ˆŒØ ˆŒØˆŒ	ØˆŒ	ØˆŒ
ØˆŒØ&ˆÕr   )r   r   r	   r
   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r   r   r   r2   r2   c   s;   „ ñð €DØ€DØ€JØ€HØ€DØ€DØ€EØ€GØ€Kó'r   r2   c                   ó"   — e Zd ZdZdZdd„Zd„ Zy)Ú	InetdConfz>
    Configuration parser for a traditional UNIX inetd(8)
    z/etc/inetd.confNc                 óX   — g | _         |€t        «       }|j                  «        || _        y r.   )ÚservicesÚServicesConfr&   ÚknownServices)r"   rC   s     r   r=   zInetdConf.__init__‡   s*   € ØˆŒàÐ Ü(›NˆMØ×#Ñ#Ô%Ø*ˆÕr   c                 ób  — |j                  d«      dgz   dd \  }}| j                  j                  j                  ||fd«      }	|	s|j	                  d«      s	 t        |«      }	d}| j                  j                  t        ||	|||||||«	      «       y# t        $ r t        d|› d|› d�«      ‚w xY w)	zx
        Parse an inetd.conf file.

        Implemented from the description in the Debian inetd.conf man page.
        ú.Né   zrpc/ÚunknownzUnknown service: z (ú))
r)   rC   rA   ÚgetÚ
startswithÚintÚBaseExceptionr   Úappendr2   )
r"   ÚserviceNamer6   r7   r8   r9   r;   r<   r:   r5   s
             r   r(   zInetdConf.parseFields�   sÓ   € ð —z‘z #“¨$¨Ñ/°°!Ð4‰ˆˆeð ×!Ñ!×*Ñ*×.Ñ.°¸XÐ/FÈÓMˆÙ˜H×/Ñ/°Ô7ðUÜ˜;Ó'�Ø'�ð 	�‰×ÑÜØØØØØØØØØó
õ	
øô !ò UÜ$Ð'8¸¸ÀRÈÀzÐQRÐ%SÓTÐTðUús   ÁB ÂB.r.   ©r   r   r	   r
   r   r=   r(   r   r   r   r?   r?   €   s   „ ñð (€Oó+ó"
r   r?   c                   ó    — e Zd ZdZdZd„ Zd„ Zy)rB   zj
    /etc/services parser

    @ivar services: dict mapping service names to (port, protocol) tuples.
    z/etc/servicesc                 ó   — i | _         y r.   )rA   )r"   s    r   r=   zServicesConf.__init__½   s	   € Øˆ�r   c                 óÞ   — 	 |j                  d«      \  }}t        |«      }|| j
                  ||f<   |D ]  }|| j
                  ||f<   Œ y # t        $ r t        dt	        |«      › �«      ‚w xY w)Nú/zInvalid port/protocol: )r)   rK   rL   r   r+   rA   )r"   r4   ÚportAndProtocolÚaliasesr5   r7   Úaliass          r   r(   zServicesConf.parseFieldsÀ   s‰   € ð	Ø,×2Ñ2°3Ó7‰NˆD�(Ü�t“9ˆDð +/ˆ�‰�t˜XÐ&Ñ'Øò 	4ˆEØ/3ˆD�M‰M˜5 (Ð+Ò,ñ	4øô ò 	Ü*Ø)¬$¨Ó*?Ð)@ÐAóð ð	ús   ‚A Á!A,NrO   r   r   r   rB   rB   ´   s   „ ñð &€Oòó4r   rB   N)r
   Útypingr   Ú	Exceptionr   r   r   r   r   r2   r?   rB   r   r   r   ú<module>rY      so   ðñ
õ ô�yô ôÐ,ô ôÐ/ô ô�Yô ÷;ñ ;÷|'ñ 'ô:1
�ô 1
ôh4�>õ 4r   