mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add a new potential su prompt
Two parts to this change: * Add a new string that requests password * Add a new glyph that can be used to separate the prompt from the user's input as it seems it can use fullwidth colon rather than colon. Fixes #17867
This commit is contained in:
parent
236c923c25
commit
188ae18b1c
1 changed files with 5 additions and 1 deletions
|
@ -117,6 +117,7 @@ b_SU_PROMPT_LOCALIZATIONS = [
|
||||||
to_bytes('හස්පදය'),
|
to_bytes('හස්පදය'),
|
||||||
to_bytes('密码'),
|
to_bytes('密码'),
|
||||||
to_bytes('密碼'),
|
to_bytes('密碼'),
|
||||||
|
to_bytes('口令'),
|
||||||
]
|
]
|
||||||
|
|
||||||
TASK_ATTRIBUTE_OVERRIDES = (
|
TASK_ATTRIBUTE_OVERRIDES = (
|
||||||
|
@ -510,7 +511,10 @@ class PlayContext(Base):
|
||||||
|
|
||||||
# passing code ref to examine prompt as simple string comparisson isn't good enough with su
|
# passing code ref to examine prompt as simple string comparisson isn't good enough with su
|
||||||
def detect_su_prompt(b_data):
|
def detect_su_prompt(b_data):
|
||||||
b_SU_PROMPT_LOCALIZATIONS_RE = re.compile(b"|".join([b'(\w+\'s )?' + x + b' ?: ?' for x in b_SU_PROMPT_LOCALIZATIONS]), flags=re.IGNORECASE)
|
b_password_string = b"|".join([b'(\w+\'s )?' + x for x in b_SU_PROMPT_LOCALIZATIONS])
|
||||||
|
# Colon or unicode fullwidth colon
|
||||||
|
b_password_string = b_password_string + to_bytes(u' ?(:|:) ?')
|
||||||
|
b_SU_PROMPT_LOCALIZATIONS_RE = re.compile(b_password_string, flags=re.IGNORECASE)
|
||||||
return bool(b_SU_PROMPT_LOCALIZATIONS_RE.match(b_data))
|
return bool(b_SU_PROMPT_LOCALIZATIONS_RE.match(b_data))
|
||||||
prompt = detect_su_prompt
|
prompt = detect_su_prompt
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue