+
    i!  c                   s    ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtH	t	 ^ RI
Ht ^ RIHtHt RtRtRt]P$                  ! ]4      t]	]]]]3,          3,          t ! R R	]P.                  4      t ! R
 R4      tR# )i    N)DictListSequenceTupleAskpassHandler)Variantbusz/run/polkit/agent-helper.socketz'/usr/lib/polkit-1/polkit-agent-helper-1z/PolkitAgentc                   s   a a ] tR t^%t oV3R lV 3R llt]P                  P                  R. RO4      V3R lR l4       tV3R lR lt	V3R lR	 lt
V3R
 lR ltRtVtV ;t# ).org_freedesktop_PolicyKit1_AuthenticationAgentc                    < V ^8  d   QhRS[ /#    	responderr   Zformat__classdict__   "3/usr/lib/python3.14/site-packages/cockpit/polkit.py__annotate__;org_freedesktop_PolicyKit1_AuthenticationAgent.__annotate__&   s     # #. #    c                s0   < \         SV `  4        Wn        R # N)Zsuper__init__r   )selfr   	__class__s   &&r   r   Z7org_freedesktop_PolicyKit1_AuthenticationAgent.__init__&   s    "r    c                sh   < V ^8  d   QhRS[ RS[ RS[ RS[S[ S[ 3,          RS[ RS[S[,          RR/# )	r   	action_idmessage	icon_namedetailscookie
identitiesreturnN)strr    r   Identityr   r   r   r   r   ,   sZ     D DC D# DRU D,0cNDDGDU]^fUgDlpDr   c           	     s,  "   \         P                  R WW4WV4       \        P                  ! 4       pV FG  w  rVR8X  g   K  RV	9   g   K  V	R,          P                  V8X  g   K1  \         P                  RW4        M	  \         P                  RV4       R# \        P                  ! V4      P                  p
 V P                  W4      G Rj  xL
  R#  L  \         d4    \         P                  R4       T P                  Y4      G Rj  xL 
   R# i ; i5i)z[BeginAuthentication: action %s, message "%s", icon %s, details %s, cookie %s, identities %rz	unix-userZuidz,Authentication subject %s matches our uid %dz*Not supporting authentication as any of %sNz:Socket helper not available, falling back to legacy helper)loggerdebugosZgeteuidvaluewarningpwdZgetpwuidZpw_name_authenticate_socketOSError_authenticate_suid_helper)r   r   r   r   r   r   r   Zmy_uidZ	auth_typesubject	user_names   &&&&&&&    r   begin_authenticationZCorg_freedesktop_PolicyKit1_AuthenticationAgent.begin_authentication+   s      	rV	Q $. YK'EW,<AUAUY_A_KW] %/
 NNGTLL(00		D++I>>> 	DLLUV00CCC	DsZ   9D D	D#AD6C 
CC DC 4DD
DDDDc                *   < V ^8  d   QhRS[ RS[ RR/# r   r,   r   r   Nr    r   r   r   r   r   E   s"     < < <c <d <r   c                sF  "   \         P                  R\        4       \        P                  ! \        W\        P
                  P                  \        P
                  P                  R7      G Rj  xL
 pVP                  f   Q hVP                  f   Q h V P                  VP                  VP                  4      G Rj  xL
   VP                  4        VP                  4       G Rj  xL
 p\         P                  RV4       R#  L LG  \        P                   d    \         P                  R4        Lqi ; i  \         d     Lqi ; i La   TP                  4        M  \         d     Mi ; iTP                  4       G Rj  xL 
 p\         P                  RT4       i ; i5i)z.Authenticate using legacy setuid helper binaryz!Trying legacy polkit helper at %s)stdinstdoutNCancelled authenticationzhelper exited with code %i)r"   r#   HELPER_PATHasyncioZcreate_subprocess_execZ
subprocessZPIPEr1   r2   _communicateCancelledErrorZ	terminateZProcessLookupErrorZwait)r   r,   r   ZprocessZres   &&&  r   r*   ZHorg_freedesktop_PolicyKit1_AuthenticationAgent._authenticate_suid_helperE   sJ    8+F66{I=D=O=O=T=T>E>P>P>U>UW W }}(((~~)))
	<##GMM7>>BBB!!#  &CLL5s;!W C%% 	5LL34	5
 & &	!!#% &&CLL5s;s   A,F!.D/$F!)D =D>D D7 F!&E'F!D *D41E
 3D44E
 7EF!EF!
FEFE+(F*E++FFFF!c                r.   r/   r0   r   r   r   r   r   Z   s"     5 5C 5 5 5r   c                s  "   \         P                  R\        4       \        P                  ! \        4      G Rj  xL
 w  r4 VP                  V RV R2P                  4       4       VP                  4       G Rj  xL
  V P                  WC4      G Rj  xL
  VP                  4        VP                  4       G Rj  xL
  \         P                  R4       R#  L L^ LG  \        P                   d    \         P                  R4        Lqi ; i LQ  TP                  4        TP                  4       G Rj  xL 
  \         P                  R4       i ; i5i)z:Authenticate using socket-activated helper (polkit >= 127)z+Trying socket-activated polkit helper at %sN
r3   zsocket connection closed)r"   r#   HELPER_SOCKETr5   Zopen_unix_connectionwriteencodedrainr6   r7   ZcloseZwait_closed)r   r,   r   ZreaderZwriterr8   r   r(   ZCorg_freedesktop_PolicyKit1_AuthenticationAgent._authenticate_socketZ   s     BMR&;;MJJ	5LLI;b3::<=,,.  ##F333 LLN$$&&&LL34 K !3%% 	5LL34	5 ' LLN$$&&&LL34s   8ECE8C :C;C CC #E;D<EC C *D
D 	D

