
    i1                         d dl Z d dlZd dlZd dlZd dlZddlmZ ddlm	Z	m
Z
 d Z e
de           d Z e
de            e
d	e           d
 Z e	de           dS )    N   )errors)register_password_typeregister_protocolc                 >   |                     d          }|dk     r|}d}nS|d|         }t          j                            ||dz   d                   }|                    d          }||d         }t
          j                            |          sJ|j        t          j
        t          j                   t
          j                            |j        |          }t          j        t          |                    }|||         }|                    |           dS )a  
    Hook for "config-file://". The protocol_arg is expected to be the name of a
    file containing one or more configurations. An optional "key" parameter is
    allowed which will choose a configuration from a set of configurations
    stored in the file.
    ?r   Nr   key)findurllibparseparse_qsgetospathisabs
config_dirr   
_raise_errERR_NO_CONFIG_DIRjoinjsonloadopenset_from_config)protocolprotocol_argconnect_paramspos	file_namer	   argsconfigs           f/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/oracledb/builtin_hooks.pyconfig_provider_file_hookr"   )   s    

C
 
 C
Qww 	 #&	|$$\#'))%<==hhuoo?a&C7==## G$,f6777GLL!:IFF	YtI''F
""6*****    zconfig-filec                 .    d}d| }t          |          )a  
    Default hook for LDAP which simply points the user to the documentation
    which explains how they can write their own hook for LDAP.
    This hook is needed for python-oracledb Thin mode,or when
    defaults.thick_mode_dsn_passthrough is False in Thick mode.
    zjhttps://python-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#ldap-directory-namingzXTo use an LDAP URL in python-oracledb, register an LDAP resolution function as shown in )	Exception)r   argparamsdoc_urlmessages        r!   	ldap_hookr*   G   s7    	E 
	F<C	F 	F  G

r#   ldapldapsc                     t          j        d           t          j        | d                                                                                   S )z~
    Hook for password type "base64". The key "value" in the supplied args is
    expected to be a base64-encoded string.
    z%base64 encoded passwords are insecurevalue)warningswarnbase64	b64decodeencodedecode)r   s    r!   password_type_base64_hookr5   ]   sB    
 M9:::DM002233::<<<r#   r1   )r1   r   r   urllib.parser   r/    r   utilsr   r   r"   r*   r5    r#   r!   <module>r:      s   >   				            < < < < < < < <+ + +6  -!: ; ; ;  $  &) $ $ $  '9 % % %= = =  x!: ; ; ; ; ;r#   