Commit Graph

33 Commits

Author SHA1 Message Date
Rodolfo García Peñas (kix)
47f7b1ba3c get_os_sslcertfile_searchpath do not check iterable
Now, location is always an iterable, so we don't need check it.
2020-10-25 17:32:38 +01:00
Rodolfo García Peñas (kix)
a1f8576937 distro_utils do not compare types
This patch now use isinstance to compare types.
2020-10-25 17:27:40 +01:00
Rodolfo García Peñas (kix)
fe25a5c752 Distro default certificates must be iterables
This patch changes the __DEF_OS_LOCATIONS to an iterable value.

The reason is because a list is an iterable, but an string is an
iterable too, and this is a mistake.

The function get_os_sslcertfile() has a loop to iterate the return of
get_os_sslcertfile_searchpath(), that returns the value in the
__DEF_OS_LOCATIONS dictionary. When the value is an iterable, the "f"
variable is set to the iterable value and works fine.
If the value of "f" is an string, the for-loop iterates over every
character, so the test for os.path.exists is always false (is comparing
the path with a character, not with the full path), so this function
fails and return None.

To check this change, edit your .offlineimaprc file and change the
sslcacertfile to OS-DEFAULT:

sslcacertfile = OS-DEFAULT

And run offlineimap. If you are not using 'darwin0 (the only iterable)
it will fails. Now, apply this patch, and run offlineimap again. Problem
is solved.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 17:26:20 +01:00
Rodolfo García Peñas (kix)
bde48fe2c7 Renamed l variable to location_name
This variable is renamed to avoid a warning about ambiguous name.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 16:42:09 +01:00
Rodolfo García Peñas (kix)
5777553a96 Renamed l variable to location_name
This variable is renamed to avoid a warning about ambiguous name.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 16:40:50 +01:00
Rodolfo García Peñas (kix)
714cbe2327 Renamed OS to os_name in get_os_sslcertificate_searchpath
This patch changes this variable name only.
2020-10-25 16:40:07 +01:00
Rodolfo García Peñas (kix)
07c1a5c9db Deprecated linux_distribution
The call from platform.linux_distribution was depdrecated in Python 3.7.

This patch solves this problem, using the recomended package distro.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 16:38:16 +01:00
Rodolfo García Peñas (kix)
f66bfb0026 Renamed utils/distro.py
The file utils/distro.py is renamed to utils/distro_utils.py
because we need import the distro file to update some calls.

The file is used in IMAP.py, I need change the import.
2020-10-25 16:33:52 +01:00
Rodolfo García Peñas (kix)
faff27f0c9 Renamed variable DISTRO to distro_name
Variable DISTRO should be lowercase. I renamed it to distro_name.
2020-10-25 15:47:50 +01:00
Rodolfo García Peñas (kix)
997f5b27c5 Renamed variable OS to os_name
Variable OS should be in lowercase.
2020-10-25 15:47:22 +01:00
Rodolfo García Peñas (kix)
142041130d utils/const.py Removed extra characters
These characters could be removed.
2020-08-30 18:14:15 +02:00
Rodolfo García Peñas (kix)
da2baaaeb7 offlineimap/utils files singleton-comparison
This patch change these errors in the utils folder

C0121: Comparison to None should be 'expr is None' (singleton-comparison)
C0121: Comparison to None should be 'expr is not None' (singleton-comparison)
2020-08-30 11:18:18 +02:00
Rodolfo García Peñas (kix)
e77440552c Do not make object inheritance
This patch removes these lintian warnings:

Warning R0205: Class 'X' inherits from object,
can be safely removed from bases in python3 (useless-object-inheritance)
2020-08-29 21:44:18 +02:00
Rodolfo García Peñas (kix)
c1d180543f Reformat offlineimap/utils/stacktrace.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 20:03:24 +02:00
Rodolfo García Peñas (kix)
5a81eccb49 Reformat offlineimap/utils/distro.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 20:01:52 +02:00
Rodolfo García Peñas (kix)
5d482a67ff Reformat offlineimap/utils/const.py
Add some spaces, remove lines,... now format is better (lintian).
2020-08-29 20:00:02 +02:00
Rodolfo García Peñas (kix)
6ec6111896 2to3 main 2020-08-28 03:32:43 +02:00
Philippe Loctaux
af3a35ae30 offlineimap/utilis/distro.py: identation fix
Fixed a indentation style.

