]> git.cworth.org Git - sup/commitdiff
better comments and logging in authentication sequence
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 6 Jan 2007 15:59:48 +0000 (15:59 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sat, 6 Jan 2007 15:59:48 +0000 (15:59 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@213 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/imap.rb

index c123393cfce4f06f2710b4f218db5fd5320a5966..4108a6a9510833d058b56c5cd032f4f514637b89 100644 (file)
@@ -112,14 +112,18 @@ class IMAP < Source
         #raise Net::IMAP::ByeResponseError, "simulated imap failure"
         @imap = Net::IMAP.new host, port, ssl?
         say "Logging in..."
+
+        ## although RFC1730 claims that "If an AUTHENTICATE command
+        ## fails with a NO response, the client may try another", in
+        ## practice it seems like they will also send BAD responses.
         begin
           @imap.authenticate 'CRAM-MD5', @username, @password
         rescue Net::IMAP::BadResponseError, Net::IMAP::NoResponseError => e
-          say "CRAM-MD5 authentication failed: #{e.class}"
+          Redwood::log "CRAM-MD5 authentication failed: #{e.class}. Trying LOGIN auth..."
           begin
             @imap.authenticate 'LOGIN', @username, @password
           rescue Net::IMAP::BadResponseError, Net::IMAP::NoResponseError => e
-            say "LOGIN authentication failed: #{e.class}"
+            Redwood::log "LOGIN authentication failed: #{e.class}. Trying plain-text LOGIN..."
             @imap.login @username, @password
           end
         end