[MDEV-4021] mysql lets me login even if i press CTRL-C Created: 2013-01-10  Updated: 2013-02-22  Resolved: 2013-02-22

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.0, 5.5.28a, 5.3.11
Fix Version/s: 5.5.30

Type: Bug Priority: Trivial
Reporter: Federico Razzoli Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: upstream
Environment:

5.5, windows xp



 Description   

1) I invoke mysql with an ampty -p parameter
2) I write the password, but I DONT press enter
3) I press ctrl-c
4) I'm logged in, as if I pressed enter

This does not happen always - it depends how I invoke mysql. However, using the default Icon in the Win's start menu, this happens.

Example:

C:\Programmi\MariaDB 5.5\bin>mysql "--defaults-file=C:\Programmi\MariaDB 5.5\dat
a\my.ini" -uroot -p
Enter password: *****
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 7
Server version: 5.5.25-MariaDB mariadb.org binary distribution

This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>



 Comments   
Comment by Elena Stepanova [ 2013-01-10 ]

Hi Sergei,

While the described problem doesn't sound like a big deal, I just found out that I don't know any way out of the "Enter password" line once I pressed enter in mysql ... -p command line – neither on Windows nor on Linux. On Windows Ctrl-C works like 'Enter' (as Federico described), on Linux it's simply ignored; all the same, to quit it you have to send a request to the server which might be not what you want. So, before sending this report as a Windows oddity to Wlad, I wanted to check whether you have any comments or opinion on the matter.

(note: probably affects previous versions too, but I didn't check 5.1 or 5.2).

Comment by Sergei Golubchik [ 2013-01-10 ]

On Linux we cannot do much. That's how getpass() behaves. Quoting "man getpass"
"
While reading the password, signal generation (SIGINT, SIGQUIT, SIGSTOP, SIGTSTP) is disabled and the corresponding characters (usually control-C, control-\, control-Z and control-Y) are transmitted as part of the password
"
While we can implement our own password-reading function, I think we should stick to the behavior, standard on this platform.

On Windows, on the other hand, we have our own password-reading function, and we can treat Ctrl-C specially.

Comment by Elena Stepanova [ 2013-01-10 ]

I suppose if it's easy it would make sense to fix it (with the given priority) – let at least Windows users off the hook.

Generated at Thu Feb 08 06:53:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.