[Libguestfs] server: Fix reading passwords interactively.

Richard W.M. Jones
2020-06-01T10:31:19Z

https://bugzilla.redhat.com/show_bug.cgi?id=1842440

Patches 1 and 2 address fairly obvious bugs in how we handle reading
passwords from stdin.

There are other ways we may consider fixing these bugs:

 - Should password=- always open /dev/tty and ignore stdin entirely?

 - Should we make password=-0/-1/-2 work by skipping the close?  Or
   perhaps reopen the file descriptors on /dev/null after reading the
   password?  (This seems over-complicated to me, I think -0/-1/-2 is
   always likely to be a user error).

Rich.