
    Vh                    R    d dl mZ dZd dlZd dlZd dlmZ d dlmZ  G d de      Z	y)    )annotationsaV  
    name: su
    short_description: Substitute User
    description:
        - This become plugin allows your remote/login user to execute commands as another user via the su utility.
    author: ansible (@core)
    version_added: "2.8"
    options:
        become_user:
            description: User you 'become' to execute the task
            default: root
            ini:
              - section: privilege_escalation
                key: become_user
              - section: su_become_plugin
                key: user
            vars:
              - name: ansible_become_user
              - name: ansible_su_user
            env:
              - name: ANSIBLE_BECOME_USER
              - name: ANSIBLE_SU_USER
            keyword:
              - name: become_user
        become_exe:
            description: Su executable
            default: su
            ini:
              - section: privilege_escalation
                key: become_exe
              - section: su_become_plugin
                key: executable
            vars:
              - name: ansible_become_exe
              - name: ansible_su_exe
            env:
              - name: ANSIBLE_BECOME_EXE
              - name: ANSIBLE_SU_EXE
            keyword:
              - name: become_exe
        become_flags:
            description: Options to pass to su
            default: ''
            ini:
              - section: privilege_escalation
                key: become_flags
              - section: su_become_plugin
                key: flags
            vars:
              - name: ansible_become_flags
              - name: ansible_su_flags
            env:
              - name: ANSIBLE_BECOME_FLAGS
              - name: ANSIBLE_SU_FLAGS
            keyword:
              - name: become_flags
        become_pass:
            description: Password to pass to su
            required: False
            vars:
              - name: ansible_become_password
              - name: ansible_become_pass
              - name: ansible_su_pass
            env:
              - name: ANSIBLE_BECOME_PASS
              - name: ANSIBLE_SU_PASS
            ini:
              - section: su_become_plugin
                key: password
        prompt_l10n:
            description:
                - List of localized strings to match for prompt detection
                - If empty we'll use the built in one
                - Do NOT add a colon (:) to your custom entries. Ansible adds a colon at the end of each prompt;
                  if you add another one in your string, your prompt will fail with a "Timeout" error.
            default: []
            type: list
            elements: string
            ini:
              - section: su_become_plugin
                key: localized_prompts
            vars:
              - name: ansible_su_prompt_l10n
            env:
              - name: ANSIBLE_SU_PROMPT_L10N
Nto_bytes)
BecomeBasec                  4     e Zd ZdZdZg dZd Z fdZ xZS )BecomeModulesu)zAuthentication failure) Passwordu   암호u   パスワードAdgangskodeu   ContraseñaContrasenyau   HasłoHeslou   Jelszóu	   Lösenordu   Mật khẩuzMot de passeParolaParool	PasahitzaPassordPasswortSalasanaSandiSenha
Wachtwoordu   ססמהu   Лозинкаu   Паролаu   Парольu   गुप्तशब्दu   शब्दकूटu   సంకేతపదముu   හස්පදයu   密码u   密碼u   口令c                
   | j                  d      xs | j                  }dj                  d |D              }|t        d      z   }t	        j
                  |t        j                        }t        |j                  |            S )z; checks if the expected password prompt exists in b_output prompt_l10n   |c              3  8   K   | ]  }d t        |      z     yw)s
   (\w+\'s )?Nr   ).0ps     I/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/become/su.py	<genexpr>z5BecomeModule.check_password_prompt.<locals>.<genexpr>   s     %V~'C%Vs   u    ?(:|：) ?)flags)	
get_optionSU_PROMPT_LOCALIZATIONSjoinr   recompile
IGNORECASEboolmatch)selfb_outputpromptsb_password_stringb_su_prompt_localizations_res        r   check_password_promptz"BecomeModule.check_password_prompt   so     //-0PD4P4P II%Vg%VV-0HH')zz2C2=='Y$066x@AA    c           	     8   t         t        |   ||       d| _        |s|S | j	                  d      xs | j
                  }| j	                  d      xs d}| j	                  d      xs d}| j                  ||      }|d|d|dt        j                  |      S )NT
become_exebecome_flags become_user z -c )	superr   build_become_commandpromptr    name_build_success_commandshlexquote)r(   cmdshellexer   usersuccess_cmd	__class__s          r   r6   z!BecomeModule.build_become_command   s    lD6sEB Jool+8tyy/52}-311#u=#&tU[[5MNNr.   )	__name__
__module____qualname__r8   failr!   r-   r6   __classcell__)rA   s   @r   r   r   d   s*    D 'D!FBO Or.   r   )

__future__r   DOCUMENTATIONr#   r:   +ansible.module_utils.common.text.convertersr   ansible.plugins.becomer   r    r.   r   <module>rL      s1    #Un 
  @ -CO: COr.   