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 :  /usr/lib64/python2.4/site-packages/sepolgen/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.4/site-packages/sepolgen/module.pyc
mò
d&KRc@s“dZdkZdkZdkZdkZdkZdkZdkZdkZdk	Z	d„Z
dfd„ƒYZd„Zdfd„ƒYZ
dS(sU
Utilities for dealing with the compilation of modules and creation
of module tress.
NcCs5tid|ƒ}t|ƒdjotSntSdS(s'Check that a module name is valid.
    s[^a-zA-Z0-9]iN(tretfindalltmodnametmtlentTruetFalse(RR((t5/usr/lib64/python2.4/site-packages/sepolgen/module.pyt
is_valid_name%s
t
ModuleTreecBsStZd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Z
RS(	NcCs||_d|_dS(N(RtselftNonetdirname(R
R((Rt__init__/s	cCs|iS(N(R
R(R
((Rtdir_name3scCs|id|idS(Nt/s.te(R
RR(R
((Rtte_name6scCs|id|idS(NRs.fc(R
RR(R
((Rtfc_name9scCs|id|idS(NRs.if(R
RR(R
((Rtif_name<scCs|id|idS(NRs.pp(R
RR(R
((Rtpackage_name?scCs|idS(Ns	/Makefile(R
R(R
((Rt
makefile_nameBscCsÅ|d|i|_ti|iƒt|iƒdƒ}|o|i
d|ƒn|i
dtiƒƒ|i
ƒt|iƒdƒi
ƒt|iƒdƒi
ƒt|iƒdƒi
ƒdS(NRtwsinclude (tparent_dirnameR
RRtostmkdirtopenRtfdtmakefile_includetwritetdefaultstrefpolicy_makefiletcloseRRR(R
RRR((RtcreateEs
(t__name__t
__module__R
RRRRRRRR (((RR	.s							cCs$tiitii|ƒdƒdS(Nii(Rtpathtsplitexttsplitt
sourcename(R&((Rtmodname_from_sourcenameUstModuleCompilercBs\tZdZed„Zd„Zd„Zd„Zed„Z	d„Z
d„Zd„ZRS(	stModuleCompiler eases running of the module compiler.

    The ModuleCompiler class encapsulates running the commandline
    module compiler (checkmodule) and module packager (semodule_package).
    You are likely interested in the create_module_package method.
    
    Several options are controlled via paramaters (only effects the 
    non-refpol builds):
    
     .mls          [boolean] Generate an MLS module (by passed -M to
                   checkmodule). True to generate an MLS module, false
                   otherwise.
                   
     .module       [boolean] Generate a module instead of a base module.
                   True to generate a module, false to generate a base.
                   
     .checkmodule  [string] Fully qualified path to the module compiler.
                   Default is /usr/bin/checkmodule.
                   
     .semodule_package [string] Fully qualified path to the module
                   packager. Defaults to /usr/bin/semodule_package.
     .output       [file object] File object used to write verbose
                   output of the compililation and packaging process.
    cCsRtiƒ|_t|_d|_d|_||_d|_	d|_
d|_dS(s‡Create a ModuleCompiler instance, optionally with an
        output file object for verbose output of the compilation process.
        s/usr/bin/checkmodules/usr/bin/semodule_packagets!/usr/share/selinux/devel/Makefiles
/usr/bin/makeN(tselinuxtis_selinux_mls_enabledR
tmlsRtmoduletcheckmoduletsemodule_packagetoutputtlast_outputtrefpol_makefiletmake(R
R0((RR
qs						cCs/|io|ii|dƒn||_dS(Ns
(R
R0RtstrR1(R
R4((Rto~s
cCs3|i|ƒti|ƒ\}}|i|ƒ|S(N(R
R5tcommandtcommandstgetstatusoutputtrcR0(R
R6R0R9((Rtrunƒs

cCsi|idƒ}t|ƒdjotd|ƒ‚ndi|dd!ƒ}|d}|d}||fS(	sþGenerate the module and policy package filenames from
        a source file name. The source file must be in the form
        of "foo.te". This will generate "foo.mod" and "foo.pp".
        
        Returns a tuple with (modname, policypackage).
        t.is,invalid sourcefile name %s (must end in .te)iiÿÿÿÿs.mods.ppN(	R&R%t	splitnameRtRuntimeErrortjointbasenameRtpackagename(R
R&R?R@RR<((Rt
gen_filenamesŠs

cCs^|o|i|ƒnC|i|ƒ\}}|i||ƒ|i||ƒt	i
|ƒdS(sŒCreate a module package saved in a packagename from a
        sourcename.

        The create_module_package creates a module package saved in a
        file named sourcename (.pp is the standard extension) from a
        source file (.te is the standard extension). The source file
        should contain SELinux policy statements appropriate for a
        base or non-base module (depending on the setting of .module).

        Only file names are accepted, not open file objects or
        descriptors because the command line SELinux tools are used.

        On error a RuntimeError will be raised with a descriptive
        error message.
        N(t	refpolicyR
trefpol_buildR&RARR@tcompiletpackageRtunlink(R
R&RBRR@((Rtcreate_module_package›scCsK|id|i}|i|ƒ}|djotd|iƒ‚ndS(Ns -f iscompilation failed:
%s(R
R3R2R6R:R9R=R1(R
R&R6R9((RRC³s
cCs©|ig}|io|idƒn|io|idƒn|idƒ|i|ƒ|i|ƒ|idi	|ƒƒ}|djotd|iƒ‚ndS(Ns-Ms-ms-ot iscompilation failed:
%s(
R
R.tsR,tappendR-RR&R:R>R9R=R1(R
R&RRIR9((RRD¼s





cCs€|ig}|idƒ|i|ƒ|idƒ|i|ƒ|idi|ƒƒ}|djot	d|i
ƒ‚ndS(Ns-os-mRHispackaging failed [%s](R
R/RIRJR@RR:R>R9R=R1(R
RR@RIR9((RREÊs




(
R!R"t__doc__RR
R5R:RARRGRCRDRE(((RR(Xs
						(RKRR*RttempfileR7Rtos.patht
subprocesstshutilRR	R'R((R7RR'R(RLR*RNRRR	ROR((Rt?s											'	

Anon7 - 2021