Werk #11208: check_mailboxes: Handle invalid mailbox names

Component Checks & Agents
Title check_mailboxes: Handle invalid mailbox names
Date Sep 24, 2020
Checkmk Editon Checkmk Raw (CRE)
Checkmk Version 2.0.0i1
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed

A space character in a mailbox name provided via {--mailbox=}, e.g. "My Inbox" would lead to a known exception:

imaplib.IMAP4.error: SELECT command error: BAD [b"parse error: wrong character; expected '(' but got 'I'"]

see https://bugs.python.org/issue13940

This fix quotes mailbox names and thus fixes the described behaviour.

Also, provided mailbox names which do not exist on the server would have been ignored silently. This fix will render the check UNKNOWN in case any non-existent names are encountered.

To the list of all Werks