[PATCH 3/3] Revert "Add support for OS-specific CA bundle locations"

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Jan 10 23:08:55 GMT 2015


This reverts commit 818486283ed2ccf55e9a0d6be8a1acd8727fb69e.

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev at laposte.net>

Conflicts:
	Changelog.rst
	offlineimap/repository/IMAP.py

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev at laposte.net>
---
 offlineimap/repository/IMAP.py |  5 ++-
 offlineimap/utils/distro.py    | 74 ------------------------------------------
 2 files changed, 2 insertions(+), 77 deletions(-)
 delete mode 100644 offlineimap/utils/distro.py

diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py
index d664259..bb65c8f 100644
--- a/offlineimap/repository/IMAP.py
+++ b/offlineimap/repository/IMAP.py
@@ -25,7 +25,6 @@ from offlineimap.repository.Base import BaseRepository
 from offlineimap import folder, imaputil, imapserver, OfflineImapError
 from offlineimap.folder.UIDMaps import MappedIMAPFolder
 from offlineimap.threadutil import ExitNotifyThread
-from offlineimap.utils.distro import get_os_sslcertfile
 
 
 class IMAPRepository(BaseRepository):
@@ -201,9 +200,9 @@ class IMAPRepository(BaseRepository):
 
     def getsslcacertfile(self):
         """Return the absolute path of the CA certfile to use, if any"""
+
         xforms = [os.path.expanduser, os.path.expandvars, os.path.abspath]
-        cacertfile = self.getconf_xform('sslcacertfile', xforms,
-          get_os_sslcertfile())
+        cacertfile = self.getconf_xform('sslcacertfile', xforms, None)
         if cacertfile is None:
             return None
         if not os.path.isfile(cacertfile):
diff --git a/offlineimap/utils/distro.py b/offlineimap/utils/distro.py
deleted file mode 100644
index 96aab1b..0000000
--- a/offlineimap/utils/distro.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# Copyright 2014 Eygene A. Ryabinkin.
-#
-# Module that supports distribution-specific functions.
-
-import platform
-import os
-
-
-# Each dictionary value is either string or some iterable.
-# 
-# For the former we will just return the value, for an iterable
-# we will walk through the values and will return the first
-# one that corresponds to the existing file.
-__DEF_OS_LOCATIONS = {
-    'freebsd': '/usr/local/share/certs/ca-root-nss.crt',
-    'openbsd': None,
-    'netbsd': None,
-    'dragonfly': None,
-    'darwin': [
-      # MacPorts, port curl-ca-bundle
-      '/opt/local/share/curl/curl-ca-bundle.crt',
-    ],
-    'linux-ubuntu': '/etc/ssl/certs/ca-certificates.crt',
-    'linux-debian': '/etc/ssl/certs/ca-certificates.crt',
-    'linux-fedora': '/etc/pki/tls/certs/ca-bundle.crt',
-    'linux-redhat': '/etc/pki/tls/certs/ca-bundle.crt',
-    'linux-suse': '/etc/ssl/ca-bundle.pem',
-}
-
-
-def get_os_name():
-    """
-    Finds out OS name.  For non-Linux system it will be just a plain
-    OS name (like FreeBSD), for Linux it will be "linux-<distro>",
-    where <distro> is the name of the distribution, as returned by
-    the first component of platform.linux_distribution.
-
-    Return value will be all-lowercase to avoid confusion about
-    proper name capitalisation.
-
-    """
-    OS = platform.system().lower()
-
-    if OS.startswith('linux'):
-        DISTRO = platform.linux_distribution()[0]
-        if DISTRO:
-          OS = OS + "-%s" % DISTRO.lower()
-
-    return OS
-
-
-def get_os_sslcertfile():
-    """
-    Finds out the location for the distribution-specific
-    CA certificate file bundle.
-
-    Returns the location of the file or None if there is
-    no known CA certificate file or all known locations
-    correspond to non-existing filesystem objects.
-
-    """
-    OS = get_os_name()
-
-    if OS in __DEF_OS_LOCATIONS:
-        l = __DEF_OS_LOCATIONS[OS]
-        if not hasattr(l, '__iter__'):
-          l = (l, )
-        for f in l:
-          assert (type(f) == type(""))
-          if os.path.exists(f) and \
-            (os.path.isfile(f) or os.path.islink(f)):
-              return f
-
-    return None
-- 
2.2.1





More information about the OfflineIMAP-project mailing list