[GRASS-dev] db.login: interactive PW implemented

Markus Neteler neteler at itc.it
Thu Nov 16 01:45:51 EST 2006


Thanks, Glynn!
Implemented and working on Linux. The interactive password query is
now no longer echoeing the PW.

Paul: could you please make a test on Windows?
Any BSD tester around?

Markus


On Thu, Nov 16, 2006 at 12:11:54AM +0000, Glynn Clements wrote:
> 
> [I hit "send" too soon on the previous attempt.]
> 
> Markus Neteler wrote:
> 
> > when using db.login, I disliked to enter the password 
> > in cleartext on command line. I have implemented an interactive
> > password query. The behaviour is now like this:
> > 
> > Example 1: Username and password specified: 
> >   db.login user=bacava pass=secret
> > 
> > Example 2: Username and empty password specified: 
> >   db.login user=bacava pass=""
> > 
> > Example 3: Username specified, password will be queried interactively: 
> >   db.login user=bacava
> > 
> > The only thing which I don't know how to fix is that
> > G_gets() echoes the password. I wonder if we could have
> > a G_gets_silent() or something (lib/gis/gets.c).
> 
> Roughly:
> 
> 	#include <termios.h>
> 	#include <unistd.h>
> 
> 	struct termios tios, tios2;
> 	
> 	tcgetattr(STDIN_FILENO, &tios);
> 	tios2 = tios;
> 	tios2.c_lflag &= ~ECHO;
> 	tcsetattr(STDIN_FILENO, TCSAFLUSH, &tios2);
> 	
> 	/* read password */
> 	
> 	tcsetattr(STDIN_FILENO, TCSANOW, &tios);
> 
> However, BSD historically used gtty/stty instead of tc{get,set}attr,
> and some older systems used ioctl(TCGETS)/ioctl(TCSETS) (IIRC, Linux'
> tc{get,set}attr are implemented on top of the ioctl()s).
> 
> And Windows uses something completely different (conio.h, maybe?).
> 
> -- 
> Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list