ó
â„^c           @   s–  d  d l  Z  d  d l Z d Z d Z d Z d Z d Z d Z d d	 d
 d d d g Z i e d 6e d	 6e d
 6e d 6e d 6e d 6Z	 d do d „  ƒ  YZ
 d e
 f d „  ƒ  YZ d e
 f d „  ƒ  YZ e e d d „ Z d d „ Z dp d „ Z d „  Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d  e f d! „  ƒ  YZ d" e f d# „  ƒ  YZ d$ e f d% „  ƒ  YZ d& e f d' „  ƒ  YZ d( e f d) „  ƒ  YZ d* e f d+ „  ƒ  YZ d, e f d- „  ƒ  YZ d. e f d/ „  ƒ  YZ d0 e f d1 „  ƒ  YZ  d2 e f d3 „  ƒ  YZ! d4 e f d5 „  ƒ  YZ" d6 e f d7 „  ƒ  YZ# d8 e f d9 „  ƒ  YZ$ d: e f d; „  ƒ  YZ% d< e f d= „  ƒ  YZ& d> e f d? „  ƒ  YZ' d@ e f dA „  ƒ  YZ( dB e f dC „  ƒ  YZ) dD e f dE „  ƒ  YZ* dF e f dG „  ƒ  YZ+ dH e f dI „  ƒ  YZ, dJ e f dK „  ƒ  YZ- dL e f dM „  ƒ  YZ. dN e f dO „  ƒ  YZ/ dP e f dQ „  ƒ  YZ0 dR e f dS „  ƒ  YZ1 dT „  Z2 dU e f dV „  ƒ  YZ3 dW e f dX „  ƒ  YZ4 dY e f dZ „  ƒ  YZ5 d[ e f d\ „  ƒ  YZ6 d] e f d^ „  ƒ  YZ7 d_ e f d` „  ƒ  YZ8 da e f db „  ƒ  YZ9 dc e f dd „  ƒ  YZ: de e f df „  ƒ  YZ; dg e f dh „  ƒ  YZ< di dq dj „  ƒ  YZ= dk dr dl „  ƒ  YZ> dm ds dn „  ƒ  YZ? d S(t   iÿÿÿÿNi    i   i   i   i   i   t   sourcet   targett   objectt
   permissiont   rolet   destinationt
   PolicyBasec           B   s   e  Z d d  „ Z RS(   c         C   s   d  |  _ d  |  _ d  S(   N(   t   Nonet   parentt   comment(   t   selfR   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __init__5   s    	N(   t   __name__t
   __module__R   R   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   4   s   t   Nodec           B   sÎ   e  Z d  Z d d „ 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 d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sÁ  Base class objects produced from parsing the reference policy.

    The Node class is used as the base class for any non-leaf
    object produced by parsing the reference policy. This object
    should contain a reference to its parent (or None for a top-level
    object) and 0 or more children.

    The general idea here is to have a very simple tree structure. Children
    are not separated out by type. Instead the tree structure represents
    fairly closely the real structure of the policy statements.

    The object should be iterable - by default over all children but
    subclasses are free to provide additional iterators over a subset
    of their childre (see Interface for example).
    c         C   s   t  j |  | ƒ g  |  _ d  S(   N(   R   R   t   children(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   J   s    c         C   s   t  |  j ƒ S(   N(   t   iterR   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __iter__N   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   t
   isinstanceR   (   t   x(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   <lambda>W   s    (   t   filtert   walktree(   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   nodesV   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   Module(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   Z   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   modulesY   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t	   Interface(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ]   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt
   interfaces\   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   Template(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   `   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt	   templates_   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   SupportMacros(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   c   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   support_macrosb   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   ModuleDeclaration(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   h   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   module_declarationsg   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   InterfaceCall(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   k   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   interface_callsj   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   AVRule(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   n   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   avrulesm   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   TypeRule(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   q   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt	   typerulesp   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t	   TypeBound(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   t   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt
   typeboundss   s    c         C   s   t  d „  t |  ƒ ƒ S(   sA   Iterate over all of the TypeAttribute children of this Interface.c         S   s   t  |  t ƒ S(   N(   R   t   TypeAttribute(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   x   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   typeattributesv   s    c         C   s   t  d „  t |  ƒ ƒ S(   sA   Iterate over all of the RoleAttribute children of this Interface.c         S   s   t  |  t ƒ S(   N(   R   t   RoleAttribute(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   |   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   roleattributesz   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   Require(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR      s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   requires~   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   Role(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ‚   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   roles   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t	   RoleAllow(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   …   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   role_allows„   s    c         C   s   t  d „  t |  ƒ ƒ S(   Nc         S   s   t  |  t ƒ S(   N(   R   t   RoleType(   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ˆ   s    (   R   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt
   role_types‡   s    c         C   s2   |  j  r$ t |  j  ƒ d |  j ƒ  S|  j ƒ  Sd  S(   Ns   
(   R	   t   strt	   to_string(   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __str__Š   s    	c         C   s   d |  j  j |  j ƒ  f S(   Ns   <%s(%s)>(   t	   __class__R   R7   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __repr__   s    c         C   s   d S(   Nt    (    (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   “   s    N(   R   R   t   __doc__R   R   R   R   R   R   R   R   R!   R#   R%   R'   R)   R+   R-   R/   R1   R3   R5   R8   R:   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   9   s,   																			t   Leafc           B   s/   e  Z d d  „ Z d „  Z d „  Z d „  Z RS(   c         C   s   t  j |  | ƒ d  S(   N(   R   R   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ˜   s    c         C   s2   |  j  r$ t |  j  ƒ d |  j ƒ  S|  j ƒ  Sd  S(   Ns   
(   R	   R6   R7   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR8   ›   s    	c         C   s   d |  j  j |  j ƒ  f S(   Ns   <%s(%s)>(   R9   R   R7   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR:   ¡   s    c         C   s   d S(   NR;   (    (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ¤   s    N(   R   R   R   R   R8   R:   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR=   —   s   		c   
      c   s  | r d } n d } |  d f g } xÜ t  | ƒ d k r| j | ƒ \ } } | rb | | f Vn | Vt | t ƒ r' g  } t  | j ƒ d }	 x] |	 d k rî | d k sÀ t | j |	 | ƒ rá | j | j |	 | d f ƒ n  |	 d 8}	 q’ W| j | ƒ q' q' Wd S(   s™  Iterate over a Node and its Children.

    The walktree function iterates over a tree containing Nodes and
    leaf objects. The iteration can perform a depth first or a breadth
    first traversal of the tree (controlled by the depthfirst
    paramater. The passed in node will be returned.

    This function will only work correctly for trees - arbitrary graphs
    will likely cause infinite looping.
    iÿÿÿÿi    i   N(   t   lent   popR   R   R   R   t   appendt   extend(
   t   nodet
   depthfirstt	   showdeptht   typet   indext   stackt   curt   deptht   itemst   i(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   «   s"    	"!c         c   s8   x1 |  D]) } | d k s( t | | ƒ r | Vq q Wd S(   s  Iterate over the direct children of a Node.

    The walktree function iterates over the children of a Node.
    Unlike walktree it does note return the passed in node or
    the children of any Node objects (that is, it does not go
    beyond the current level in the tree).
    N(   R   R   (   RB   RE   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   walknodeÑ   s    t   {t   }c         C   sl   t  |  ƒ } d } | d k  r- t d ƒ ‚ n  d j |  ƒ } | d k rL | S| d d | d | d Sd S(   sá   Convert a set (or any sequence type) into a string representation
    formatted to match SELinux space separated list conventions.

    For example the list ['read', 'write'] would be converted into:
    '{ read write }'
    R;   i   s"   cannot convert 0 len set to stringt    i    N(   R>   t
   ValueErrort   join(   t   st   contt   lR6   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   list_to_space_strÞ   s    c         C   s4   t  |  ƒ } | d k  r' t d ƒ ‚ n  d j |  ƒ S(   Ni   s'   cannot conver 0 len set to comma strings   , (   R>   RP   RQ   (   RR   RT   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   list_to_comma_strï   s    t   IdSetc           B   s&   e  Z d d  „ Z d „  Z d „  Z RS(   c         C   s3   | r t  j |  | ƒ n t  j |  ƒ t |  _ d  S(   N(   t   setR   t   Falset
   compliment(   R
   t   list(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ù   s    c         C   s   t  t |  ƒ ƒ S(   N(   RU   t   sorted(   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   to_space_str   s    c         C   s   t  t |  ƒ ƒ S(   N(   RV   R\   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   to_comma_str  s    N(   R   R   R   R   R]   R^   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRW   ø   s   	t   SecurityContextc           B   s;   e  Z d  Z d d d „ Z d „  Z d „  Z d d „ Z RS(   s;   An SELinux security context with optional MCS / MLS fields.c         C   sT   t  j |  | ƒ d |  _ d |  _ d |  _ d |  _ | d k	 rP |  j | ƒ n  d S(   sß   Create a SecurityContext object, optionally from a string.

        Parameters:
           [context] - string representing a security context. Same format
              as a string passed to the from_string method.
        R;   N(   R=   R   t   userR   RE   R   t   levelt   from_string(   R
   t   contextR   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    				c         C   s¿   t  j | ƒ } | d d k r, | d } n  | j d ƒ } t | ƒ d k  r` t d | ƒ ‚ n  | d |  _ | d |  _ | d |  _ t | ƒ d k r² d j | d ƒ |  _	 n	 d |  _	 d S(   só   Parse a string representing a context into a SecurityContext.

        The string should be in the standard format - e.g.,
        'user:role:type:level'.

        Raises ValueError if the string is not parsable as a security context.
        i    i   t   :i   s)   context string [%s] not in a valid formati   N(   t   selinuxt   selinux_trans_to_raw_contextt   splitR>   RP   R`   R   RE   RQ   Ra   R   (   R
   Rc   t   rawt   fields(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRb     s    	c         C   sF   |  j  | j  k oE |  j | j k oE |  j | j k oE |  j | j k S(   s  Compare two SecurityContext objects - all fields must be exactly the
        the same for the comparison to work. It is possible for the level fields
        to be semantically the same yet syntactically different - in this case
        this function will return false.
        (   R`   R   RE   Ra   (   R
   t   other(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __eq__1  s    c         C   s…   |  j  |  j |  j g } |  j d k rh | d k rX t j ƒ  d k re | j d ƒ qe qx | j | ƒ n | j |  j ƒ d j | ƒ S(   s½  Return a string representing this security context.

        By default, the string will contiain a MCS / MLS level
        potentially from the default which is passed in if none was
        set.

        Arguments:
           default_level - the default level to use if self.level is an
             empty string.

        Returns:
           A string represening the security context in the form
              'user:role:type:level'.
        i   t   s0Rd   N(	   R`   R   RE   Ra   R   Re   t   is_selinux_mls_enabledR@   RQ   (   R
   t   default_levelRi   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   <  s    N(   R   R   R<   R   R   Rb   Rk   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR_     s
   		t   ObjectClassc           B   s   e  Z d  Z d d d „ Z RS(   s"  SELinux object class and permissions.

    This class is a basic representation of an SELinux object
    class - it does not represent separate common permissions -
    just the union of the common and class specific permissions.
    It is meant to be convenient for policy generation.
    R;   c         C   s)   t  j |  | ƒ | |  _ t ƒ  |  _ d  S(   N(   R=   R   t   nameRW   t   perms(   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ^  s    	N(   R   R   R<   R   R   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRo   V  s   R*   c           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s[   SElinux typeattribute statement.

    This class represents a typeattribute statement.
    c         C   s)   t  j |  | ƒ d |  _ t ƒ  |  _ d  S(   NR;   (   R=   R   RE   RW   t
   attributes(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   j  s    	c         C   s   d |  j  |  j j ƒ  f S(   Ns   typeattribute %s %s;(   RE   Rr   R^   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   o  s    N(   R   R   R<   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR*   e  s   R,   c           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s[   SElinux roleattribute statement.

    This class represents a roleattribute statement.
    c         C   s)   t  j |  | ƒ d |  _ t ƒ  |  _ d  S(   NR;   (   R=   R   R   RW   R-   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   w  s    	c         C   s   d |  j  |  j j ƒ  f S(   Ns   roleattribute %s %s;(   R   R-   R^   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   |  s    N(   R   R   R<   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR,   r  s   R0   c           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s)   t  j |  | ƒ d |  _ t ƒ  |  _ d  S(   NR;   (   R=   R   R   RW   t   types(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    	c         C   s5   d } x( |  j  D] } | d |  j | f 7} q W| S(   NR;   s   role %s types %s;
(   Rs   R   (   R
   RR   t   t(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   †  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR0   €  s   t   Typec           B   s    e  Z d  d d „ Z d „  Z RS(   R;   c         C   s5   t  j |  | ƒ | |  _ t ƒ  |  _ t ƒ  |  _ d  S(   N(   R=   R   Rp   RW   Rr   t   aliases(   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    	c         C   ss   d |  j  } t |  j ƒ d k r< | d |  j j ƒ  } n  t |  j ƒ d k rk | d |  j j ƒ  } n  | d S(   Ns   type %si    s   alias %ss   , %st   ;(   Rp   R>   Rv   R]   Rr   R^   (   R
   RR   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   “  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRu   Œ  s   t	   TypeAliasc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s)   t  j |  | ƒ d |  _ t ƒ  |  _ d  S(   NR;   (   R=   R   RE   RW   Rv   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   œ  s    	c         C   s   d |  j  |  j j ƒ  f S(   Ns   typealias %s alias %s;(   RE   Rv   R]   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ¡  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRx   ›  s   t	   Attributec           B   s    e  Z d  d d „ Z d „  Z RS(   R;   c         C   s   t  j |  | ƒ | |  _ d  S(   N(   R=   R   Rp   (   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ¥  s    c         C   s   d |  j  S(   Ns   attribute %s;(   Rp   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ©  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRy   ¤  s   t   Attribute_Rolec           B   s    e  Z d  d d „ Z d „  Z RS(   R;   c         C   s   t  j |  | ƒ | |  _ d  S(   N(   R=   R   Rp   (   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ­  s    c         C   s   d |  j  S(   Ns   attribute_role %s;(   Rp   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ±  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRz   ¬  s   R$   c           B   sP   e  Z d  Z d Z d Z d Z d Z d	 d	 d „ Z d „  Z	 d „  Z
 d „  Z RS(
   s»  SELinux access vector (AV) rule.

    The AVRule class represents all varieties of AV rules including
    allow, dontaudit, and auditallow (indicated by the flags self.ALLOW,
    self.DONTAUDIT, and self.AUDITALLOW respectively).

    The source and target types, object classes, and perms are all represented
    by sets containing strings. Sets are used to make it simple to add
    strings repeatedly while avoiding duplicates.

    No checking is done to make certain that the symbols are valid or
    consistent (e.g., perms that don't match the object classes). It is
    even possible to put invalid types like '$1' into the rules to allow
    storage of the reference policy interfaces.
    i    i   i   i   c         C   sf   t  j |  | ƒ t ƒ  |  _ t ƒ  |  _ t ƒ  |  _ t ƒ  |  _ |  j |  _ | rb |  j	 | ƒ n  d  S(   N(
   R=   R   RW   t	   src_typest	   tgt_typest   obj_classesRq   t   ALLOWt	   rule_typet   from_av(   R
   t   avR   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   Ì  s    c         C   s4   |  j  |  j k r d S|  j  |  j k r, d Sd Sd  S(   Nt   allowt	   dontauditt
   auditallow(   R   R~   t	   DONTAUDIT(   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __rule_type_strÖ  s
    c         C   su   |  j  j | j ƒ | j | j k r8 |  j j d ƒ n |  j j | j ƒ |  j j | j ƒ |  j j | j ƒ d S(   sI   Add the access from an access vector to this allow
        rule.
        R
   N(	   R{   t   addt   src_typet   tgt_typeR|   R}   t	   obj_classRq   t   update(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR€   Þ  s    c         C   sA   d |  j  ƒ  |  j j ƒ  |  j j ƒ  |  j j ƒ  |  j j ƒ  f S(   s«   Return a string representation of the rule
        that is a valid policy language representation (assuming
        that the types, object class, etc. are valie).
        s   %s %s %s:%s %s;(   t   _AVRule__rule_type_strR{   R]   R|   R}   Rq   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ê  s
    N(   R   R   R<   R~   R…   t
   AUDITALLOWt
   NEVERALLOWR   R   RŒ   R€   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR$   ·  s   
		R&   c           B   s>   e  Z d  Z d Z d Z d Z d d „ Z d „  Z d „  Z	 RS(   sö   SELinux type rules.

    This class is very similar to the AVRule class, but is for representing
    the type rules (type_trans, type_change, and type_member). The major
    difference is the lack of perms and only and sing destination type.
    i    i   i   c         C   sM   t  j |  | ƒ t ƒ  |  _ t ƒ  |  _ t ƒ  |  _ d |  _ |  j |  _ d  S(   NR;   (	   R=   R   RW   R{   R|   R}   t	   dest_typet   TYPE_TRANSITIONR   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ÿ  s    	c         C   s4   |  j  |  j k r d S|  j  |  j k r, d Sd Sd  S(   Nt   type_transitiont   type_changet   type_member(   R   R   t   TYPE_CHANGE(   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR†     s
    c         C   s;   d |  j  ƒ  |  j j ƒ  |  j j ƒ  |  j j ƒ  |  j f S(   Ns   %s %s %s:%s %s;(   t   _TypeRule__rule_type_strR{   R]   R|   R}   R   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7     s
    N(
   R   R   R<   R   R”   t   TYPE_MEMBERR   R   R•   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR&   ô  s   	R(   c           B   s#   e  Z d  Z d d „ Z d „  Z RS(   sS   SElinux typebound statement.

    This class represents a typebound statement.
    c         C   s)   t  j |  | ƒ d |  _ t ƒ  |  _ d  S(   NR;   (   R=   R   RE   RW   R|   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    	c         C   s   d |  j  |  j j ƒ  f S(   Ns   typebounds %s %s;(   RE   R|   R^   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7     s    N(   R   R   R<   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR(     s   R2   c           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s,   t  j |  | ƒ t ƒ  |  _ t ƒ  |  _ d  S(   N(   R=   R   RW   t	   src_rolest	   tgt_roles(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   $  s    c         C   s    d |  j  j ƒ  |  j j ƒ  f S(   Ns   allow %s %s;(   R—   R^   R˜   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   )  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR2   #  s   R4   c           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s)   t  j |  | ƒ d |  _ t ƒ  |  _ d  S(   NR;   (   R=   R   R   RW   Rs   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   .  s    	c         C   s5   d } x( |  j  D] } | d |  j | f 7} q W| S(   NR;   s   role %s types %s;
(   Rs   R   (   R
   RR   Rt   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   3  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR4   -  s   R    c           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s/   t  j |  | ƒ d |  _ d |  _ t |  _ d  S(   NR;   (   R=   R   Rp   t   versionRY   t	   refpolicy(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   :  s    		c         C   s5   |  j  r d |  j |  j f Sd |  j |  j f Sd  S(   Ns   policy_module(%s, %s)s   module %s %s;(   Rš   Rp   R™   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   @  s    	N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR    9  s   t   Conditionalc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s   t  j |  | ƒ g  |  _ d  S(   N(   R   R   t	   cond_expr(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   G  s    c         C   s   d t  |  j d d ƒS(   Ns   [If %s]RS   R;   (   R;   R;   (   RU   Rœ   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   K  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR›   F  s   t   Boolc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ t |  _ d  S(   NR;   (   R=   R   Rp   RY   t   state(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   O  s    	c         C   s*   d |  j  } | j r | d S| d Sd  S(   Ns   bool %s t   truet   false(   Rp   Rž   (   R
   RR   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   T  s    	N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   N  s   t
   InitialSidc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ d  |  _ d  S(   NR;   (   R=   R   Rp   R   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __init\  s    	c         C   s   d |  j  t |  j ƒ f S(   Ns	   sid %s %s(   Rp   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   a  s    N(   R   R   R   t   _InitialSid__initR7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR¡   [  s   t   GenfsConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s/   t  j |  | ƒ d |  _ d |  _ d  |  _ d  S(   NR;   (   R=   R   t
   filesystemt   pathR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   e  s    		c         C   s    d |  j  |  j t |  j ƒ f S(   Ns   genfscon %s %s %s(   R¥   R¦   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   k  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR¤   d  s   t   FilesystemUsec           B   s/   e  Z d  Z d Z d Z d d „ Z d „  Z RS(   i   i   i   c         C   s2   t  j |  | ƒ |  j |  _ d |  _ d  |  _ d  S(   NR;   (   R=   R   t   XATTRRE   R¥   R   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   s  s    	c         C   sk   d } |  j  t k r d } n0 |  j  t k r6 d } n |  j  t k rN d } n  d | |  j t |  j ƒ f S(   NR;   s   fs_use_xattr s   fs_use_trans s   fs_use_task s	   %s %s %s;(   RE   R¨   t   TRANSt   TASKR¥   R6   Rc   (   R
   RR   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   y  s    			N(   R   R   R¨   R©   Rª   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR§   n  s
   t   PortConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s/   t  j |  | ƒ d |  _ d |  _ d  |  _ d  S(   NR;   (   R=   R   t	   port_typet   port_numberR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   …  s    		c         C   s    d |  j  |  j t |  j ƒ f S(   Ns   portcon %s %s %s(   R¬   R­   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ‹  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR«   „  s   t   NodeConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s/   t  j |  | ƒ d |  _ d |  _ d  |  _ d  S(   NR;   (   R=   R   t   startt   endR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    		c         C   s    d |  j  |  j t |  j ƒ f S(   Ns   nodecon %s %s %s(   R¯   R°   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   •  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR®   Ž  s   t   NetifConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s/   t  j |  | ƒ d |  _ d  |  _ d  |  _ d  S(   NR;   (   R=   R   t	   interfaceR   t   interface_contextt   packet_context(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ™  s    		c         C   s&   d |  j  t |  j ƒ t |  j ƒ f S(   Ns   netifcon %s %s %s(   R²   R6   R³   R´   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   Ÿ  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR±   ˜  s   t   PirqConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ d  |  _ d  S(   NR;   (   R=   R   t   pirq_numberR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   £  s    	c         C   s   d |  j  t |  j ƒ f S(   Ns   pirqcon %s %s(   R¶   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ¨  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRµ   ¢  s   t   IomemConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ d  |  _ d  S(   NR;   (   R=   R   t
   device_memR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ¬  s    	c         C   s   d |  j  t |  j ƒ f S(   Ns   iomemcon %s %s(   R¸   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ±  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR·   «  s   t	   IoportConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ d  |  _ d  S(   NR;   (   R=   R   t   ioportR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   µ  s    	c         C   s   d |  j  t |  j ƒ f S(   Ns   ioportcon %s %s(   Rº   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   º  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR¹   ´  s   t   PciDeviceConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ d  |  _ d  S(   NR;   (   R=   R   t   deviceR   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ¾  s    	c         C   s   d |  j  t |  j ƒ f S(   Ns   pcidevicecon %s %s(   R¼   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   Ã  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR»   ½  s   t   DeviceTreeConc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s&   t  j |  | ƒ d |  _ d  |  _ d  S(   NR;   (   R=   R   R¦   R   Rc   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   Ç  s    	c         C   s   d |  j  t |  j ƒ f S(   Ns   devicetreecon %s %s(   R¦   R6   Rc   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   Ì  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR½   Æ  s   c         C   s]   xV t  |  d t ƒD]B \ } } d } x t | ƒ D] } | d } q2 W| t | ƒ GHq Wd  S(   NRD   R;   s   	(   R   t   Truet   rangeR6   (   t   headRB   RI   RR   RK   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt
   print_treeÑ  s
    t   Headersc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s   t  j |  | ƒ d  S(   N(   R   R   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   Ú  s    c         C   s   d S(   Ns	   [Headers](    (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   Ý  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÂ   Ù  s   R   c           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s   t  j |  | ƒ d  S(   N(   R   R   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   â  s    c         C   s   d S(   NR;   (    (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   å  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   á  s   R   c           B   s&   e  Z d  Z d d d „ Z d „  Z RS(   sq   A reference policy interface definition.

    This class represents a reference policy interface definition.
    R;   c         C   s   t  j |  | ƒ | |  _ d  S(   N(   R   R   Rp   (   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   í  s    c         C   s   d |  j  S(   Ns   [Interface name: %s](   Rp   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ñ  s    N(   R   R   R<   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   è  s   t   TunablePolicyc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s   t  j |  | ƒ g  |  _ d  S(   N(   R   R   Rœ   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   õ  s    c         C   s   d t  |  j d d ƒS(   Ns   [Tunable Policy %s]RS   R;   (   R;   R;   (   RU   Rœ   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ù  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÃ   ô  s   R   c           B   s    e  Z d  d d „ Z d „  Z RS(   R;   c         C   s   t  j |  | ƒ | |  _ d  S(   N(   R   R   Rp   (   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ý  s    c         C   s   d |  j  S(   Ns   [Template name: %s](   Rp   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7     s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ü  s   t   IfDefc           B   s    e  Z d  d d „ Z d „  Z RS(   R;   c         C   s   t  j |  | ƒ | |  _ d  S(   N(   R   R   Rp   (   R
   Rp   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    c         C   s   d |  j  S(   Ns   [Ifdef name: %s](   Rp   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   	  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÄ     s   R"   c           B   s)   e  Z d  d d „ Z d „  Z d „  Z RS(   R;   c         C   s/   t  j |  | ƒ | |  _ g  |  _ g  |  _ d  S(   N(   R=   R   t   ifnamet   argst   comments(   R
   RÅ   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    		c         C   sr   |  j  | j  k r t St |  j ƒ t | j ƒ k r8 t Sx3 t |  j | j ƒ D] \ } } | | k rN t SqN Wt S(   N(   RÅ   RY   R>   RÆ   t   zipR¾   (   R
   Rj   t   at   b(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   matches  s    "c         C   s„   d |  j  } d } xf |  j D][ } t | t ƒ rA t | ƒ } n | } | d k rd | d | } n
 | | } | d 7} q W| d S(   Ns   %s(i    s   , %si   t   )(   RÅ   RÆ   R   R[   RU   (   R
   RR   RK   RÉ   R6   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7     s    
N(   R   R   R   R   RË   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR"     s   	
t   OptionalPolicyc           B   s   e  Z d d  „ Z d „  Z RS(   c         C   s   t  j |  | ƒ d  S(   N(   R   R   (   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   .  s    c         C   s   d S(   Ns   [Optional Policy](    (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   1  s    N(   R   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÍ   -  s   R   c           B   sA   e  Z d d  „ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   t  j |  | ƒ d  |  _ d  S(   N(   R   R   R   t   map(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   5  s    c         C   s   d S(   Ns   [Support Macros](    (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   9  s    c         C   s\   t  ƒ  } | |  j k rK x= |  j | ƒ D] } | j |  j | ƒ ƒ q( Wn | j | ƒ | S(   N(   RX   RÎ   t   by_nameR‹   t   _SupportMacros__expand_permR‡   (   R
   t   permRR   t   p(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   __expand_perm<  s    	c         C   sa   i  |  _  xQ |  D]I } t ƒ  } x' | j D] } | j |  j | ƒ ƒ q) W| |  j  | j <q Wd  S(   N(   RÎ   RX   Rq   R‹   RÐ   Rp   (   R
   R   t	   exp_permsRÑ   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt	   __gen_mapH  s    		c         C   s!   |  j  s |  j ƒ  n  |  j  | S(   N(   RÎ   t   _SupportMacros__gen_map(   R
   Rp   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÏ   P  s    	c         C   s#   |  j  s |  j ƒ  n  | |  j  k S(   N(   RÎ   RÖ   (   R
   Rp   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   has_keyU  s    	N(	   R   R   R   R   R7   RÐ   RÖ   RÏ   R×   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   4  s   				R.   c           B   s&   e  Z d d  „ Z d „  Z d „  Z RS(   c         C   sM   t  j |  | ƒ t ƒ  |  _ i  |  _ t ƒ  |  _ t ƒ  |  _ t ƒ  |  _ d  S(   N(   R=   R   RW   Rs   R}   R1   t   datat   users(   R
   R   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   [  s    	c         C   s)   |  j  j | t ƒ  ƒ } | j | ƒ d  S(   N(   R}   t
   setdefaultRW   R‹   (   R
   RŠ   Rq   RÒ   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   add_obj_classc  s    c         C   s  g  } | j  d ƒ x" |  j D] } | j  d | ƒ q Wx: |  j j ƒ  D]) \ } } | j  d | | j ƒ  f ƒ qH Wx" |  j D] } | j  d | ƒ q Wx" |  j D] } | j  d | ƒ q¤ Wx" |  j D] } | j  d | ƒ qÉ W| j  d ƒ t | ƒ d k rd	 Sd
 j	 | ƒ S(   Ns	   require {s	   	type %s;s   	class %s %s;s	   	role %s;s	   	bool %s;s	   	user %s;RN   i   R;   s   
(
   R@   Rs   R}   RJ   R]   R1   RØ   RÙ   R>   RQ   (   R
   RR   RE   RŠ   Rq   R   t   boolR`   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   h  s     !N(   R   R   R   R   RÛ   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR.   Z  s   	t
   ObjPermSetc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  t ƒ  |  _ d  S(   N(   Rp   RX   Rq   (   R
   Rp   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    	c         C   s   d |  j  |  j j ƒ  f S(   Ns   define(`%s', `%s')(   Rp   Rq   R]   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ƒ  s    (   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÝ   ~  s   	t   ClassMapc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   RŠ   Rq   (   R
   RŠ   Rq   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR   ‡  s    	c         C   s   |  j  d |  j S(   Ns   : (   RŠ   Rq   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   ‹  s    (   R   R   R   R7   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRÞ   †  s   	t   Commentc           B   s/   e  Z d d  „ Z d „  Z d „  Z d „  Z RS(   c         C   s   | r | |  _  n	 g  |  _  d  S(   N(   t   lines(   R
   RT   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR     s    c         C   sU   t  |  j ƒ d k r d Sg  } x" |  j D] } | j d | ƒ q) Wd j | ƒ Sd  S(   Ni    R;   t   #s   
(   R>   Rà   R@   RQ   (   R
   t   outt   line(    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR7   •  s    c         C   sI   t  | j ƒ rE x3 | j D]% } | d k r |  j j | ƒ q q Wn  d  S(   NR;   (   R>   Rà   R@   (   R
   Rj   Rã   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   merge   s    c         C   s
   |  j  ƒ  S(   N(   R7   (   R
   (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyR8   ¦  s    N(   R   R   R   R   R7   Rä   R8   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyRß   Ž  s   		(    (   RM   RN   (    (    (    (@   t   stringRe   t   SRC_TYPEt   TGT_TYPEt	   OBJ_CLASSt   PERMSt   ROLEt	   DEST_TYPEt   field_to_strt   str_to_fieldR   R   R=   R¾   RY   R   R   RL   RU   RV   RX   RW   R_   Ro   R*   R,   R0   Ru   Rx   Ry   Rz   R$   R&   R(   R2   R4   R    R›   R   R¡   R¤   R§   R«   R®   R±   Rµ   R·   R¹   R»   R½   RÁ   RÂ   R   R   RÃ   R   RÄ   R"   RÍ   R   R.   RÝ   RÞ   Rß   (    (    (    s8   /usr/lib64/python2.7/site-packages/sepolgen/refpolicy.pyt   <module>   sx   ^&		P	=!
	



					!&$