+
    i  c                   s   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHtHt ^ RIHt R tR	 tRR
RRR/R lltRR
R/R llt ! R R4      t ! R R]4      t ! R R]4      t ! R R4      tR# )z>This module contains decorators for use with and without D-BusN)DBusException)FirewallError)errors)log)FirewallDBusExceptionNotAuthorizedException)uid_of_senderc                sF   a  \         P                  ! S 4      V 3R l4       pV# )zLDecorator to handle exceptions and log them. Used if not conneced
to D-Bus.
c                  s
  <  S! V / VB #   \          dK   p\        P                  ! \        P                  ! 4       4       \        P
                  ! T4        R p?R # R p?i\         d    \        P                  ! 4         R # i ; iN)r   r   debug1	traceback
format_excerror	Exception	exception)argskwargsr   funcs   *, ?/usr/lib/python3.14/site-packages/firewall/server/decorators.py_implZ handle_exceptions.<locals>._impl#   s]    	((( 	JJy++-.IIe 	MMO	s     B?AB(BB)	functoolswrapsr   r      f r   handle_exceptionsr      s'    
 __T  L    c                s|   a  \         P                  ! S 4      V 3R l4       p\        P                  ! S 4      Vn        V# )zzDecorator to handle exceptions, log and report them into D-Bus

