PROTON-334: Add capability to detect extended SASL support
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/d7df5760 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/d7df5760 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/d7df5760 Branch: refs/heads/master Commit: d7df5760f979a2e0503b272638067493fd5b9e7b Parents: 7346d23 Author: Andrew Stitcher <astitc...@apache.org> Authored: Thu Jun 11 13:53:04 2015 -0400 Committer: Andrew Stitcher <astitc...@apache.org> Committed: Thu Jun 11 16:19:54 2015 -0400 ---------------------------------------------------------------------- proton-c/bindings/python/proton/__init__.py | 4 ++++ proton-c/include/proton/sasl.h | 13 +++++++++++++ proton-c/src/sasl/cyrus_sasl.c | 5 +++++ proton-c/src/sasl/none_sasl.c | 5 +++++ proton-j/src/main/resources/csasl.py | 3 +++ 5 files changed, 30 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/bindings/python/proton/__init__.py ---------------------------------------------------------------------- diff --git a/proton-c/bindings/python/proton/__init__.py b/proton-c/bindings/python/proton/__init__.py index e3cd9e3..9432bd8 100644 --- a/proton-c/bindings/python/proton/__init__.py +++ b/proton-c/bindings/python/proton/__init__.py @@ -3368,6 +3368,10 @@ class SASL(Wrapper): PERM = PN_SASL_PERM TEMP = PN_SASL_TEMP + @staticmethod + def extended(): + return pn_sasl_extended() + def __init__(self, transport): Wrapper.__init__(self, transport._impl, pn_transport_attachments) self._sasl = pn_sasl(transport._impl) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/include/proton/sasl.h ---------------------------------------------------------------------- diff --git a/proton-c/include/proton/sasl.h b/proton-c/include/proton/sasl.h index b2a8a27..60ee7d5 100644 --- a/proton-c/include/proton/sasl.h +++ b/proton-c/include/proton/sasl.h @@ -68,6 +68,19 @@ typedef enum { */ PN_EXTERN pn_sasl_t *pn_sasl(pn_transport_t *transport); +/** Do we support extended SASL negotiation + * + * Do we support extended SASL negotiation? + * All implementations of Proton support ANONYMOUS and EXTERNAL on both + * client and server sides and PLAIN on the client side. + * + * Extended SASL implememtations use an external library (Cyrus SASL) + * to support other mechanisms beyond these basic ones. + * + * @return true if we support extended SASL negotiation, false if we only support basic negotiation. + */ +PN_EXTERN bool pn_sasl_extended(void); + /** Set the outcome of SASL negotiation * * Used by the server to set the result of the negotiation process. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/src/sasl/cyrus_sasl.c ---------------------------------------------------------------------- diff --git a/proton-c/src/sasl/cyrus_sasl.c b/proton-c/src/sasl/cyrus_sasl.c index 31703a8..b42ffa5 100644 --- a/proton-c/src/sasl/cyrus_sasl.c +++ b/proton-c/src/sasl/cyrus_sasl.c @@ -380,3 +380,8 @@ void pni_sasl_impl_free(pn_transport_t *transport) sasl_server_done(); } } + +bool pn_sasl_extended(void) +{ + return true; +} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-c/src/sasl/none_sasl.c ---------------------------------------------------------------------- diff --git a/proton-c/src/sasl/none_sasl.c b/proton-c/src/sasl/none_sasl.c index 4a2dc13..be27871 100644 --- a/proton-c/src/sasl/none_sasl.c +++ b/proton-c/src/sasl/none_sasl.c @@ -171,3 +171,8 @@ void pni_process_challenge(pn_transport_t *transport, const pn_bytes_t *recv) void pni_process_response(pn_transport_t *transport, const pn_bytes_t *recv) { } + +bool pn_sasl_extended(void) +{ + return false; +} http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/d7df5760/proton-j/src/main/resources/csasl.py ---------------------------------------------------------------------- diff --git a/proton-j/src/main/resources/csasl.py b/proton-j/src/main/resources/csasl.py index ea5e489..32f8039 100644 --- a/proton-j/src/main/resources/csasl.py +++ b/proton-j/src/main/resources/csasl.py @@ -30,6 +30,9 @@ PN_SASL_SYS=2 PN_SASL_PERM=3 PN_SASL_TEMP=4 +def pn_sasl_extended(): + return False + def pn_sasl(tp): sasl = tp.impl.sasl() if tp.server: --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org