| Server IP : 198.38.94.13 / Your IP : 216.73.217.33 Web Server : Apache System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : revivere ( 1140) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib/python3.9/site-packages/ipapython/__pycache__/ |
Upload File : |
a
�ji� � @ sl d Z ddlZddlZddlmZmZ ejr.eZe� d�Z
e� d�Zddd�Zdd � Z
ejG d
d� d��ZdS )
zC
classes/utils for Kerberos principal name validation/manipulation
� N)�
escape_seq�unescape_seqz(?<!\\)@z(?<!\\)/c C s^ t �| �}t|�dkrtd��|d }z|d }W n" tyT |du rLdn|}Y n0 ||fS )aS
split principal to the <principal_name>, <realm> components
:param principal: unicode representation of principal
:param realm: if not None, replace the parsed realm with the specified one
:returns: tuple containing the principal name and realm
realm will be `None` if no realm was found in the input string
� z)Principal is not in <name>@<realm> formatr � N)�REALM_SPLIT_RE�split�len�
ValueError�
IndexError)� principal�realmZrealm_and_name�principal_name�parsed_realm� r �6/usr/lib/python3.9/site-packages/ipapython/kerberos.py�parse_princ_name_and_realm s
�r c C s t t�| ��S )a�
Split principal name (without realm) into the components
NOTE: operates on the following RFC 1510 types:
* NT-PRINCIPAL
* NT-SRV-INST
* NT-SRV-HST
Enterprise principals (NT-ENTERPRISE, see RFC 6806) are also handled
:param principal_name: unicode representation of principal name
:returns: tuple of individual components (i.e. primary name for
NT-PRINCIPAL and NT-ENTERPRISE, primary name and instance for others)
)�tuple�COMPONENT_SPLIT_REr )r
r r r �split_principal_name- s r c @ s� e Zd ZdZd)dd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
dd� Zd*dd�Ze
dd� �Ze
dd� �Ze
dd� �Ze
dd� �Ze
dd� �Ze
dd � �Ze
d!d"� �Ze
d#d$� �Zd%d&� Zd'd(� ZdS )+� PrincipalzJ
Container for the principal name and realm according to RFC 1510
Nc C sv t |t�rtd�|���nXt |t�r:| �||�\| _| _n8t |t�rb|j| _|d u rZ|jn|| _nt |�| _|| _d S )Nz1Cannot create a principal object from bytes: {!r})
�
isinstance�bytes� TypeError�format�str�_parse_from_text�
componentsr r r )�selfr r r r r �__init__D s
��
�
zPrincipal.__init__c C s&