??????????????????????
???  ?????????????????
 JFIF      ?? C      


!"$"$?? C    
?? p 
" ??     
         ??             ?   
   ????

(%	aA*?XYD?(J??E  RE,P XYae?)(E  2 B  R  	BQ    X?)X     ?  @  

adadasdasdasasdasdas


.....................................................................................................................................??????????????????????
???  
 JFIF      ?? C      


!"$"$?? C    
?? p 
" ??     
         ??             ?   
   ????

(%	aA*?XYD?(J??E  RE,P XYae?)(E  2 B  R  	BQ    X?)X     ?  @  

adadasdasdasasdasdas


.....................................................................................................................................ó
+½{Wc           @   sÊ   d  Z  d d l Z d d l Z d d l m Z m Z d d l Z d d l m Z d d l	 m
 Z
 m Z m Z m Z d d l m Z d e f d	 „  ƒ  YZ d
 „  Z e d e f d „  ƒ  Yƒ Z d g Z d S(   s>   ZAP Authenticator in a Python Thread.

.. versionadded:: 14.1
iÿÿÿÿN(   t   Threadt   Event(   t   jsonapi(   t   bytest   unicodet   bt   ui   (   t   Authenticatort   AuthenticationThreadc           B   s;   e  Z d  Z d d d d „ Z d „  Z d „  Z d „  Z RS(   sm   A Thread for running a zmq Authenticator
    
    This is run in the background by ThreadedAuthenticator
    s   utf-8c      	   C   s²   t  t |  ƒ j ƒ  | p% t j j ƒ  |  _ | |  _ | pF t j	 d ƒ |  _
 } t ƒ  |  _ | pw t | d | d | ƒ|  _ | j t j ƒ |  _ d |  j _ |  j j | ƒ d  S(   Ns   zmq.autht   encodingt   logi   (   t   superR   t   __init__t   zmqt   Contextt   instancet   contextR	   t   loggingt	   getLoggerR
   R   t   startedR   t   authenticatort   sockett   PAIRt   pipet   lingert   connect(   t   selfR   t   endpointR	   R
   R   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR      s    	!c         C   s  |  j  j ƒ  |  j j ƒ  |  j  j } t j ƒ  } | j |  j t j	 ƒ | j | t j	 ƒ x¢ t
 rÿ y t | j ƒ  ƒ } Wn t j k
 r‘ Pn X|  j | k rÐ | |  j t j	 k rÐ |  j ƒ  } | rÐ PqÐ n  | | k r^ | | t j	 k r^ |  j ƒ  q^ q^ W|  j j ƒ  |  j  j ƒ  d S(   s*   Start the Authentication Agent thread taskN(   R   t   startR   t   sett
   zap_socketR   t   Pollert   registerR   t   POLLINt   Truet   dictt   pollt   ZMQErrort   _handle_pipet   _handle_zapt   closet   stop(   R   t   zapt   pollert   sockst	   terminate(    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt   run&   s&    	%c         C   s0   |  j  j j ƒ  } | s d S|  j  j | ƒ d S(   s7   
        Handle a message from the ZAP socket.
        N(   R   R   t   recv_multipartt   handle_zap_message(   R   t   msg(    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR'   ?   s     c   
      C   s÷  t  } |  j j ƒ  } | d k r+ t } | S| d } |  j j d | ƒ | d k r½ g  | d D] } t | |  j ƒ ^ q_ } y |  j	 j
 | Œ  Wqót k
 r¹ } |  j j d | ƒ qóXn6| d k r2g  | d D] } t | |  j ƒ ^ qÔ } y |  j	 j | Œ  Wqót k
 r.} |  j j d | ƒ qóXnÁ | d k r}t | d |  j ƒ } | d	 } |  j	 j | t j | ƒ ƒ nv | d
 k rËt | d |  j ƒ } t | d	 |  j ƒ }	 |  j	 j | |	 ƒ n( | d k ràt } n |  j j d | ƒ | S(   s6   
        Handle a message from front-end API.
        i    s   auth received API command %rt   ALLOWi   s   Failed to allow %st   DENYs   Failed to deny %st   PLAINi   t   CURVEt	   TERMINATEs!   Invalid auth command from API: %rN(   t   FalseR   R/   t   NoneR"   R
   t   debugR   R	   R   t   allowt	   Exceptiont	   exceptiont   denyt   configure_plainR   t   loadst   configure_curvet   error(
   R   R-   R1   t   commandt   mt	   addressest   et   domaint   json_passwordst   location(    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR&   G   s>    
))
	N(   t   __name__t
   __module__t   __doc__R8   R   R.   R'   R&   (    (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR      s
   		c         C   sc   x\ |  j  j ƒ  D]K \ } } | j d ƒ r1 q n  t t | d ƒ } | j s | j | _ q q W|  S(   sA   inherit docstrings from Authenticator, so we don't duplicate themt   _N(   t   __dict__t   itemst
   startswitht   getattrR   R8   RK   (   t   clst   namet   methodt   upstream_method(    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt   _inherit_docstrings{   s    	t   ThreadAuthenticatorc           B   st   e  Z d  Z d d d d „ Z d „  Z d „  Z d d d „ Z d d d „ Z d	 „  Z	 d
 „  Z
 d „  Z d „  Z RS(   s-   Run ZAP authentication in a background threads   utf-8c         C   sX   | p t  j j ƒ  |  _ | |  _ | |  _ d  |  _ d j t	 |  ƒ ƒ |  _
 d  |  _ d  S(   Ns   inproc://{0}.inproc(   R   R   R   R   R
   R	   R8   R   t   formatt   idt   pipe_endpointt   thread(   R   R   R	   R
   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR   ‰   s    			c         G   s:   |  j  j d g g  | D] } t | |  j ƒ ^ q ƒ d  S(   NR2   (   R   t   send_multipartR   R	   (   R   RD   t   a(    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR:   ‘   s    c         G   s:   |  j  j d g g  | D] } t | |  j ƒ ^ q ƒ d  S(   NR3   (   R   R[   R   R	   (   R   RD   R\   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR=   ”   s    t   *c         C   s8   |  j  j d t | |  j ƒ t j | p* i  ƒ g ƒ d  S(   NR4   (   R   R[   R   R	   R   t   dumps(   R   RF   t	   passwords(    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR>   —   s    t    c         C   sA   t  | |  j ƒ } t  | |  j ƒ } |  j j d | | g ƒ d  S(   NR5   (   R   R	   R   R[   (   R   RF   RH   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR@   š   s    c         C   s™   |  j  j t j ƒ |  _ d |  j _ |  j j |  j ƒ t |  j  |  j d |  j	 d |  j
 ƒ|  _ |  j j ƒ  |  j j j d d ƒ s• t d ƒ ‚ n  d S(   s   Start the authentication threadi   R	   R
   t   timeouti
   s$   Authenticator thread failed to startN(   R   R   R   R   R   R   t   bindRY   R   R	   R
   RZ   R   R   t   waitt   RuntimeError(   R   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR   Ÿ   s    *c         C   s[   |  j  rW |  j  j d ƒ |  j ƒ  r5 |  j j ƒ  n  d |  _ |  j  j ƒ  d |  _  n  d S(   s   Stop the authentication threadR6   N(   R   t   sendt   is_aliveRZ   t   joinR8   R(   (   R   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyR)   ª   s    		c         C   s    |  j  r |  j  j ƒ  r t St S(   s$   Is the ZAP thread currently running?(   RZ   Rf   R"   R7   (   R   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyRf   ´   s    c         C   s   |  j  ƒ  d  S(   N(   R)   (   R   (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt   __del__º   s    N(   RI   RJ   RK   R8   R   R:   R=   R>   R@   R   R)   Rf   Rh   (    (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyRV   …   s   				
	(   RK   t   timeR   t	   threadingR    R   R   t	   zmq.utilsR   t   zmq.utils.strtypesR   R   R   R   t   baseR   R   RU   t   objectRV   t   __all__(    (    (    s5   /usr/lib64/python2.7/site-packages/zmq/auth/thread.pyt   <module>   s   "h	
7