
    Vh                    J    d dl mZ dZd dlZd dlmZ d dlmZ  G d de      Zy)    )annotationsa  
name: ksu
short_description: Kerberos substitute user
description:
  - This become plugins allows your remote/login user to execute commands as another user using the C(ksu) utility.
author: Ansible Core Team
options:
  become_user:
    description: User you 'become' to execute the task.
    type: string
    ini:
      - section: privilege_escalation
        key: become_user
      - section: ksu_become_plugin
        key: user
    vars:
      - name: ansible_become_user
      - name: ansible_ksu_user
    env:
      - name: ANSIBLE_BECOME_USER
      - name: ANSIBLE_KSU_USER
    required: true
  become_exe:
    description: C(ksu) executable.
    type: string
    default: ksu
    ini:
      - section: privilege_escalation
        key: become_exe
      - section: ksu_become_plugin
        key: executable
    vars:
      - name: ansible_become_exe
      - name: ansible_ksu_exe
    env:
      - name: ANSIBLE_BECOME_EXE
      - name: ANSIBLE_KSU_EXE
  become_flags:
    description: Options to pass to C(ksu).
    type: string
    default: ''
    ini:
      - section: privilege_escalation
        key: become_flags
      - section: ksu_become_plugin
        key: flags
    vars:
      - name: ansible_become_flags
      - name: ansible_ksu_flags
    env:
      - name: ANSIBLE_BECOME_FLAGS
      - name: ANSIBLE_KSU_FLAGS
  become_pass:
    description: C(ksu) password.
    type: string
    required: false
    vars:
      - name: ansible_ksu_pass
      - name: ansible_become_pass
      - name: ansible_become_password
    env:
      - name: ANSIBLE_BECOME_PASS
      - name: ANSIBLE_KSU_PASS
    ini:
      - section: ksu_become_plugin
        key: password
  prompt_l10n:
    description:
      - List of localized strings to match for prompt detection.
      - If empty we will use the built in one.
    type: list
    elements: string
    default: []
    ini:
      - section: ksu_become_plugin
        key: localized_prompts
    vars:
      - name: ansible_ksu_prompt_l10n
    env:
      - name: ANSIBLE_KSU_PROMPT_L10N
Nto_bytes)
BecomeBasec                  0     e Zd ZdZdZdZd Z fdZ xZS )BecomeModulezcommunity.general.ksu)zPassword incorrect)zNo password givenc                    | j                  d      xs dg}dj                  d |D              }t        t        j                  ||            S )z; checks if the expected password prompt exists in b_output prompt_l10nzKerberos password for .*@.*:   |c              3  2   K   | ]  }t        |        y w)Nr   ).0ps     h/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/become/ksu.py	<genexpr>z5BecomeModule.check_password_prompt.<locals>.<genexpr>k   s     :QXa[:s   )
get_optionjoinboolrematch)selfb_outputpromptsb_prompts       r   check_password_promptz"BecomeModule.check_password_promptg   sE     //-0T5S4T99:'::BHHXx011    c           
         t         t        |   ||       d| _        |s|S | j	                  d      }| j	                  d      }| j	                  d      }| d| d| d| j                  ||       dS )NT
become_exebecome_flagsbecome_user z -e )superr   build_become_commandpromptr   _build_success_command)r   cmdshellexeflagsuser	__class__s         r   r"   z!BecomeModule.build_become_commando   s}    lD6sEB Jool+/}-avQugT$*E*Ec5*Q)RRSTTr   )	__name__
__module____qualname__namefailmissingr   r"   __classcell__)r*   s   @r   r   r   _   s%    "D #D$G2U Ur   r   )	
__future__r   DOCUMENTATIONr   +ansible.module_utils.common.text.convertersr   ansible.plugins.becomer   r    r   r   <module>r7      s,   
 #Pd 
 @ -U: Ur   