§
    šMdž  ã                   ó:   — d dl Z d dlZ d dlZd dlZd„ Zd„ Zdd„ZdS )é    Nc               #   ó8  K  — t          j        t           j                             d¦  «        ¦  «        } | j        }t           j        |_        |                      ¦   «          	  |¦   «         }|sn|                     d¦  «        V — Œ%|  	                    ¦   «          dS )z!List the shells from /etc/shells.ÚcTzutf-8N)
ÚctypesÚCDLLÚutilÚfind_libraryÚgetusershellÚc_char_pÚrestypeÚsetusershellÚdecodeÚendusershell)Úlibcr	   Úshells      ú /usr/share/nslcd-utils/shells.pyÚlist_shellsr      s›   è è € åŒ;•v”{×/Ò/°Ñ4Ô4Ñ5Ô5€DØÔ$€LÝ!œ?€LÔØ×ÒÑÔÐð$Ø�‘”ˆØð 	ØØ�lŠl˜7Ñ#Ô#Ð#Ð#Ð#ð	$ð
 	×ÒÑÔÐÐÐó    c                 ó~   — t           j                             | ¦  «        ot          j        | t           j        ¦  «        S )z5Check if the provided shell exists and is executable.)ÚosÚpathÚisfileÚaccessÚX_OK)r   s    r   Úshellexistsr   *   s)   € åŒ7�>Š>˜%Ñ Ô Ð>¥R¤Y¨uµb´gÑ%>Ô%>Ð>r   Fc                 ó¢  — | t          ¦   «         v rdS |s^| s#t          dt          j        d         z  ¦  «         n%t          t          j        d         ›d| ›d�¦  «         t          j        d¦  «         | s$t          dt          j        d         z  ¦  «         dS t          | ¦  «        s't          t          j        d         ›d| ›d	�¦  «         dS dS )
z;Check if the specified shell is valid and exit if it isn't.Nz%s: empty shell not allowedr   z: z is an invalid shellé   z %s: Warning: setting empty shellz: Warning: z does not exist)r   ÚprintÚsysÚargvÚexitr   )r   Úasroots     r   Úcheckr"   /   sã   € ð •‘”ÐÐØˆàð Øð 	GåÐ/µ#´(¸1´+Ñ=Ñ>Ô>Ð>Ð>õ µ#´(¸1´+°+°+¸u¸u¸uÐEÑFÔFÐFÝŒ�‰Œˆàð GåÐ0µ3´8¸A´;Ñ>Ñ?Ô?Ð?Ð?Ð?Ý˜ÑÔð GÝµ#´(¸1´+°+°+¸u¸u¸uÐEÑFÔFÐFÐFÐFðGð Gr   )F)r   Úctypes.utilr   r   r   r   r"   © r   r   ú<module>r%      sp   ðð, €€€Ø Ð Ð Ð Ø 	€	€	€	Ø 
€
€
€
ðð ð ð?ð ?ð ?ð
Gð Gð Gð Gð Gð Gr   