관리-도구
편집 파일: polkit.cpython-39.opt-1.pyc
a ��g� � @ s� d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZm Z d dl mZ d dlm Z mZ dZdZe�e�Ze eeee f f ZG dd� dej�ZG d d � d �ZdS )� N)�Dict�List�Sequence�Tuple)�AskpassHandler)�Variant�busz'/usr/lib/polkit-1/polkit-agent-helper-1z/PolkitAgentc sn e Zd Zed�� fdd�Zej�dg d��eeee eef ee e dd�dd ��Ze jjdd �dd�Z� ZS ) �.org_freedesktop_PolicyKit1_AuthenticationAgent�� responderc s t � �� || _d S �N)�super�__init__r ��selfr �� __class__� �2/usr/lib/python3.9/site-packages/cockpit/polkit.pyr . s z7org_freedesktop_PolicyKit1_AuthenticationAgent.__init__� )�sr r za{ss}r z a(sa{sv})N)� action_id�message� icon_name�details�cookie� identities�returnc � s t �d||||||� t�� }|D ]8\}} |dkr"d| v r"| d j|kr"t �d| |� qlq"t �d|� d S t�|�j} t j t| |t jj t jj d�I d H }zZz| �|�I d H W n& t jy� t �d� |�� Y n0 W |�� I d H }t �d|� n|�� I d H }t �d|� 0 d S ) Nz[BeginAuthentication: action %s, message "%s", icon %s, details %s, cookie %s, identities %rz unix-user�uidz,Authentication subject %s matches our uid %dz*Not supporting authentication as any of %s)�stdin�stdoutzCancelled authenticationzhelper exited with code %i)�logger�debug�os�geteuid�value�warning�pwd�getpwuid�pw_name�asyncioZcreate_subprocess_exec�HELPER_PATH� subprocess�PIPE�_communicate�CancelledError� terminate�wait) r r r r r r r Zmy_uidZ auth_type�subjectZ user_name�process�resr r r �begin_authentication3 s0 � � �zCorg_freedesktop_PolicyKit1_AuthenticationAgent.begin_authentication)r3 r c � sJ g }|j 2 �z63 d H W }t�d|� |�� �� �d�\}}}|�d�r�|�d�rTd}| j�d� |�|d�I d H }|� � |d u r�t�d|� t�d��t�d |� |j �|�� � |j �d � ~|j �� I d H t�d� q |dv r�|�|� q |d k�rt�d� �qFq |dk�r(t�d� �qFq t�d|� |�� �qFq 6 d S )NzRead line from helper: %s� Z PAM_PROMPTZPasswordr � z/got PAM_PROMPT %s, but do_askpass returned Nonezno password givenz1got PAM_PROMPT %s, do_askpass returned a password� z(got PAM_PROMPT, wrote password to helper)Z PAM_TEXT_INFOZ PAM_ERROR�SUCCESSzAuthentication succeeded�FAILUREzAuthentication failedz&Unknown line from helper, aborting: %s)r r! r"