Re: gvfs-mount infinite loop if wrong password in stdin redirection



On Sat, Oct 18, 2014 at 10:33:04PM +0200, R. Diez wrote:
Hi all:

I have written a script to help me mount Windows shares. It is here:

https://github.com/rdiez/Tools/tree/master/MountWindowsShares

The script asks the user for the Windows password, and then runs gvfs-mount
once for every network share to mount. I do not want to use the GNOME ring
to store the passwords.

There is no other way to pass a password to gvfs-mount, so I am redirecting
its stdin in order to feed it with the password, which seems to work well.
However, if the user types the wrong password, gvfs-mount enters an infinite
loop. I keeps asking for a password, apparently accepting one, and then it
asks again for a password. And so on.

I think the problem is that routine prompt_for() in gvfs-mount is not
checking for a possible error returned by fgets(), so it does not realise
that stdin has reached the end of file (EOF) condition.

I guess gvfs-mount thinks that the user has typed an empty password and
tries that empty password out against the remote server. When it fails, it
asks again, causing an infinite loop. There does not seem to be a limit on
the number of retries either.

Is there any chance that somebody could fix this?


I have opened a bug for this:
https://bugzilla.gnome.org/show_bug.cgi?id=742942

Regards
-- 
Ross Lagerwall


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]