KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/lib64/python2.4/site-packages/sepolgen/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/lib64/python2.4/site-packages/sepolgen/interfaces.pyo
mò
d&KRc@sªdZdkZdkZdkZdkZdkZdklZdfd„ƒYZd„Z	d„Z
d„Zd„Zd	„Z
d
fd„ƒYZdfd
„ƒYZdS(s7
Classes for representing and manipulating interfaces.
N(t_tParamcBsStZdZd„Zd„Zd„ZeeeƒZedd„ƒZd„Z	RS(s;
    Object representing a paramater for an interface.
    cCs1d|_ti|_tiƒ|_t|_dS(Nt(	tselft_Param__namet	refpolicytSRC_TYPEttypetIdSettobj_classestTruetrequired(R((t9/usr/lib64/python2.4/site-packages/sepolgen/interfaces.pyt__init__$s	cCs1ti|ƒptd|ƒ‚n||_dS(NsName [%s] is not a param(taccesst
is_idparamtnamet
ValueErrorRR(RR((Rtset_name*scCs|iS(N(RR(R((Rtget_name/stfgetcCst|idƒS(Ni(tintRR(R((Rt<lambda>4scCs*d|iti|idi|iƒfS(Ns0<sepolgen.policygen.Param instance [%s, %s, %s]>t (RRRtfield_to_strRtjoinR	(R((Rt__repr__6s(
t__name__t
__module__t__doc__R
RRtpropertyRtnumR(((RR s			cCs=d}||joà||}||ijodSn|tijp|tijo”|itijp|itijond}|o|i	g}ng}x8ti|i
|ƒD]!}|tijod}Pq´q´Wti|_qd}n)tƒ}||_||_|||i<|o|i
i|i	ƒn|S(Nii(tretRtparamstpRRRtTGT_TYPEtavt	obj_classtavobjst	itertoolstchainR	tobjtobjectmodeltimplicitly_typed_objectsRtadd(RRR$R!R&R R"R)((Rt__param_insert<s0

F	
			
cCs!d}t}ti|iƒo0t|iti	||ƒdjo
d}qOnti|iƒo0t|iti||ƒdjo
d}q’nti|i
ƒo0t|i
ti||ƒdjo
d}qÕnxE|iD]:}ti|ƒo$t|tƒdjo
d}qqßqßW|S(sjExtract the paramaters from an access vector.

    Extract the paramaters (in the form $N) from an access
    vector, storing them as Param objects in a dictionary.
    Some attempt is made at resolving conflicts with other
    entries in the dict, but if an unresolvable conflict is
    found it is reported to the caller.

    The goal here is to figure out how interface paramaters are
    actually used in the interface - e.g., that $1 is a domain used as
    a SRC_TYPE. In general an interface will look like this:

    interface(`foo', `
       allow $1 foo : file read;
    ')

    This is simple to figure out - $1 is a SRC_TYPE. A few interfaces
    are more complex, for example:

    interface(`foo_trans',`
       domain_auto_trans($1,fingerd_exec_t,fingerd_t)

       allow $1 fingerd_t:fd use;
       allow fingerd_t $1:fd use;
       allow fingerd_t $1:fifo_file rw_file_perms;
       allow fingerd_t $1:process sigchld;
    ')

    Here the usage seems ambigious, but it is not. $1 is still domain
    and therefore should be returned as a SRC_TYPE.

    Returns:
      0  - success
      1  - conflict found
    iiN(R tFalset	found_srcRRR$tsrc_typeR-RRR!ttgt_typeR#R%t	OBJ_CLASStpermstpermtPERM(R$R!R/R R4((Rtav_extract_paramshs$#"""
cCs4ti|iƒot|itid|ƒSndS(N(RRtroleR-RtROLEtNoneR!(R7R!((Rtrole_extract_params¡scs³‡d†}d}||itiƒo
d}n||itiƒo
d}n||iti	ƒo
d}nt
i|iƒo*t
|itidˆƒo
d}q¯n|S(NcsOd}xB|D]:}ti|ƒo$t||dˆƒo
d}qGq
q
W|S(Nii(	R tsettxRRR-RR9R!(R;RR R<(R!(Rtextract_from_set¦sii(R=R trulet	src_typesRRt	tgt_typesR#R	R2RRt	dest_typeR-t	DEST_TYPER9R!(R>R!R R=((R!Rttype_rule_extract_params¥s


cCsUd}xH|iD]=}ti|ƒo't|tid|ƒo
d}qMqqW|S(Nii(R tifcalltargstargRRR-RRR9R!(RDR!R RF((Rtifcall_extract_params¾s
tInterfaceVectorcBsAtZdd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsOt|_d|_tiƒ|_h|_|o|i|ƒnt	|_
dS(NR(R
RtenabledRRtAccessVectorSetR!t	interfacetfrom_interfaceR.texpanded(RRK((RR
Ës			cCs|i|_xu|iƒD]g}|itiijoqnd|ijoqnt	i
|ƒ}x|D]}|i
|ƒqiWqWx+|iƒD]}t||iƒoq‘q‘Wx+|iƒD]}t||iƒoq¿q¿Wx+|iƒD]}t||iƒoqíqíWdS(Nt	dontaudit(RKRRtavrulestavrulet	rule_typeRtAVRuletALLOWRtavrule_to_access_vectorstavsR$tadd_avtrolesR7R:R!t	typerulesR>RCtinterface_callsRDRG(RRKRPR>RUR7R$RD((RRLÜs.



cCs1t||iƒdjon|ii|ƒdS(Ni(R6R$RR!RRV(RR$((RRVÿscCsNg}|id|iƒx$|iD]}|it|ƒƒq$Wdi|ƒS(Ns[InterfaceVector %s]s
(tstappendRRRR$tstrR(RRZR$((Rt	to_strings
cCs
|iƒS(N(RR(R((Rt__str__scCsd|i|ifS(Ns<InterfaceVector %s:%s>(RRRI(R((RRs(	RRR9R
RLRVR]R^R(((RRHÊs	#			tInterfaceSetcBsztZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z	dd„Z
d	„Zd
„Zd„Z
d„ZRS(
NcCs(h|_h|_g|_||_dS(N(Rt
interfacesttgt_type_mapttgt_type_alltoutput(RRc((RR
s			cCs&|io|ii|dƒndS(Ns
(RRctwriteR\(RR\((Rtos
cCsÀx¹|iiƒD]¨}|id|iƒx;|iiƒD]*}|id|it	i
|ifƒq:W|idƒ|ii
ƒ}x1|D])}|idi|ƒƒ|idƒq‹WqWdS(Ns[InterfaceVector %s s%s:%s s]
t,s
(RR`tvaluestivtfdRdRR!tparamRRRRtto_listtavlR$R(RRiRjRhRlR$((Rtto_files(
cCs¿d„}d}x‡|D]}|d }|ddjo(|o|i|ƒn||ƒ}q|o/|idƒ}t	i
|ƒ}|i|ƒqqW|o|i|ƒn|i
ƒdS(NcCs|dd!iƒ}t|ƒdjp|ddjotd|ƒ‚ntƒ}|d|_t|ƒdjodSnx‚|dD]v}|idƒ}t|ƒdjotd|ƒ‚nt
ƒ}|d|_ti
|d|_||i|i<q‡W|S(	NiiÿÿÿÿiiRHs)Syntax error InterfaceVector statement %st:s-Invalid param in InterfaceVector statement %s(tlinetsplittfieldstlentSyntaxErrorRHtifvRtfieldR"RRjRtstr_to_fieldRR!(RoRtR"RqRuRj((Rt	parse_ifv*s"$	
	
iÿÿÿÿit[Rf(RwR9RtRiRoRtadd_ifvRptlRtAccessVectorR$RVtindex(RRiRtRwRzR$Ro((Rt	from_file)s 	
cCs||i|i<dS(N(RtRR`R(RRt((RRyLscCs¯x¨|iiƒD]—}tƒ}xR|iD]G}ti|i	ƒo|i
i|ƒtƒ}Pn|i|i	ƒq)Wx0|D](}|ii|gƒ}|i|ƒq{WqWdS(N(RR`RgRtR;R@RR$RR1RbR[R,RRat
setdefaultRz(RR@RtRzR$R((RR|Os	
	cCst|ƒ}|i|ƒdS(N(RHRKRtRRy(RRKRt((RR,]scCsQx3ti|iƒ|iƒƒD]}|i|ƒqW|i|ƒ|i	ƒdS(N(
R'R(theadersR`t	templatestiRR,texpand_ifcallsR|(RRRcR((Rtadd_headersas

cCs}ti|ƒobt|dƒ}|t|iƒjodSqy|i|d}t
|tƒo|Sqy|gSn|gSdS(Ni(RRtidRRRrRDRER9RFt
isinstancetlist(RR„RDRRF((Rt	map_paramhsc
Cs<|i|i|ƒ}|djodSn|i|i|ƒ}
|
djodSn|i|i	|ƒ}|djodSntiƒ}xD|iD]9}|i||ƒ}	|	djoq”q”|i|	ƒq”Wt|ƒdjodSnxI|D]A}x8|
D]0}x'|D]}|ii||||ƒq
WqWqóWdS(Ni(RR‡R$R0RDR?R9R1R@R%R	RRt	new_permsR3R4R"tupdateRrRtRR,(
RRtR$RDR1R0R?RˆR4R"R@R%R	((Rt
map_add_avxs2




cCsQ|dfg}	|i|i}t|_x"t	|	ƒdjo|	i
dƒ\}
}|i|
i}|
|jo<x$|iD]}|i|||ƒqzW|ioq+q¬nx™|
iƒD]‹}|i|ijo|itdƒƒdSny||i}Wn0tj
o$|itd|iƒƒq¹nX|	i||fƒq¹Wq+WdS(NiiÿÿÿÿsFound circular interface classs#Missing interface definition for %s(RKR9tstackRR`RRtR
RMRrtpoptcurt
cur_ifcalltcur_ifvRR$RŠRYRDtifnameReRt
if_by_nametnewiftKeyErrorR[(RRKR‘RtR’RRŽR$RDR‹R((Rtdo_expand_ifcalls”s0	



cCsyh}x3ti|iƒ|iƒƒD]}|||i<q%Wx6ti|iƒ|iƒƒD]}|i
||ƒq[WdS(N(R‘R'R(RR`R€RRRKRR”(RRR‘RRK((RR‚¸s(RRR9R
ReRmR}RyR|R,RƒR‡RŠR”R‚(((RR_s			#						$(RRRR'R*tmatchingtsepolgeni18nRRR-R6R:RCRGRHR_(R-RRGR*R6RRHRR'RCR_R:R•R((Rt?s					
	,	9			I

Anon7 - 2021