??????????????????????
???  ?????????????????
 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


.....................................................................................................................................ó
ÊG`c           @   sa  d  Z  d d d d d d d d g Z d	 d
 l j Z d	 d
 l j j Z d	 d
 l Z d	 d
 l Z d	 d l m	 Z	 d	 d l
 m Z d	 d l m Z d	 d l m Z e j d k  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e j j f d „  ƒ  YZ d e j f d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z d
 S(   s5   Generic io_object handler, io specific check methods.t   PY2t	   IO_Objectt   IO_Object_ContentHandlert   IO_Object_XMLGeneratort
   check_portt   check_tcpudpt   check_protocolt   check_addressiÿÿÿÿN(   t	   functions(   t   b2u(   t   errors(   t   FirewallErrort   3c           B   st   e  Z d  Z d
 Z d Z g  Z i  Z i  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z d	 „  Z RS(   s;    Abstract IO_Object as base for icmptype, service and zone s   ()c         C   s1   d |  _  d |  _ d |  _ t |  _ t |  _ d  S(   Nt    (   t   filenamet   patht   namet   Falset   defaultt   builtin(   t   self(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   __init__1   s
    				c         C   sG   g  } x4 |  j  D]) } | j t j t |  | d ƒ ƒ ƒ q Wt | ƒ S(   Ni    (   t   IMPORT_EXPORT_STRUCTUREt   appendt   copyt   deepcopyt   getattrt   tuple(   R   t   rett   x(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   export_config8   s    'c         C   sÓ   |  j  | ƒ x¿ t |  j ƒ D]® \ } \ } } t | | t ƒ r® g  } t ƒ  } x; | | D]/ } | | k r\ | j | ƒ | j | ƒ q\ q\ W~ t |  | t	 j
 | ƒ ƒ q t |  | t	 j
 | | ƒ ƒ q Wd  S(   N(   t   check_configt	   enumerateR   t
   isinstancet   listt   setR   t   addt   setattrR   R   (   R   t   conft   it   elementt   dummyt   _conft   _setR   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   import_config>   s    "	c         C   s´   t  | t ƒ s= t t j d | t d ƒ t | ƒ f ƒ ‚ n  t | ƒ d k  rd t t j d ƒ ‚ n  xI | D]A } | j ƒ  rk | |  j	 k rk t t j d | | f ƒ ‚ qk qk Wd  S(   Ns   '%s' not of type %s, but %sR   i   s   name can't be emptys   '%s' is not allowed in '%s'(
   R!   t   strR   R
   t   INVALID_TYPEt   typet   lent   INVALID_NAMEt   isalnumt   ADDITIONAL_ALNUM_CHARS(   R   R   t   char(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
   check_nameN   s    	c         C   s›   t  | ƒ t  |  j ƒ k rI t t j d t  | ƒ t  |  j ƒ f ƒ ‚ n  xK t |  j ƒ D]: \ } \ } } |  j | | | ƒ |  j | | | ƒ qY Wd  S(   Ns    structure size mismatch %d != %d(   R0   R   R   R
   R.   R    t   _check_config_structuret   _check_config(   R   R&   R'   R(   t   value(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   [   s    ""c         C   s   d  S(   N(    (   R   t   dummy1t   dummy2(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR7   e   s    c   	      C   s  t  | ƒ t  | ƒ k sF t t j d | t  | ƒ t  | ƒ f ƒ ‚ n  t | t ƒ r¨ t | ƒ d k r€ t t j d | ƒ ‚ n  x|| D] } |  j | | d ƒ q‡ WnWt | t ƒ r(t | ƒ t | ƒ k rô t t j d | t | ƒ f ƒ ‚ n  xt	 | ƒ D]  \ } } |  j | | | ƒ qWn× t | t
 ƒ rÿt | j ƒ  ƒ d \ } } x© | j ƒ  D]˜ \ } } t  | ƒ t  | ƒ k r²t t j d | t  | ƒ t  | ƒ f ƒ ‚ n  t  | ƒ t  | ƒ k r`t t j d | t  | ƒ t  | ƒ f ƒ ‚ q`q`Wn  d  S(   Ns   '%s' not of type %s, but %si   s   len('%s') != 1i    s   len('%s') != %d(   R/   R   R
   R.   R!   R"   R0   R6   R   R    t   dictt   items(	   R   R&   t	   structureR   R'   R8   t   skeyt   svaluet   key(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR6   i   s8    	"			"	c         C   s,  | j  ƒ  } t } | |  j k r t } |  j | d  k	 r xP |  j | D]> } | | k rj | j | ƒ qH t t j d | | f ƒ ‚ qH Wq n  | |  j	 k rÜ t } x4 |  j	 | D]" } | | k r³ | j | ƒ q³ q³ Wn  | sû t t j d | ƒ ‚ n  x* | D]" } t t j d | | f ƒ ‚ qWd  S(   Ns   Missing attribute %s for %ss   Unexpected element %ss   %s: Unexpected attribute %s(
   t   getNamesR   t   PARSER_REQUIRED_ELEMENT_ATTRSt   Truet   Nonet   removeR   R
   t   PARSE_ERRORt   PARSER_OPTIONAL_ELEMENT_ATTRS(   R   R   t   attrst   _attrst   foundR   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   parser_check_element_attrsŠ   s,    		(    (   t   __name__t
   __module__t   __doc__R   t   DBUS_SIGNATURER3   RB   RG   R   R   R,   R5   R   R7   R6   RK   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   (   s   					
		!t   UnexpectedElementErrorc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s    t  t |  ƒ j ƒ  | |  _ d  S(   N(   t   superRP   R   R   (   R   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   ¨   s    c         C   s   d |  j  S(   Ns   Unexpected element '%s'(   R   (   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   __str__«   s    (   RL   RM   R   RR   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRP   §   s   	t   MissingAttributeErrorc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s)   t  t |  ƒ j ƒ  | |  _ | |  _ d  S(   N(   RQ   RS   R   R   t	   attribute(   R   R   RT   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   ¯   s    	c         C   s   d |  j  |  j f S(   Ns$   Element '%s': missing '%s' attribute(   R   RT   (   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRR   ³   s    (   RL   RM   R   RR   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRS   ®   s   	t   UnexpectedAttributeErrorc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s)   t  t |  ƒ j ƒ  | |  _ | |  _ d  S(   N(   RQ   RU   R   R   RT   (   R   R   RT   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   ¸   s    	c         C   s   d |  j  |  j f S(   Ns'   Element '%s': unexpected attribute '%s'(   R   RT   (   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRR   ¼   s    (   RL   RM   R   RR   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRU   ·   s   	c           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  d |  _ d  S(   NR   (   t   itemt   _element(   R   RV   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   Á   s    	c         C   s   d |  _  d  S(   NR   (   RW   (   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   startDocumentÅ   s    c         C   s   d |  _  d  S(   NR   (   RW   (   R   R   RH   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   startElementÈ   s    c         C   s@   | d k r |  j  |  j _ n | d k r< |  j  |  j _ n  d  S(   Nt   shortt   description(   RW   RV   RZ   R[   (   R   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
   endElementË   s    c         C   s   |  j  | j d d ƒ 7_  d  S(   Ns   
t    (   RW   t   replace(   R   t   content(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt
   charactersÑ   s    (   RL   RM   R   RX   RY   R\   R`   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   À   s
   				c           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   so   t  j j j |  ƒ | j |  _ | j |  _ i  g |  _ |  j d |  _	 g  |  _
 d |  _ t |  _ t |  _ d  S(   Niÿÿÿÿs   utf-8(   t   saxt   handlert   ContentHandlerR   t   writet   _writet   flusht   _flusht   _ns_contextst   _current_contextt   _undeclared_ns_mapst	   _encodingR   t   _pending_start_elementt   _short_empty_elements(   R   t   out(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   Õ   s    			c         C   s9   t  r d „  | j ƒ  Dƒ } n  t j j |  | | ƒ d S(   s   saxutils.XMLGenerator.startElement() expects name and attrs to be
            unicode and bad things happen if any of them is (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        c         S   s+   i  |  ]! \ } } t  | ƒ t  | ƒ “ q S(    (   R	   (   t   .0R   R8   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pys
   <dictcomp>í   s   	 N(   R    R<   t   saxutilst   XMLGeneratorRY   (   R   R   RH   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRY   æ   s    c         C   sÕ   t  rv |  j d t | ƒ ƒ xF | j ƒ  D]8 \ } } |  j d t | ƒ t j t | ƒ ƒ f ƒ q* W|  j d ƒ n[ |  j d | ƒ x: | j ƒ  D], \ } } |  j d | t j | ƒ f ƒ q” W|  j d ƒ d S(   s*    slightly modified startElement()
        u   <u    %s=%su   />t   <s    %s=%ss   />N(   R    Re   R	   R<   Rp   t	   quoteattr(   R   R   RH   R8   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   simpleElementð   s    $c         C   s   t  j j |  t | ƒ ƒ d S(   sú    saxutils.XMLGenerator.endElement() expects name to be
            unicode and bad things happen if it's (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        N(   Rp   Rq   R\   R	   (   R   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR\   ÿ   s    c         C   s   t  j j |  t | ƒ ƒ d S(   sý    saxutils.XMLGenerator.characters() expects content to be
            unicode and bad things happen if it's (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        N(   Rp   Rq   R`   R	   (   R   R_   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR`     s    c         C   s   t  j j |  t | ƒ ƒ d S(   s   saxutils.XMLGenerator.ignorableWhitespace() expects content to be
            unicode and bad things happen if it's (utf-8) encoded.
            We override the method here to sanitize this case.
            Can be removed once we drop Python2 support.
        N(   Rp   Rq   t   ignorableWhitespaceR	   (   R   R_   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyRu     s    (   RL   RM   R   RY   Rt   R\   R`   Ru   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   Ô   s   		
			c         C   sÁ   t  j |  ƒ } | d k r4 t t j d |  ƒ ‚ n‰ | d k rY t t j d |  ƒ ‚ nd | d  k r~ t t j d |  ƒ ‚ n? t | ƒ d k r½ | d | d k r½ t t j d |  ƒ ‚ n  d  S(	   Niþÿÿÿs   port number in '%s' is too bigiÿÿÿÿs   '%s' is invalid port ranges   port range '%s' is ambiguousi   i    i   (   R   t   getPortRangeR   R
   t   INVALID_PORTRD   R0   (   t   portt
   port_range(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR     s    			&	c         C   s)   |  d k r% t  t j d |  ƒ ‚ n  d  S(   Nt   tcpt   udpt   sctpt   dccps)   '%s' not from {'tcp'|'udp'|'sctp'|'dccp'}(   Rz   R{   R|   R}   (   R   R
   t   INVALID_PROTOCOL(   t   protocol(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   &  s    	c         C   s(   t  j |  ƒ s$ t t j |  ƒ ‚ n  d  S(   N(   R   t   checkProtocolR   R
   R~   (   R   (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   ,  s    c         C   s5   t  j |  | ƒ s1 t t j d | |  f ƒ ‚ n  d  S(   Ns   '%s' is not valid %s address(   R   R   R   R
   t   INVALID_ADDR(   t   ipvt   addr(    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyR   0  s    	(    RN   t   __all__t   xml.saxRa   t   xml.sax.saxutilsRp   R   t   syst   firewallR   t   firewall.functionsR	   R
   t   firewall.errorsR   t   versionR    t   objectR   t	   ExceptionRP   RS   RU   Rb   Rc   R   Rq   R   R   R   R   R   (    (    (    s>   /usr/lib/python2.7/site-packages/firewall/core/io/io_object.pyt   <module>   s,   			C			