Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to try authentication methods that require no text input before prompting for a password. #38

Closed
wants to merge 6 commits into from

Conversation

zeertzjq
Copy link
Contributor

@zeertzjq zeertzjq commented Feb 20, 2021

Resolves: #36

This PR adds two variables g:suda#try_no_text_input_auth and g: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. Without unsilent messages aren't shown when this plugin handles file reading.
  • dd is used instead of cat 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 (like pam_fprintd.so in Linux), which, when cat 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 calling writefile() on tempname() is writable when using sudo.
  • :echohl None is added to the end of s:echomsg_exception().
  • s:strip_prefix() removes all suda:// prefixes instead of just one, so both :write and :SudaWrite work for buffers opened using :SudaRead.

@zeertzjq
Copy link
Contributor Author

zeertzjq commented Apr 3, 2021

Although this solution works, it is still somewhat hacky. Since dd doesn't need to read from stdin, an better solution may be to allow using an external interactive terminal emulator or tmux. I'll make another PR when I have time to work on this. I may no longer have time to work on this.

@zeertzjq zeertzjq closed this Apr 3, 2021
@zeertzjq zeertzjq deleted the try-no-text-input-auth branch July 21, 2021 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prompted for password even if non is required
1 participant