Fixes #2964 - Ensure email channel authentication to be ASCII-8Bit

This commit is contained in:
Mantas Masalskis 2020-05-20 16:04:45 +02:00 committed by Thorsten Eckel
parent c4c372c976
commit a69aebcd0c
2 changed files with 27 additions and 1 deletions

View file

@ -111,7 +111,7 @@ example
end
timeout(check_type_timeout) do
@imap.login(options[:user], options[:password])
@imap.login(options[:user], options[:password].dup&.force_encoding('ascii-8bit'))
end
timeout(check_type_timeout) do

View file

@ -0,0 +1,26 @@
require 'rails_helper'
RSpec.describe Channel::Driver::Imap do
# https://github.com/zammad/zammad/issues/2964
context 'when connecting with a ASCII 8-Bit password' do
it 'succeeds' do
required_envs = %w[IMAP_ASCII_8BIT_HOST IMAP_ASCII_8BIT_USER IMAP_ASCII_8BIT_PASSWORD]
required_envs.each do |key|
next if ENV[key].present?
skip("Need ENVs #{required_envs.join(', ')}.")
end
params = {
host: ENV['IMAP_ASCII_8BIT_HOST'],
user: ENV['IMAP_ASCII_8BIT_USER'],
password: ENV['IMAP_ASCII_8BIT_PASSWORD'],
}
result = described_class.new.fetch(params, nil, 'check')
expect(result.dig(:result)).to eq 'ok'
end
end
end