IMAP TLS login problem

I’m sure this is straight forward but for once Google is failing me.
I’m trying to access an IMAP server with a Ruby script. The INMAP
server is using TLS and its working OK (I’ve test manually with
openssl). But this simple Ruby script can’t login:

#!/usr/bin/ruby
require ‘net/imap’
require ‘openssl’

imap = Net::IMAP.new(‘exchange.ncc.dante.net’, port = 993, usessl =
true)
p imap.capability
#imap.authenticate(‘cram-md5’, ‘’, ‘’)
imap.authenticate(‘login’, ‘’, ‘’)

stuff that never gets runs yet …


The result is as below. ‘Capability’ works OK. I was expecting
“AUTH=LOGIN” as well, but I know ‘LOGIN’ does work as I can do it
manually with openssl s_client. Any ideas?

[toby@server]$ ./imap1.rb
[“IMAP4”, “IMAP4REV1”, “AUTH=NTLM”, “AUTH=GSSAPI”, “AUTH=PLAIN”, “IDLE”,
“NAMESPACE”, “LITERAL+”]
/usr/lib/ruby/1.8/net/imap.rb:974:in get_tagged_response': Command Argument Error. 11 (Net::IMAP::BadResponseError) from /usr/lib/ruby/1.8/net/imap.rb:1023:in send_command’
from /usr/lib/ruby/1.8/monitor.rb:238:in synchronize' from /usr/lib/ruby/1.8/net/imap.rb:1008:in send_command’
from /usr/lib/ruby/1.8/net/imap.rb:357:in `authenticate’
from ./imap1.rb:9

Well, how about that - it seems that if I use
imap.login(","")
instead of …
imap.authenticate(‘login’, ‘’, ‘’)
then it works. Happy days are here again.