Issue1628

classification
Title: getpass.getpass echoes input
Type: Severity: normal
Components: Library Versions: 2.5.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: mleinart, umairghani, zyasoft
Priority: normal Keywords:

Created on 2010-07-06.17:07:56 by umairghani, last changed 2010-10-22.01:13:57 by zyasoft.

Files
File name Uploaded Description Edit Remove
getpass.py umairghani, 2010-07-06.17:07:53 Fixed getpass.py
Messages
msg5874 (view) Author: Umair Ghani (umairghani) Date: 2010-07-06.17:07:52
The default Python getpass library uses termios, which is a shared C library object. Jython does not recognize this file, because it uses the JDK. Attempting to import termios causes the getpass module to throw an import error, forcing the default getpass (raw_input) to be called, thusly causing the plaintext password to be displayed on-screen.

In attempts to fix this issue, I instead imported java.lang.System.console, which is only available in JDK >= 1.6. (http://java.sun.com/javase/6/docs/api/java/io/Console.html#readPassword%28java.lang.String,%20java.lang.Object...%29)

I'm attaching a revised getpass module (${JYTHON_HOME}/Lib/getpass.py) which utilizes this import method.
msg5901 (view) Author: Jim Baker (zyasoft) Date: 2010-07-16.23:06:41
Perhaps this should use JLineConsole support (which would almost certainly be the default) instead; that would also work with Java 5 users.

The relevant method is http://jline.sourceforge.net/apidocs/jline/Terminal.html#disableEcho(), however we don't currently expose the Terminal object (see org.python.util.JLineConsole#reader).
msg6016 (view) Author: Jim Baker (zyasoft) Date: 2010-08-25.06:04:00
As of r7098 we now make the PythonInterpreter available in sys._jy_interpreter, so we can perform disableEcho.

This should be part of 2.5.2
msg6194 (view) Author: Jim Baker (zyasoft) Date: 2010-10-22.01:13:56
Now uses JLine support by disabling echo. This works on Java 5 too.

Fixed in r7162
History
Date User Action Args
2010-10-22 01:13:57zyasoftsetstatus: open -> closed
assignee: zyasoft
resolution: fixed
messages: + msg6194
title: getpass (unix/linux) does not work in jython 2.5.1 -> getpass.getpass echoes input
2010-08-25 06:04:00zyasoftsetpriority: normal
messages: + msg6016
2010-07-16 23:06:42zyasoftsetnosy: + zyasoft
messages: + msg5901
2010-07-06 17:48:38mleinartsetnosy: + mleinart
2010-07-06 17:07:56umairghanicreate