Signed-off-by: Philippe Loctaux <loctauxphilippe@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-08-17 18:49:04 +02:00
Philippe Loctaux
761e10e8b1 Add Archlinux to list of supported distros
There is a bug with `platform.linux_distribution()`, which returns an
empty value on Archlinux with python2.

This bug is fixed in python3, but *will not* be fixed in python2.

This patch fixes that issue with a dirty hack: on archlinux, there is a
file that can be used to detect an archlinux machine. that file is
`/etc/arch-release`. if the file exists, then the OS variable will be
set to "linux-arch".

You can learn more about that issue on the python bug platform:
https://bugs.python.org/issue20454

Signed-off-by: Philippe Loctaux <loctauxphilippe@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-08-17 18:49:04 +02:00
Nicolas Sebrecht
d9301254ff fix dates in copyright lines
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-08-13 01:15:01 +02:00
Philippe Loctaux
2890dec37f Added ssl certfile on osx for openssl pacakge on homebrew
A certfile was already specified for osx but only with MacPorts,
this patch adds the certfile given with the package `openssl` with
homebrew.

You can get more info with the command `brew info openssl` on osx with
homebrew and openssl installed.

Signed-off-by: Philippe Loctaux <loctauxphilippe@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-08-10 12:48:17 +02:00
Philippe Loctaux
7af4728d62 Add Archlinux to list of supported distros
get_os_name returns linux-arch on Archlinux, so add a line for linux-arch to __DEF_OS_LOCATIONS.

Signed-off-by: Philippe Loctaux <loctauxphilippe@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2018-08-10 12:42:29 +02:00
altruizine
d88b8d52e7 Add OpenSUSE to list of supported distros
get_os_name returns linux-opensuse on OpenSUSE, so add a line for linux-opensuse to __DEF_OS_LOCATIONS.

Signed-off-by: Michael Hohmuth <hohmuth@sax.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-11-03 16:35:24 +01:00
Nicolas Sebrecht
95c82b91be minor: utils: distro: fix copyright line
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-09-21 00:51:42 +02:00
Espen Henriksen
4ee1518b64 Add gentoo cert path for OS-DEFAULT
Signed-off-by: Espen Henriksen <dev@henriksen.is>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2016-09-21 00:41:20 +02:00
Eygene Ryabinkin
f69613965f Make OS-default CA certificate file to be requested explicitely
This simplifies logics for the user, especially if he uses both
fingerprint and certificate validation: it is hard to maintain
the compatibility with the prior behaviour and to avoid getting
default CA bundle to be disabled when fingerprint verification
is requested.

See
  http://thread.gmane.org/gmane.mail.imap.offlineimap.general/6695
for discussion about this change.

Default CA bundle is requested via 'sslcertfile = OS-DEFAULT'.

I had also enforced all cases where explicitely-requested CA bundles
are non-existent to be hard errors: when users asks us to use CA
bundle (and, thus, certificate validation), but we can't find one,
we must error out rather than happily continue and downgrade to
no validation.

Reported-By: Edd Barrett <edd@theunixzoo.co.uk>
Reviewed-By: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2015-01-18 22:05:49 +03:00
Nicolas Sebrecht
a35c432671 utils/const.py: fix ident
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
2015-01-01 22:24:23 +01:00
Eygene Ryabinkin
0a569bea3d Add default CA bundle location for DragonFlyBSD
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-10-08 10:39:43 +04:00
nopjmp
716a6f4718 Add OpenBSD default CA certificates file location
GitHub pull: https://github.com/OfflineIMAP/offlineimap/pull/120
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-10-08 09:03:02 +04:00
Eygene Ryabinkin
818486283e Add support for OS-specific CA bundle locations
GitHub pull: #19
Suggested-by: Michael Vogt <mvo@ubuntu.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2014-09-22 09:52:57 +04:00
Eygene Ryabinkin
f4140cbbed Create global instance of command-line options
This eases testing of option values inside the code.  This instance
is implemented as the read-only copy of the obtained 'options' object,
so callers won't be able to modify its contents.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-11 23:34:18 +04:00
Eygene Ryabinkin
1c8917b036 And add forgotten __init__.py for offlineimap.utils
I should learn to check my commits when rebasing and reordering.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-05 07:52:25 +04:00
Eygene Ryabinkin
de84c3941c Implement stack trace dump for all running threads on SIGQUIT
This is handy when we're debugging the thread locks: we can try to
understand which thread does what and how it was called.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
2013-02-02 16:25:37 +04:00