[Libvir] Use of getpass

Daniel P. Berrange berrange at redhat.com
Thu Dec 6 14:36:04 UTC 2007


On Thu, Dec 06, 2007 at 02:28:58PM +0000, Richard W.M. Jones wrote:
> We recently added a call to getpass(3) function.  Needless to say this 
> doesn't exist on Windows.  More seriously the man-page for getpass on 
> Linux has strong exhortations not to use the function.
> 
> NAME
>        getpass - get a password
> 
> SYNOPSIS
>        #include <unistd.h>
> 
>        char *getpass( const char * prompt );
> 
> DESCRIPTION
>        This function is obsolete.  Do not use it.
> 
>        The  getpass() function opens /dev/tty (the controlling terminal 
> of the
>        process), outputs the string prompt, turns off echoing, reads 
> one  line
>        (the  "password"),  restores  the  terminal  state  and closes 
> /dev/tty
>        again.
> [...]
> CONFORMING TO
>        Present in SUSv2, but marked LEGACY.  Removed in POSIX.1-2001.
> 
> Should we remove it?  Replace it?

I'm open to suggestions? I'm not aware of any 'easy' functions to do
the same thing. Could write a whole tonne of sick code which uses the
tcgetattr/tcsetattr() apis to turn off echoing on stdin, but getpass
was simpler. Maybe gnulib has something we can use ?


Regards,
Dan
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list