Lock tty in sudo before the password prompt shows - #1651
Conversation
a54b0b6 to
51d0d5f
Compare
51d0d5f to
54a0bf8
Compare
54a0bf8 to
ea8850e
Compare
| None | ||
| } else { | ||
| lock_tty() | ||
| }; |
There was a problem hiding this comment.
Maybe put this above attempt_authenticate? No need to lock the tty if we aren't going to ask for a password.
Edit: Ah, this is to avoid two sudo instances asking for a password. Maybe add a comment to that effect?
There was a problem hiding this comment.
One other open question that I have: why would we be we locking /dev/tty in particular? We could lock anything arbitrary (e.g. /etc/sudoers), right. The only important thing here would be that both sudo-rs instances agree on that the lock is (and if possble: that ogsudo and sudo-rs also agree in the oddball case that they are both in a pipeline -- but that is very much a "nice to have but not important" territory).
There was a problem hiding this comment.
It doesn't look like ogsudo locks /dev/tty:
$ target/debug/sudo dash -c 'echo yes' | /bin/sudo dash -c 'sed s/yes/no/'
[sudo] password for squell: [sudo: authenticate] Password:
Replaces #1649, closes #1650