• File: dbus_utils.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/lib/python2.7/site-packages/firewall/dbus_utils.pyc
  • Date Modified: 05/01/2021 12:21 PM
  • File size: 7.15 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

G`c@sdddddddddd	d
gZddlZddlZddlZdd
lmZddlmZejdkZ	dZ
dZdZdZ
dZdZdZddZdZddZdZdS(tcommand_of_pidt
pid_of_sendert
uid_of_sendertuser_of_uidtcontext_of_sendertcommand_of_sendertuser_of_sendertdbus_to_pythontdbus_signaturet%dbus_introspection_prepare_propertiest!dbus_introspection_add_propertiesiN(tminidom(tlogt3cCs[yBtd|d)}|jdjddj}WdQXWntk
rVdSX|S(s  Get command for pid from /proc s/proc/%d/cmdlinetritt N(topent	readlinestreplacetstript	ExceptiontNone(tpidtftcmd((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyR%s,
cCsV|jdd}tj|d}yt|j|}Wntk
rQdSX|S(sW Get pid from sender string using 
    org.freedesktop.DBus.GetConnectionUnixProcessID sorg.freedesktop.DBuss/org/freedesktop/DBusN(t
get_objecttdbust	InterfacetinttGetConnectionUnixProcessIDt
ValueErrorR(tbustsendertdbus_objt
dbus_ifaceR((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyR.s
cCsV|jdd}tj|d}yt|j|}Wntk
rQdSX|S(sV Get user id from sender string using 
    org.freedesktop.DBus.GetConnectionUnixUser sorg.freedesktop.DBuss/org/freedesktop/DBusN(RRRRtGetConnectionUnixUserRR(R R!R"R#tuid((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyR;s
cCs0ytj|}Wntk
r'dSX|dS(s Get user for uid from pwd iN(tpwdtgetpwuidRR(R%tpws((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyRHs

cCsh|jdd}tj|d}y|j|}Wntk
rKdSXdjttt	|S(sl Get SELinux context from sender string using 
    org.freedesktop.DBus.GetConnectionSELinuxSecurityContext sorg.freedesktop.DBuss/org/freedesktop/DBustN(
RRRt#GetConnectionSELinuxSecurityContextRRtjointmaptchrR(R R!R"R#tcontext((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyRQs
cCstt||S(s  Return command of D-Bus sender (RR(R R!((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyR_scCstt||S(N(RR(R R!((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyRdsc Cs|dkr|}n}t|tjr6t|}n\t|tjrltr]|jdn	t|}n&trt|tj	rt|}nt|tj
rt|}nt|tjs2t|tjs2t|tj
s2t|tjs2t|tjs2t|tjs2t|tjrAt|}nQt|tjrbt|}n0t|tjrg|D]}t|^q{}nt|tjrtg|D]}t|^q}nt|tjrd|jD}nt|tsst|tsst|tsst|tsst|tsst|tsst|tsst|tr||}ntdt||dk	r|tkrt|tsb|tkrt|tsb|tkrt|tsb|tkrt|tsb|tkr*t|tsb|tkrFt|tsb|tkrt|trtd|t ||fqn|S(Nsutf-8cSs+i|]!\}}t|t|qS((R(t.0tktv((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pys
<dictcomp>s	sUnhandled %ss%s is %s, expected %s(!Rt
isinstanceRtBooleantbooltStringtPY2tencodetstrt
UTF8Stringt
ObjectPathtBytetInt16tInt32tInt64tUInt16tUInt32tUInt64RtDoubletfloattArrayRtStructttuplet
Dictionarytitemstbytestlisttdictt	TypeErrortreprttype(tobjt
expected_typet
python_objtx((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyRgsV	$"(	%cCst|tjrdSt|tjr,dSt|tjrBdSt|tjrXdSt|tjrndSt|tjrdSt|tjrdSt|tj	rdSt|tj
rd	St|tjrd
St|tjrdSt|tj
r2t|jdkr$d
|jSd|jSnlt|tjrOd|jSt|tjrld|jStrt|tjrdStdt|dS(NtbtstotytntiRRtqtutttdisa(%s)sa%ss(%s)sa{%s}sUnhandled %s(R2RR3R5R:R;R<R=R>R?R@RARBRDtlent	signatureRERGR6R9RLRM(RO((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyRsBcCs|dkri}nt|ds7t|dint|d}i||<y|j|}Wntk
r|i}nXxl|jD]^\}}it|d6|||<||kr|||||d<qd|||d<qWdS(Nt_fw_dbus_propertiesRNtaccesstread(RthasattrtsetattrtgetattrtGetAllRRHR(ROt	interfaceR`tdipt_dicttkeytvalue((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyR	s	


c
Cs:tj|}t|dr
x|jdD]}|jdr.|jd|kr.i}t|drt|d}n||krxu||jD]`\}}|jd}|j	d||j	d|d|j	d|d|j
|qWqq.q.Wntj|j
|j
}	|j|	S(NR_RftnametpropertyRNR`(RtparseStringRbtgetElementsByTagNamethasAttributetgetAttributeRdRHt
createElementtsetAttributetappendChildRtdebug10ttoxmltunlink(
ROtdataRftdoctnodeRgRiRjtproptnew_data((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyR
s&
(t__all__RR&tsystxml.domRtfirewall.core.loggerRtversionR6RRRRRRRRRRR	R
(((s7/usr/lib/python2.7/site-packages/firewall/dbus_utils.pyt<module>s*					
	
					0	%