pulp/kombu — pull request #22 by beav (2014-09-17 22:34:11+00:00)
Title: 1124589 - Support both ANONYMOUS and PLAIN sasl_mechanisms

Previously, Kombu only supported the `PLAIN` sasl_mechanism by default.
However, qpidd only supports `ANONYMOUS` by default. This change sets the
default mechanisms to both `ANONYMOUS` and `PLAIN`, and also removes the
default password of "guest" since qpid does not ship with a default SASL db[1].

While working on this issue, we discovered that qpid.messaging exhibits
different sasl_mechanism selection behavior depending on whether or not
**cyrus-sasl** is installed. If it is not installed and both `PLAIN` and
`ANONYMOUS` are listed as mechs, `PLAIN` is used first if a username and
password are defined for the connection. However, if **cyrus-sasl** is
installed on the client, `sasl_client_start()` is called to determine the mech.
This function treats `PLAIN` and `ANONYMOUS` as the same strength. This can
result in surprising behavior for the user in circumstances where they were
using `PLAIN`, then installed **cyrus-sasl** and started getting the
`ANONYMOUS` mech.

To normalize the sasl_mechanism selection behavior, first sort the mechs so
that `ANONYMOUS` is last, and then attempt a connection with each mech
individually. If it fails, we move on to the next mech.

NOTE: This patch also resolves an unrelated issue where `qpid_patches.py` would
attempt to import the qpid system library but instead get `qpid.py` that lived
in the same dir. This only occurred in Python 2.6. See [2] for more detail.

[1] https://issues.apache.org/jira/browse/QPID-6091
[2] http://legacy.python.org/dev/peps/pep-0328/#rationale-for-absolute-imports