Skip to content

Commit

Permalink
Merge pull request Kozea#202 from muggenhor/less-verbose-imap-ssl-warn
Browse files Browse the repository at this point in the history
IMAP: don't spam the logs about non-SSL connections to localhost
  • Loading branch information
liZe committed Jan 12, 2015
2 parents f2ccdca + a040c66 commit 7772d11
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion radicale/auth/IMAP.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@
IMAP_SERVER_PORT = config.getint("auth", "imap_port")
IMAP_USE_SSL = config.getboolean("auth", "imap_ssl")

IMAP_WARNED_UNENCRYPTED = False

def is_authenticated(user, password):
"""Check if ``user``/``password`` couple is valid."""
global IMAP_WARNED_UNENCRYPTED

if not user or not password:
return False

Expand Down Expand Up @@ -72,7 +75,8 @@ def is_authenticated(user, password):
"IMAP server at %s failed to accept TLS connection "
"because of: %s" % (IMAP_SERVER, exception))

if server_is_local and not connection_is_secure:
if server_is_local and not connection_is_secure and not IMAP_WARNED_UNENCRYPTED:
IMAP_WARNED_UNENCRYPTED = True
log.LOGGER.warning(
"IMAP server is local. "
"Will allow transmitting unencrypted credentials.")
Expand Down

0 comments on commit 7772d11

Please sign in to comment.