#tcsetattr

Felix Palmen :freebsd: :c64:zirias@bsd.cafe
2025-04-19

Of course, this new credentials checker in #swad needs a #tool to edit these #password files, that's currently work in progress.

I just implemented the class for reading a password, pretty simple thing from a pipe, but an "interesting" job from a #terminal. Turns out doing that portably, reliably and secure needs quite some code. 🙈

There's #getpass, but that's deprecated for good reasons (global state and not perfectly clear how it deals with #signals that could interrupt the input). And there's the sane replacement #readpassphrase in *some* systems (e.g. #FreeBSD), but that's not portable. 🙃

So, plain old #tcsetattr it is, with some signal handling on top:
github.com/Zirias/swad/commit/

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst