Make it possible to try authentication methods that require no text input before prompting for a password. #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #36
This PR adds two variables
g:suda#try_no_text_input_auth
andg:suda#try_no_text_input_auth_prompt
that make it possible to try authentication methods that require no text input before prompting for a password. Other included changes are listed below:unsilent
is prepended to:echo
and:echomsg
calls because of this reason. Withoutunsilent
messages aren't shown when this plugin handles file reading.dd
is used instead ofcat
with shell redirection to read a file in Unix-like operating systems and write it to the temporary files. This change is introduced because even if called with-p ''
,sudo
may use PAM modules that write messages to stdout (likepam_fprintd.so
in Linux), which, whencat
with shell redirection is used, also get redirected into the temporary file.dd
can write to the temporary file directly, so it can solve the aforementioned problem. I think it is safe to assume temporary files created by callingwritefile()
ontempname()
is writable when usingsudo
.:echohl None
is added to the end ofs:echomsg_exception()
.s:strip_prefix()
removes allsuda://
prefixes instead of just one, so both:write
and:SudaWrite
work for buffers opened using:SudaRead
.