Bug 290331

Summary: stored passwords no longer used
Product: [Frameworks and Libraries] kio Reporter: Martin Koller <kollix>
Component: ftpAssignee: David Faure <faure>
Status: RESOLVED WORKSFORME    
Severity: normal CC: adawit, arthur
Priority: NOR Keywords: regression
Version: 0.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Martin Koller 2012-01-01 16:28:39 UTC
Version:           0.1 (using Devel) 
OS:                Linux

since upgrading to 4.8.rc1, when I now open an ftp:// bookmark I used a lot of times before with KDE 4.6.5, the still stored password in kwalletmanager is not used anymore.

Reproducible: Always

Steps to Reproduce:
open ftp:// bookmark and wait. Instead of being logged in (or getting the authorization dialog with already filled-in username/password, I get the authorization dialog with empty fields.

Actual Results:  
see above

Expected Results:  
see above

OS: Linux (i686) release 2.6.34.10-0.4-desktop
Compiler: gcc
openSuse 11.3
Comment 1 Martin Koller 2012-01-29 12:11:13 UTC
Still valid in 4.8.0, openSuse 12.1
Comment 2 Dawit Alemayehu 2012-02-04 15:43:22 UTC
Cannot reproduce. It works just fine here with KDE 4.8.0. Unless your login credentials have changed and as a result the login attempt with them is being rejected, you should not have this problem.

To see what the ftp ioslave is doing, follow the instructions in the link below for debug area 7102 (kio_ftp):

http://techbase.kde.org/Development/Tutorials/Debugging/Debugging_IOSlaves#GUI
Comment 3 Martin Koller 2012-02-04 18:14:41 UTC
The log from the kio_ftp is as follows:

kio_ftp(15500) Ftp::ftpResponse:     >  220 Welcome to members.aon.at.
kio_ftp(15500) Ftp::ftpResponse: resp>  220 Welcome to members.aon.at.
kio_ftp(15500) Ftp::ftpLogin: Sending Login name:  "USER anonymous"
kio_ftp(15500) Ftp::ftpSendCmd: send>  USER anonymous
kio_ftp(15500) Ftp::ftpResponse:     >
kio_ftp(15500) Ftp::ftpResponse: Cannot parse valid code from line
kio_ftp(15500) Ftp::ftpResponse: resp>
kio_ftp(15500) Ftp::closeConnection: m_bLoggedOn= false  m_bBusy= false
kio_ftp(15500) Ftp::ftpOpenConnection: host= "members.aon.at" , port= 0 , user= "" password= [password hidden]
kio_ftp(15500) Ftp::ftpResponse:     >  220 Welcome to members.aon.at.
kio_ftp(15500) Ftp::ftpResponse: resp>  220 Welcome to members.aon.at.
kio_ftp(15500) Ftp::ftpSendCmd: send>  USER anonymous
kio_ftp(15500) Ftp::ftpResponse:     >
kio_ftp(15500) Ftp::ftpResponse: Cannot parse valid code from line
kio_ftp(15500) Ftp::ftpResponse: resp>
kio_ftp(15500) Ftp::ftpLogin: Login failed:  ""
kio_ftp(15500) Ftp::ftpLogin: Prompting user for login info...

When I got the authentication dialog, the wallet was not even accessed (kwalletmanager was not running, and when I started it manually I saw a closed wallet. I use only 1 wallet).

In the wallet I search for the credentials of this ftp site and still find it below
Passwords/Maps/ftp-anonymous@members.aon.at

Another example:

kio_ftp(15583) kdemain: Starting  15583
kio_ftp(15583) Ftp::setHost: "ftp53.world4you.com" port= 0 user= "die-profihan"
kio_ftp(15583) Ftp::setHost: proxy urls: ()
kio_ftp(15583) Ftp::stat: path= "/"
kio_ftp(15583) Ftp::ftpOpenConnection: host= "ftp53.world4you.com" , port= 0 , user= "die-profihan" password= [password hidden]
kio_ftp(15583) Ftp::ftpResponse:     >  220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
kio_ftp(15583) Ftp::ftpResponse:     >  220-You are user number 1 of 400 allowed.
kio_ftp(15583) Ftp::ftpResponse:     >  220-Local time is now 19:11. Server port: 21.
kio_ftp(15583) Ftp::ftpResponse:     >  220-This is a private system - No anonymous login
kio_ftp(15583) Ftp::ftpResponse:     >  220-IPv6 connections are also welcome on this server.
kio_ftp(15583) Ftp::ftpResponse:     >  220 You will be disconnected after 15 minutes of inactivity.
kio_ftp(15583) Ftp::ftpResponse: resp>  220 You will be disconnected after 15 minutes of inactivity.
kio_ftp(15583) Ftp::ftpLogin: Prompting user for login info...


