Defect #9769
openreceive_imap rake task hangs if it couldn’t connect to the IMAP server
0%
Description
If the receive_imap rake task is not able to connect to the IMAP server, it just hangs, instead of returning an error message (e.g. you can try to connect to GMail without using SSL, on the standard port 143).
And when it connects (in case with GMail, when you change the arguments to use SSL), it can return you the “Invalid Credentials”, even if the correct password was specified. The reason of such behavior is some symbols, such as “$”. The rake task only transmits the first part of the password, before such symbols. And if you screen them with backslashes (“\$”), the password starts to work (and the rake task works correctly).
For GMail, I was able to find this out using stunnel (which connected to GMail via SSL, and opened a port on localhost to make unsecure connections to the tunnel). Then I used localhost as the IMAP server in the rake task, and captured the password using dsniff -i lo.
Updated by Jean-Philippe Lang almost 13 years ago
- Resolution set to Cant reproduce
aruseni magiku wrote:
If the receive_imap rake task is not able to connect to the IMAP server, it just hangs, instead of returning an error message
It doesn't hang for me:
>rake redmine:email:receive_imap HOST=localhost rake aborted! Aucune connexion n'a pu être établie car l'ordinateur cible l'a expressément ref usée. - connect(2) Tasks: TOP => redmine:email:receive_imap (See full trace by running task with --trace)
Updated by aruseni magiku almost 13 years ago
Jean-Philippe Lang wrote:
aruseni magiku wrote:
If the receive_imap rake task is not able to connect to the IMAP server, it just hangs, instead of returning an error message
It doesn't hang for me:
[...]
Hmm, I see. Let me try to provide more detailed information.
gem list:
*** LOCAL GEMS *** actionmailer (2.3.11) actionpack (2.3.11) activerecord (2.3.11) activeresource (2.3.11) activesupport (2.3.11) Ascii85 (1.0.1) daemon_controller (0.2.6) fastthread (1.0.7) holidays (1.0.2) i18n (0.4.2) icalendar (1.1.6) nokogiri (1.5.0) open-uri-cached (0.0.4) passenger (3.0.8) pdf-reader (0.10.0) prawn (0.11.1) rack (1.1.1) rails (2.3.11) rake (0.9.2) rmagick (2.13.1) ttfunk (1.0.1)
Redmine version: v1.2.1
Rake task call (before enabling SSL) was the following:
rake -v -f /usr/lib/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com username=redmine@[domain] password="[password]"
The output of such task was this:
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+) WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead. at /usr/lib/redmine/lib/tasks/email.rake:170
Then, the task was hanging.
Also, how about the password transmission (in case it has various special symbols)? Did you test this, too?