| Server IP : 162.144.4.212 / Your IP : 216.73.216.108 Web Server : Apache System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64 User : cozeellc ( 2980) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3.9/site-packages/tuned/utils/__pycache__/ |
Upload File : |
a
�]�i� � @ s, d dl Z d dlZej�� ZG dd� d�ZdS )� Nc @ s e Zd Zdd� Zdd� ZdS )�polkitc C s4 t �� | _| jjdddd�| _t j| jdd�| _d S )Nzorg.freedesktop.PolicyKit1z%/org/freedesktop/PolicyKit1/AuthorityT)Zfollow_name_owner_changesz$org.freedesktop.PolicyKit1.Authority)Zdbus_interface)�dbusZ SystemBus�_busZ
get_object�_proxyZ Interface�
_authority)�self� r �6/usr/lib/python3.9/site-packages/tuned/utils/polkit.py�__init__ s
zpolkit.__init__c
C s |du s|du rdS i }d}d}dd|if}z| j �|||||�d }W n� tjjtf� y� } z�t�d| � z| j� |�} W nB tjjy� } z&t�d | � W Y d}~W Y d}~d
S d}~0 0 | dkr�W Y d}~dS W Y d}~dS W Y d}~n
d}~0 0 |�rdS dS )
z�Check authorization, return codes:
1 - authorized
2 - polkit error, but authorized with fallback method
0 - unauthorized
-1 - polkit error and unauthorized by the fallback method
-2 - polkit error and unable to use the fallback method
NF� � zsystem-bus-name�namer zerror querying polkit: %sz-error using fallback authorization method: %s���� ���)
r ZCheckAuthorizationr �
exceptionsZ
DBusException�
ValueError�log�errorr Z
get_unix_user)
r ZsenderZ action_id�details�flagsZcancellation_idZsubject�ret�e�uidr r r �check_authorization s&