summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Nussbaum <lucas@lucas-nussbaum.net>2010-04-18 14:25:14 +0200
committerLucas Nussbaum <lucas@lucas-nussbaum.net>2010-04-18 14:25:14 +0200
commit527d1f756ab57cb5b1449893dbff5ab1ead861fc (patch)
tree0c0bd938d06c56e7d99d510d7ac6abadfe85d6ed
parent697f0e432ea6c5bd03d2592ead7a92cb43ada780 (diff)
downloadfeed2imap-527d1f756ab57cb5b1449893dbff5ab1ead861fc.tar.gz
feed2imap-527d1f756ab57cb5b1449893dbff5ab1ead861fc.tar.bz2
feed2imap-527d1f756ab57cb5b1449893dbff5ab1ead861fc.zip
provide a way to disable SSL certificate verification
Diffstat (limited to '')
-rw-r--r--ChangeLog2
-rw-r--r--data/doc/feed2imap/examples/feed2imaprc2
-rw-r--r--lib/feed2imap/config.rb1
-rw-r--r--lib/feed2imap/imap.rb8
4 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 89696c5..dc9bf41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@ Feed2Imap 0.9.5 (XX/XX/2010)?
* Use Message-ID instead of X-CacheIndex
* Do not use acme.com
* Update rubyimap.rb
+* Provide a way to disable SSL certification verification when
+ connecting to IMAPS accounts
Feed2Imap 0.9.4 (27/07/2009)
============================
diff --git a/data/doc/feed2imap/examples/feed2imaprc b/data/doc/feed2imap/examples/feed2imaprc
index 99aab33..4fd8797 100644
--- a/data/doc/feed2imap/examples/feed2imaprc
+++ b/data/doc/feed2imap/examples/feed2imaprc
@@ -8,6 +8,8 @@
# about the "updated-items" algorithm.
# include-images: download images and include them in the mail? (true/false)
# default-email: default email address in the format foo@example.com
+# disable-ssl-verification: disable SSL certification when connecting
+# to IMAPS accounts (true/false)
#
# Per-feed options:
# name: name of the feed (must be unique)
diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb
index a9c796c..53e6543 100644
--- a/lib/feed2imap/config.rb
+++ b/lib/feed2imap/config.rb
@@ -47,6 +47,7 @@ class F2IConfig
@updateddebug = (@conf['debug-updated'] and @conf['debug-updated'] != 'false')
@include_images = (@conf['include-images'] and @conf['include-images'] != 'false')
@default_email = (@conf['default-email'] || "#{LOGNAME}@#{HOSTNAME}")
+ ImapAccount.no_ssl_verify = (@conf['disable-ssl-verification'] and @conf['disable-ssl-verification'] != 'false')
@hostname = HOSTNAME # FIXME: should this be configurable as well?
@imap_accounts = ImapAccounts::new
maildir_account = MaildirAccount::new
diff --git a/lib/feed2imap/imap.rb b/lib/feed2imap/imap.rb
index 6840c11..c4e7106 100644
--- a/lib/feed2imap/imap.rb
+++ b/lib/feed2imap/imap.rb
@@ -30,6 +30,7 @@ require 'uri'
# using the same IMAP account will create only one
# IMAP connection.
class ImapAccounts < Hash
+
def add_account(uri)
u = URI::Generic::build({ :scheme => uri.scheme,
:userinfo => uri.userinfo,
@@ -48,6 +49,11 @@ end
class ImapAccount
attr_reader :uri
+ @@no_ssl_verify = false
+ def ImapAccount::no_ssl_verify=(v)
+ @@no_ssl_verify = v
+ end
+
def initialize(uri)
@uri = uri
@existing_folders = []
@@ -70,7 +76,7 @@ class ImapAccount
end
# use given port if port given
port = uri.port if uri.port
- @connection = Net::IMAP::new(uri.host, port, usessl)
+ @connection = Net::IMAP::new(uri.host, port, usessl, nil, !@@no_ssl_verify)
user, password = URI::unescape(uri.userinfo).split(':',2)
@connection.login(user, password)
self