In this case the user is filled in but not the password, but also this password is still in my wallet.
Comment 4 Dawit Alemayehu 2012-02-04 23:41:23 UTC
(In reply to comment #3)
> The log from the kio_ftp is as follows:
> 
> kio_ftp(15500) Ftp::ftpResponse:     >  220 Welcome to members.aon.at.
> kio_ftp(15500) Ftp::ftpResponse: resp>  220 Welcome to members.aon.at.
> kio_ftp(15500) Ftp::ftpLogin: Sending Login name:  "USER anonymous"
> kio_ftp(15500) Ftp::ftpSendCmd: send>  USER anonymous
> kio_ftp(15500) Ftp::ftpResponse:     >
> kio_ftp(15500) Ftp::ftpResponse: Cannot parse valid code from line
> kio_ftp(15500) Ftp::ftpResponse: resp>
> kio_ftp(15500) Ftp::closeConnection: m_bLoggedOn= false  m_bBusy= false
> kio_ftp(15500) Ftp::ftpOpenConnection: host= "members.aon.at" , port= 0 , user=
> "" password= [password hidden]
> kio_ftp(15500) Ftp::ftpResponse:     >  220 Welcome to members.aon.at.
> kio_ftp(15500) Ftp::ftpResponse: resp>  220 Welcome to members.aon.at.
> kio_ftp(15500) Ftp::ftpSendCmd: send>  USER anonymous
> kio_ftp(15500) Ftp::ftpResponse:     >
> kio_ftp(15500) Ftp::ftpResponse: Cannot parse valid code from line
> kio_ftp(15500) Ftp::ftpResponse: resp>
> kio_ftp(15500) Ftp::ftpLogin: Login failed:  ""
> kio_ftp(15500) Ftp::ftpLogin: Prompting user for login info...
> 
> When I got the authentication dialog, the wallet was not even accessed
> (kwalletmanager was not running, and when I started it manually I saw a closed
> wallet. I use only 1 wallet).
> 
> In the wallet I search for the credentials of this ftp site and still find it
> below
> Passwords/Maps/ftp-anonymous@members.aon.at

This problem is easily explainable by the fact that kio_ftp's code used to incorrectly use "anonymous" as a valid user name when saving credentials for URLs where no user name was specified. Simply removing "-anonymous@" part should fix the problem. Otherwise, it will ignore that login information. But I think your problem is more than this based on what you stated below.

> Another example:
> 
> kio_ftp(15583) kdemain: Starting  15583
> kio_ftp(15583) Ftp::setHost: "ftp53.world4you.com" port= 0 user= "die-profihan"
> kio_ftp(15583) Ftp::setHost: proxy urls: ()
> kio_ftp(15583) Ftp::stat: path= "/"
> kio_ftp(15583) Ftp::ftpOpenConnection: host= "ftp53.world4you.com" , port= 0 ,
> user= "die-profihan" password= [password hidden]
> kio_ftp(15583) Ftp::ftpResponse:     >  220---------- Welcome to Pure-FTPd
> [privsep] [TLS] ----------
> kio_ftp(15583) Ftp::ftpResponse:     >  220-You are user number 1 of 400
> allowed.
> kio_ftp(15583) Ftp::ftpResponse:     >  220-Local time is now 19:11. Server
> port: 21.
> kio_ftp(15583) Ftp::ftpResponse:     >  220-This is a private system - No
> anonymous login
> kio_ftp(15583) Ftp::ftpResponse:     >  220-IPv6 connections are also welcome
> on this server.
> kio_ftp(15583) Ftp::ftpResponse:     >  220 You will be disconnected after 15
> minutes of inactivity.
> kio_ftp(15583) Ftp::ftpResponse: resp>  220 You will be disconnected after 15
> minutes of inactivity.
> kio_ftp(15583) Ftp::ftpLogin: Prompting user for login info...
> 
> 
> In this case the user is filled in but not the password, but also this password
> is still in my wallet.

This should not be the case. If the password is stored for the specified user, then it should automatically login to the ftp site. Otherwise, something else is wrong. You might want to check the kpasswdserver kded module. Simply enable the debug area for that in "kdebugdialog --fullmode" by searching for KPasswdServer.

BTW, logging into an ftp site as "ftp://ftp53.world4you.com" and "ftp://die-profihan@ftp53.world4you.com" will be completely handled differently even if you used the same username when you logged into the site using the first address, i.e. the one without the username.
Comment 5 Martin Koller 2012-02-05 12:29:40 UTC
OK, I cleaned up the anonymous entries of my wallet. I had several with and without anonymous but when I removed all with anonymous and left the others, then it works.

What I also see is that I have entries which end in :-1 and others with the same text but only without :-1 end. Don't know where this comes from, but when I simply rename an entry in the wallet from e.g. "ftp-die-profihan@ftp53.world4you.com" (which asks for the password) to "ftp-die-profihan@ftp53.world4you.com:-1" then it does not ask for the password and logs in directly.

OK, I now know how to work around/solve it, but I still think that this breaks things for other users as well. Why was the wallet entry format changed ?
Comment 6 Dawit Alemayehu 2012-02-05 14:09:22 UTC
(In reply to comment #5)
> OK, I cleaned up the anonymous entries of my wallet. I had several with and
> without anonymous but when I removed all with anonymous and left the others,
> then it works.
> 
> What I also see is that I have entries which end in :-1 and others with the
> same text but only without :-1 end. Don't know where this comes from, but when
> I simply rename an entry in the wallet from e.g.
> "ftp-die-profihan@ftp53.world4you.com" (which asks for the password) to
> "ftp-die-profihan@ftp53.world4you.com:-1" then it does not ask for the password
> and logs in directly.
> 
> OK, I now know how to work around/solve it, but I still think that this breaks
> things for other users as well. Why was the wallet entry format changed ?

It was not changed. kio_ftp just did the wrong thing and appended an internal name (anonymous) to the URL it sent to password server. That caused other bugs and when those bugs were fixed, it caused this problem. And there is no easy workaround for this because keeping the previous behavior for "compatability" will cause the other regressions. Perhaps I could

As far as the "-1" is concerned, that is the port number. The format with which the passwords are saved in KWallet is is "protocol-[username@]host:port". It has been that way since the beginning. The [username@] is optional and should be set only if the user explicitly enter a username as part of the url. For example, "ftp://foo@foobar.com". That was what kio_ftp was violating. It was adding the "foo@" part itself when the user did not actually type that in. Anyhow, the reason why the optional username is used is to allow the user to login with different usernames to the same server by explicitly specifying the username as part of the URL.
Comment 7 Martin Koller 2012-03-11 08:38:15 UTC
With the changes I made to the wallet, it works for me now.