VULN_CHECK_I913V6 Gi>ddlmZddlZddlZddlZddlZddlZddlZ ddl m Z ddl Z ddl Z ddlmZddlmZddlmZddlmZddlmZdd lmZ dd lmZd Ze j8j;Zd ZGddej@Z!y#e$r dd lmZY@wxYw)) interfacesN)ismethod)polkit)GLib) FunctionType) DBusException) ErrorMessagegetfullargspecct|SNr )funcs @/usr/lib/python3.12/site-packages/tuned/exports/dbus_exporter.py getargspecrs  )rct|dd}|nOt|dddvrd|jjz}n&d|jd|jj}t |t r|j }n/djtj|j|}t|||}|js|j|yy)N_dbus_error_name __module__)r__main__zorg.freedesktop.DBus.Python.%szorg.freedesktop.DBus.Python..) getattr __class____name__r isinstancer get_dbus_messagejoin tracebackformat_exception_onlyr get_no_reply send_message) connectionmessage exceptionnamecontentsreplys r_method_reply_errorr)$s 90$ 7D  L" -1A A/)2E2E2N2NN B7@6J6JIL_L_LhLhi)]+--/779::9;N;N  $ 1E    !& "rceZdZdZdZedZedZedZdZ dZ dZ dd Z d Z d Zd ZdZdZdZy ) DBusExportera+ Export method calls through DBus Interface. We take a method to be exported and create a simple wrapper function to call it. This is required as we need the original function to be bound to the original object instance. While the wrapper will be bound to an object we dynamically construct. cNtjtjk7rtt j _t jjjdd|_ d|_ i|_ t|_||_||_||_||_d|_d|_t+|_t/j0t.j2}t5j6|_t/j.t.j2|y)NT)set_as_default)loggetEffectiveLevelloggingDEBUGr)dbusservicemainloopglib DBusGMainLoop_dbus_object_cls _dbus_object _dbus_methodsset_signals _bus_name_interface_name _object_name _namespace_thread _bus_objectr_polkitsignal getsignalSIGINTrMainLoop _main_loop)selfbus_nameinterface_name object_name namespacesignal_handlers r__init__zDBusExporter.__init__Bs   -&94<<#--""$"7$$$%$-$.'$!$$/$,$$,##FMM2.MMO$/-- ~.rc|jSr)r<rHs rrIzDBusExporter.bus_name`s rc|jSr)r=rPs rrJzDBusExporter.interface_nameds  rc|jSr)r>rPs rrKzDBusExporter.object_namehs  rc|jduSr)r@rPs rrunningzDBusExporter.runningls T !!rc6dj|jdjt|jj }t |dt|jzd}t|jdt|j}|S)Nz2def {name}({args}): return wrapper({args}) z, )r&argszexecr) formatrrr__func__rVcompilelenr9r co_constslocals)rHmethodwrappersourcecoders r_prepare_for_dbuszDBusExporter._prepare_for_dbusos{  f&// *V__2M2R2R(SfT  -D4F4F0GG P$ dnnQ'6?? C$ +rcd|jdz|z}|d}tjd|d|d|jj ||}|}|dk(rtjd|d|d|S|d k(rtj d |d|d |S|d k(r0tj d|d|d t|dddgz}|S|dk(r0tj d|d|dt|dddgz}|Stjd|d|dt|dddgz}|S)Nrz#checking authorization for action 'z' requested by caller ''rzaction 'z'' was successfully authorized by polkitzpolkit error, but action 'z0' was successfully authorized by fallback methodrz)' wasn't authorized, ignoring the requestrzpolkit error and action 'z<' wasn't authorized by fallback method, ignoring the requestzDpolkit error and unable to use fallback method to authorize action 'z', ignoring the request) r?r.debugrBcheck_authorizationwarninginfolisterror)rH action_namerV action_idcallerret args_copys r _polkit_authzDBusExporter._polkit_auth}saoo#k1) 8&))QZ\b cd ((;#)AX99]fhn op  ax;;{DFLMN  ax88^gio pqD"I"%9   by;;FOQWXYD"I"%9 99JSU[\]D"I"%9 rNc@ts tdj}|jvr tdxs|fd}j |}t j jj||d|}|j|<y)N#Only bound methods can be exported.*Method with this name is already exported.c6jg|i|Sr)rr)ownerrVkwargsrmr^rHs r auth_wrapperz)DBusExporter.export..auth_wrappers& #$##K7$7 B6 BBrro)sender_keyword) r Exceptionrr9rbr2r3r^r=)rHr^ in_signature out_signaturerm method_nameryr_s`` ` rexportzDBusExporter.exports &  8 99+D&&& ? @@*{+C  " "6< 8' LL   4 4lMdl  mnu v'$+$[!rc\ts tdj}||jvr tdfd}|j |}t j j|j||}||j|<|jj|y)Nrtruc|i|Sr)rwrVrxr^s rr_z$DBusExporter.signal..wrappers $ !& !!r) rr{rr9rbr2r3rCr=r;add)rHr^r}r~r_s ` rrCzDBusExporter.signals &  8 99+D&&& ? @@"  " "67 3' LL   4 4m DW M'$+$[!--K rcd}||jvs |jd} t|j|}|rt d|z|i|y#t$rd}Y&wxYw)NFTzSignal '%s' doesn't exist.)r;rArAttributeErrorr{)rHrCrVrxerrr^s r send_signalzDBusExporter.send_signalss # 4== D$4$4$< 3 D$$f -6 /&8 99 46  3sA AAc|j tddt|z}t|tj j f|j}||_y)Nz%The exporter class was already build.zDBusExporter_%d)r7r{idtyper2r3Objectr9)rH unique_nameclss r_construct_dbus_object_classz)DBusExporter._construct_dbus_object_classsQ & : ;;!BtH,+ [4<<..0$2D2DE#$rc|jry|j|j|jt j }tj j|j|}|j||j||_ tj|j|_|jjy)N)target)rTr7rstopr2 SystemBusr3BusNamer<r>rA threadingThread _thread_coder@start)rHbusrIs rrzDBusExporter.starts \\^  "$$&))+ # \\ ! !$..# 6(**30A0A8L$!!):):;$,,,rc|jW|jjr<|jj|jj d|_yyyr)r@is_aliverGquitrrPs rrzDBusExporter.stopsJ \\$,,"7"7"9??<<4<#:rcJ|jj|`d|_yr)rGrunrArPs rrzDBusExporter._thread_codes // $rr)rr __qualname____doc__rNpropertyrIrJrKrTrbrrrrCrrrrrrrrr+r+8sz/<      " *,"!"   rr+)"rr dbus.servicer2dbus.mainloop.glibdbus.exceptionsrrC tuned.logstuned tuned.constsconstsrr0inspectrtuned.utils.polkitr gi.repositoryrtypesrr dbus.lowlevelr r r ImportErrorlogsgetr.r)ExporterInterfacer+rrrrs %)&  $ jjnn '(h://h=  s B BB