File: //usr/lib/python3.6/site-packages/ipalib/__pycache__/rpc.cpython-36.pyc
3
�d[e� � @ sz d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlmZ ddlmZ ddlZddlmZ ddlZddlmZ dd lmZ dd
lmZmZmZm Z m!Z! ddl"m#Z#m$Z$ ddl%m&Z&m'Z' dd
l(m)Z* ddl+m,Z, ddl+m-Z- ddl.m/Z/ ddl0m1Z1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z? ddl@mAZA ddlBmCZC ddlDmEZE ddl"mFZF y4ddlGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQ W nF eRk
�r ddlSmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQ Y nX ejT�r6ddlUmVZV nddlWmXZV ejT�rNeYZZej[e\�Z]dZ^dZ_dd� Z`d d!� Zad"d#� Zbd$d%� ZcdLd'd(�ZddMd*d+�ZeG d,d-� d-ef�ZgdNd.d/�Zhejiejfd0d1�Zkd2d3� ZldOd4d5�ZmdPd6d7�ZnG d8d9� d9�ZoG d:d;� d;eN�ZpG d<d=� d=ep�ZqG d>d?� d?eq�ZrG d@dA� dAer�ZsG dBdC� dCes�ZtG dDdE� dEe�ZuG dFdG� dGeu�ZvG dHdI� dI�ZwG dJdK� dKeu�ZxdS )Qa`
RPC client and shared RPC client/server functionality.
This module adds some additional functionality on top of the ``xmlrpc.client``
module in the Python standard library (``xmlrpclib`` in Python 2).
For documentation on the ``xmlrpclib`` module, see:
http://docs.python.org/2/library/xmlrpclib.html
Also see the `ipaserver.rpcserver` module.
� )�absolute_import)�DecimalN)�SSLError)�x509)�DNSException)�Connectible)�LDAP_GENERALIZED_TIME_FORMAT)�errors_by_code�UnknownError�NetworkError�XMLRPCMarshallError� JSONError)�errors�capabilities)�context�
Connection)�Encoding)�ipautil)�session_storage)�Cookie)�DNSName� query_srv)�_)�create_https_connection)�KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN�KRB5KRB_AP_ERR_TKT_EXPIRED�
KRB5_FCC_PERM�KRB5_FCC_NOFILE�KRB5_CC_FORMAT�KRB5_REALM_CANT_RESOLVE�KRB5_CC_NOTFOUND�
get_principal)�DN)� Principal)�VERSION_WITHOUT_CAPABILITIES)�api)
�Binary�Fault�DateTime�dumps�loads�ServerProxy� Transport�
ProtocolError�MININT�MAXINT)�RemoteDisconnected)�
BadStatusLineZipa_sessionzX-IPA-Session-Cookiec C sF yt j| t|� W n. tk
r@ } ztt|���W Y dd}~X nX dS )z�
Given a principal create or update the session data for that
principal in the persistent secure storage.
Raises ValueError if unable to perform the action for any reason.
N)r Z
store_data�CCACHE_COOKIE_KEY� Exception�
ValueError�str)� principal�data�e� r9 �/usr/lib/python3.6/rpc.py�%update_persistent_client_session_datad s r; c C s@ yt j| t�S tk
r: } ztt|���W Y dd}~X nX dS )z�
Given a principal return the stored session data for that
principal from the persistent secure storage.
Raises ValueError if unable to perform the action for any reason.
N)r �get_datar2 r3 r4 r5 )r6 r8 r9 r9 r: �#read_persistent_client_session_dataq s r= c C sD yt j| t� W n. tk
r> } ztt|���W Y dd}~X nX dS )z�
Given a principal remove the session data for that
principal from the persistent secure storage.
Raises ValueError if unable to perform the action for any reason.
N)r Zremove_datar2 r3 r4 r5 )r6 r8 r9 r9 r: �%delete_persistent_client_session_data~ s r>