:Raises DBusException: on a firewall error code problems.
c                  s  <  S! V / VB #   \          d   p\         P                  ! \        T4      4      pT\        P                  \        P
                  \        P                  \        P                  39   d!   \        P                  ! \        T4      4       MH\        P                  ! \        P                  ! 4       4       \        P                  ! \        T4      4       \        \        T4      4      hR p?i\         d   pThR p?i\          d/   p\        P"                  ! 4        \        \        T4      4      hR p?ii ; ir   )r   Zget_codeZstrr   ZALREADY_ENABLEDZNOT_ENABLEDZZONE_ALREADY_SETZALREADY_SETr   Zwarningr   r	   r
   r   r   r    r   r   )r   r   r   ZcodeZexr   s   *,   r   r   Z%dbus_handle_exceptions.<locals>._impl6   s    	1((( 	4 ))#e*5D&&""''""	  CJ'

9//12		#e*%'E
33 	H 	1MMO'B00	1s9    E CC44E E DE E )D;;E )r   r   inspect	signatureZ__signature__r   r   r   dbus_handle_exceptionsr   0   s;     __T1 1B "++D1ELr   is_deprecatedFsender_keywordsenderc                s,   a aaaaaa VV VVVVV3R  lpV# )c           	      s   < S'       d!   \         P                  SV P                  4       \        P                  P
                  ! S.SO5R SRSRS/SB pV! V 4      # )in_signatureout_signaturer   )dbus_service_method_deprecatedregister__name__dbusserviceZmethod)	r   dbus_decoratorr   dbus_interfacer   r   r   r    r   s	   & r   	decoratorZ&dbus_service_method.<locals>.decoratore   sn    *33NDMMR,,
 	
%
 (

 *
 
 d##r    )r'   r   r    r   r   r   r   r(   s   fffddjl r   dbus_service_methodr*   \   s    $ $ r   c                s$   a aaaa VV VVV3R  lpV# )c                 s   < S'       d!   \         P                  SV P                  4       \        P                  P
                  ! S.SO5R S/SB pV! V 4      # )r   )dbus_service_signal_deprecatedr"   r#   r$   r%   Zsignal)r   r&   r   r'   r   r   r   s   & r   r(   Z&dbus_service_signal.<locals>.decorator}   sZ    *33NDMMR,,

  
 	
 d##r   r)   )r'   r   r   r   r   r(   s   ffdjl r   dbus_service_signalr,   v   s    
$ 
$ r   c                   s@   a  ] tR t^t o RtR tR t]R 4       tRt	V t
R# )dbus_service_deprecatedJDecorator that maintains a list of deprecated methods in dbus
interfaces.
c                    Wn         R # r   	interface)selfr1      &&r   __init__Z dbus_service_deprecated.__init__   s    "r   c                sR    V P                  V P                  VP                  4       V# r   )r"   r1   r#   )r2   r   r3   r   __call__Z dbus_service_deprecated.__call__   s    dnndmm4r   c                s    V P                   P                  V4      pVf   \        4       pW0P                   V&   VP                  V4       R # r   )
deprecatedgetZsetZadd)clsr1   nameZss   &&& r   r"   Z dbus_service_deprecated.register   s9    NNy)9A()NN9%	dr   r0   N)r#   
__module____qualname____firstlineno____doc__r4   r5   classmethodr"   __static_attributes____classdictcell__Z__classdict__   @r   r-   r-      s(     #  r   r-   c                   s    ] tR t^tRt/ tRtR# )r!   r.   r)   Nr#   r:   r;   r<   r=   r6   r?   r)   r   r   r!   r!           Jr   r!   c                   s    ] tR t^tRt/ tRtR# )r+   zJDecorator that maintains a list of deprecated signals in dbus
interfaces.
r)   NrC   r)   r   r   r+   r+      rD   r   r+   c                   sX   a  ] tR t^t o RtRtRtRtRtRt	Rt
R t]R 4       tR tR	tV tR# )
dbus_polkit_require_authzDecorator factory that checks if the interface/method can be used by the
sender/user. Assumes wrapped function is a method inside a class derived
from DbusServiceObject.
zorg.freedesktop.PolicyKit1z%/org/freedesktop/PolicyKit1/Authorityz$org.freedesktop.PolicyKit1.AuthorityNc                r/   r   _polkit_auth_required)r2   Zpolkit_auth_requiredr3   r   r4   Z!dbus_polkit_require_auth.__init__   s    %9"r   c                sl    V P                   P                  V P                  4       R V n        R V n        R # r   )_busZremove_signal_receiver_bus_signal_receiver_interface_polkit)r8   r9   Z	old_ownerZ	new_owners   &&&&r   _polkit_name_owner_changedZ3dbus_polkit_require_auth._polkit_name_owner_changed   s*    ''(@(@A#'  $r   c                sl   a a \         P                  ! S4      VV 3R  l4       pS P                  Vn        V# )c            	      s  < \        S4      P                  '       g$   \        P                  ! 4       \        S4      n        \        S4      P                  '       gT   \        S4      P                  P                  \        S4      P                  R RSP                  R7      \        S4      n        \        S4      P                  '       g    \        P                  ! \        S4      P                  P                  \        S4      P                  \        S4      P                  4      \        S4      P                  4      \        S4      n        SP                  pV'       g   \        P                  ! R4      hVP                  R4      pV'       d   \        S4      P                  '       dH   \        S4      P                  P!                  RRV/3V/ ^R^<R7      w  p pV'       g   \#        VR	4      hM2\%        \        S4      P                  V4      pV^ 8w  d   \#        VR
4      hS! V / VB #   \        P                   d     Li ; i)ZNameOwnerChangedzorg.freedesktop.DBus)Zhandler_functionZsignal_namer'   Zarg0z'Not Authorized: No action_id specified.r   zsystem-bus-namer9    )ZtimeoutZpolkituid)ZtyperH   r$   Z	SystemBusrI   Zadd_signal_receiverrK   _polkit_namerJ   Z	InterfaceZ
get_object_polkit_path_polkit_interfacer    rG   r7   ZCheckAuthorizationr   r   )	r   r   Z	action_idr   ZresultZ_rM   r   r2   s	   *,     r   r   Z0dbus_polkit_require_auth.__call__.<locals>._impl   s   :???"&.."2T
:22226t*//2U2U%)$Z%J%J 2#9**	 3V 3T
/ :///	37>>T
22 J33T$Z5L5L T
44	4DJ0 22I(()RSSZZ)F:///%)$Z%A%A%T%T*VV,<=! " &U &NVQ "4YII " (T
@Cax4YFF(((; )) s   
BH* *II)r   r   rG   )r2   r   r   s   ff r   r5   Z!dbus_polkit_require_auth.__call__   s4    		1	) 
1	)f '+&@&@#r   rF   )r#   r:   r;   r<   r=   rN   rO   rP   rH   rI   rJ   r4   r>   rK   r5   r?   r@   rA   rB   r   rE   rE      sP     
 0L:L>D: % %
6 6r   rE   )rL   rL   )rL   )r=   r$   Zdbus.servicer	   r   r   Zdbus.exceptionsr    Zfirewall.errorsr   Zfirewallr   Zfirewall.core.loggerr   Zfirewall.server.dbusr   r   Zfirewall.dbus_utilsr   r   r   r*   r,   r-   r!   r+   rE   r)   r   r   <module>rQ      s    E      ) )  $ N -$)X
  4 	, *%< %< M Mr   