I'd say that a guard was needed on the disconnect call.
On Dec 22, 2008, at 9:28 AM, Pete Bekisz wrote:
> Hi Rob,
>
> Thanks for your answers. I switched the server from our
> authentication server over to our mail server and it seems to be
> running fine, so I'm assuming it's an issue with the way the auth
> server handles IMAP/POP authentication. Here's the code from the
> plugin:
>
> def authenticate(username, password)
> imap = Net::IMAP.new imap_authenicatable_options[:host],
> imap_authenicatable_options[:port], imap_authenicatable_options[:ssl]
> username = clean_username(username)
> imap.authenticate('LOGIN', username, password)
>
> if imap_authenicatable_options[:allow_new_users]
> find_or_create_by_username(username)
> else
> find_by_username(username)
> end
> rescue
> false
> ensure
> imap.disconnect
imap.disconnect unless imap.nil?
> end
>
> Does it sound like it's an issue with the auth server to anyone else?
With that naked rescue, it's hard to say what the real problem is, but
I suspect a connection problem over an authentication problem.
-Rob
>
> On Mon, Dec 22, 2008 at 8:52 AM, Rob Biedenharn <[email protected]
> > wrote:
> On Dec 20, 2008, at 11:30 AM, Pete Bekisz wrote:
>
>> Good morning all,
>>
>> I've been using the imap_authenticatable plugin for about a year
>> now without incident. All of a sudden, I tried logging in this
>> morning and this error is showing up in the logs. Does anyone have
>> any idea what could be causing this or how to fix it?
>>
>> Thanks,
>> Pete
>>
>> NoMethodError (undefined method `disconnect' for nil:NilClass):
>> /vendor/plugins/imap_authenticatable/lib/
>> imap_authenticatable.rb:52:in `authenticate'
>
> Well, I have no experience with imap_authenticate, but you need to
> look at this line 52 in the plugin's code to see what is the 'nil'
> and then find where that gets set. Chances are there's a condition
> that's not being properly checked for and the connection is never
> made; then when some later error happens, the cleanup to disconnect
> is getting called on the never-successfully opened instance.
>
> -Rob
>
> Rob Biedenharn http://agileconsultingllc.com
> [email protected]
>
>> /app/controllers/login_controller.rb:13:in `login'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> base.rb:1095:in `send'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> base.rb:1095:in `perform_action_without_filters'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> filters.rb:632:in `call_filter'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> filters.rb:634:in `call_filter'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> filters.rb:619:in `perform_action_without_benchmark'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> benchmarking.rb:66:in `perform_action_without_rescue'
>> /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> benchmarking.rb:66:in `perform_action_without_rescue'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> rescue.rb:83:in `perform_action'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> base.rb:430:in `send'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> base.rb:430:in `process_without_filters'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> filters.rb:624:in `process_without_session_management_support'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> session_management.rb:114:in `process'
>> /usr/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/
>> base.rb:330:in `process'
>> /usr/lib/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in
>> `dispatch'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:78:in
>> `process'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
>> `synchronize'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:76:in
>> `process'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in
>> `process_client'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in `each'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in
>> `process_client'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in
>> `initialize'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `new'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in
>> `initialize'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `new'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
>> configurator.rb:271:in `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
>> configurator.rb:270:in `each'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/
>> configurator.rb:270:in `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:127:in
>> `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:
>> 211:in `run'
>> /usr/lib/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243
>> /usr/bin/mongrel_rails:16:in `load'
>> /usr/bin/mongrel_rails:16
Rob Biedenharn http://agileconsultingllc.com
[email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---