D E$E3D64EEc                sR   < V ^8  d   QhRS[ P                  RS[ P                  RR/# )r   r1   r2   r   N)r5   ZStreamWriterZStreamReaderr   r   r   r   r   k   s/     $ $(<(< $gFZFZ $_c $r   c                s  "   . pV  R j  xL
  p\         P                  RV4       VP                  4       P                  4       P	                  R4      w  rVpVP                  R4      '       Ed   VP                  R4      '       d   RpV P                  P                  RP                  V4      VR4      G R j  xL
 pVP                  4        Vf-   \         P                  RV4       \        P                  ! R4      h\         P                  R	V4       VP                  VP                  4       4       VP                  R
4       ?VP                  4       G R j  xL
  \         P                  R4       EKl  VR9   d   VP                  V4       EK  VR8X  d   \         P                  R4        R # VR8X  d   \         P!                  R4        R # \         P!                  RV4        R #  EL EL1 LEDR # 5i)NzRead line from helper: %sZ Z
PAM_PROMPTZPasswordr   r9   z/got PAM_PROMPT %s, but do_askpass returned Nonezno password givenz1got PAM_PROMPT %s, do_askpass returned a passwords   
z(got PAM_PROMPT, wrote password to helperZSUCCESSzAuthentication succeededZFAILUREzAuthentication failedz&Unknown line from helper, aborting: %s)ZPAM_TEXT_INFOZ	PAM_ERROR)r"   r#   ZstripZdecodeZ	partitionZ
startswithr   Z
do_askpassZjoinZclearr5   r7   r;   r<   r=   Zappendr&   )	r   r1   r2   ZmessagesZlineZcommandZ_r%   Zpasswds	   &&&      r   r6   Z;org_freedesktop_PolicyKit1_AuthenticationAgent._communicatek   s       !	 !	$LL4d; $

 3 3 5 ? ? DG !!,// ##J//E  $~~8889LeUWXX >LL!RTYZ!001DEEPRWXFMMO,E"kkm##GH::&I%78I%67GNC!	 Y $+ !sR   G1G-G%G-A6G11G17G(8BG1G+BG1%G-(G1+G1-G1)r   )sr>   r>   za{ss}r>   z	a(sa{sv}))__name__
__module____qualname____firstlineno__r   r   Z	InterfaceZMethodr-   r*   r(   r6   __static_attributes____classdictcell__Z__classcell__)r   r   s   @@r   r   r   %   s[     # #
 	]]"HID JD2< <*5 5"$ $ $r   r   c                   sB   a  ] tR t^t o RtV 3R lR ltR tR tRtV t	R# )PolkitAgentzuRegister polkit agent when required

Use this as a context manager to ensure that the agent gets unregistered again.
c                r	   r
   r   r   r   r   r   ZPolkitAgent.__annotate__   s      . r   c                s     Wn         R V n        R # r   )r   
agent_slot)r   r   s   &&r   r   ZPolkitAgent.__init__   s    "r   c           
     s  "    \         P                  P                  4       V n         RR\        \        P                  R,          R4      /3T n
        \        T P                  4      pT P                  P                  \         T4      T n        \$        P&                  ! \$        P(                  R4      pT P                  P+                  RRR	R
RT P                  T\         4      G Rj  xL
  \
        P                  RT P                  T4       T #   \         d#   p\
        P                  R T4       T u Rp?# Rp?ii ; i  \         d    \
        P                  R4       T u # i ; i L5i)z>cannot connect to system bus, not registering polkit agent: %sNzunix-sessionz
session-idZXDG_SESSION_IDr>   z4XDG_SESSION_ID not set, not registering polkit agentorg.freedesktop.PolicyKit1%/org/freedesktop/PolicyKit1/Authority$org.freedesktop.PolicyKit1.AuthorityZRegisterAuthenticationAgentz
(sa{sv})ssz%Registered agent for %r and locale %s)r   ZBusZdefault_system
system_busr)   r"   r&   r   r$   Zenvironr+   ZKeyErrorr#   r   r   Z
add_objectAGENT_DBUS_PATHrF   localeZ	setlocaleZLC_MESSAGEScall_method_async)r   ZeZagent_objectZlocale_names   &   r   
__aenter__ZPolkitAgent.__aenter__   s)    	!gg446DO
	*\72::N^C_ad;e,fgDL
 FdnnU//44_lS &&v'9'94@oo//(32)LL+8 	8 	8 	<dllKX1  	NN[]^_K	  	LLOPK		8s^   E&#D *D< BE&$E$%'E&D9D4.D9/E&4D99E&<"E!E& E!!E&c           	     s  "   V P                   '       dt   V P                  P                  R RRRRV P                  \        4      G Rj  xL
  V P                   P                  4        \        P                  RV P                  4       R# R#  LB5i)rG   rH   rI   ZUnregisterAuthenticationAgentz	(sa{sv})sNzUnregistered agent for %r)rF   rJ   rM   r+   rK   Zcancelr"   r#   )r   Z	_exc_typeZ
_exc_valueZ
_tracebacks   &&&&r   	__aexit__ZPolkitAgent.__aexit__   sq     ???//33,76/o/ / / OO""$LL4dllC /s   ABB
AB)rF   r   r+   rJ   N)
r?   r@   rA   rB   Z__doc__r   rN   rO   rC   rD   )r   s   @r   rE   rE      s%      :
D 
Dr   rE   )r5   rL   Zloggingr$   r'   Ztypingr    r   r   r   Zcockpit._vendor.fernyr   Zcockpit._vendor.systemd_ctypesr   r   r:   r4   rK   Z	getLoggerr?   r"   r    r!   ZObjectr   rE   ) r   r   <module>rP      s|       	 
 . . 0 7 2 8 			8	$d3<(()jSZZ jZ0D 0Dr   