You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2015/07/28 23:30:16 UTC
qpid-proton git commit: NO-JIRA: Silence SASL logging by default
Repository: qpid-proton
Updated Branches:
refs/heads/master c954cf3e4 -> a942b492d
NO-JIRA: Silence SASL logging by default
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a942b492
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a942b492
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a942b492
Branch: refs/heads/master
Commit: a942b492d4e5fc1a417895d2afc4c7e5700aa513
Parents: c954cf3
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Jul 28 17:24:34 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Jul 28 17:29:14 2015 -0400
----------------------------------------------------------------------
proton-c/src/sasl/cyrus_sasl.c | 12 ++++++++----
proton-c/src/sasl/sasl.c | 13 ++++++++++---
2 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a942b492/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 bd72ade..802275e 100644
--- a/proton-c/src/sasl/cyrus_sasl.c
+++ b/proton-c/src/sasl/cyrus_sasl.c
@@ -40,7 +40,8 @@ static const char *amqp_service = "amqp";
static bool pni_check_sasl_result(sasl_conn_t *conn, int r, pn_transport_t *logger)
{
if (r!=SASL_OK) {
- pn_transport_logf(logger, "sasl error: %s", conn ? sasl_errdetail(conn) : sasl_errstring(r, NULL, NULL));
+ if (logger->trace & PN_TRACE_DRV)
+ pn_transport_logf(logger, "sasl error: %s", conn ? sasl_errdetail(conn) : sasl_errstring(r, NULL, NULL));
return false;
}
return true;
@@ -319,7 +320,8 @@ static void pni_process_server_result(pn_transport_t *transport, int result)
const void* value;
sasl_getprop(cyrus_conn, SASL_USERNAME, &value);
sasl->username = (const char*) value;
- pn_transport_logf(transport, "Authenticated user: %s with mechanism %s", sasl->username, sasl->selected_mechanism);
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "Authenticated user: %s with mechanism %s", sasl->username, sasl->selected_mechanism);
pni_sasl_set_desired_state(transport, SASL_POSTED_OUTCOME);
break;
case SASL_CONTINUE:
@@ -427,7 +429,8 @@ ssize_t pni_sasl_impl_encode(pn_transport_t *transport, pn_bytes_t in, pn_bytes_
*out = pn_bytes(outlen, output);
return outlen;
}
- pn_transport_logf(transport, "SASL encode error: %s", sasl_errdetail(cyrus_conn));
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "SASL encode error: %s", sasl_errdetail(cyrus_conn));
return PN_ERR;
}
@@ -443,7 +446,8 @@ ssize_t pni_sasl_impl_decode(pn_transport_t *transport, pn_bytes_t in, pn_bytes_
*out = pn_bytes(outlen, output);
return outlen;
}
- pn_transport_logf(transport, "SASL decode error: %s", sasl_errdetail(cyrus_conn));
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "SASL decode error: %s", sasl_errdetail(cyrus_conn));
return PN_ERR;
}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a942b492/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index 673a482..7535306 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -143,11 +143,14 @@ void pni_sasl_set_desired_state(pn_transport_t *transport, enum pni_sasl_state d
{
pni_sasl_t *sasl = transport->sasl;
if (sasl->last_state > desired_state) {
- pn_transport_logf(transport, "Trying to send SASL frame (%d), but illegal: already in later state (%d)", desired_state, sasl->last_state);
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "Trying to send SASL frame (%d), but illegal: already in later state (%d)", desired_state, sasl->last_state);
} else if (sasl->client && !pni_sasl_is_client_state(desired_state)) {
- pn_transport_logf(transport, "Trying to send server SASL frame (%d) on a client", desired_state);
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "Trying to send server SASL frame (%d) on a client", desired_state);
} else if (!sasl->client && !pni_sasl_is_server_state(desired_state)) {
- pn_transport_logf(transport, "Trying to send client SASL frame (%d) on a server", desired_state);
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "Trying to send client SASL frame (%d) on a server", desired_state);
} else {
// If we need to repeat CHALLENGE or RESPONSE frames adjust current state to seem
// like they haven't been sent yet
@@ -313,6 +316,8 @@ static ssize_t pn_input_read_sasl(pn_transport_t* transport, unsigned int layer,
pni_sasl_t *sasl = transport->sasl;
if (pni_sasl_impl_can_encrypt(transport)) {
sasl->max_encrypt_size = pni_sasl_impl_max_encrypt_size(transport);
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "SASL Encryption enabled: buffer=%d", sasl->max_encrypt_size);
transport->io_layers[layer] = &sasl_encrypt_layer;
} else if (sasl->client) {
transport->io_layers[layer] = &pni_passthru_layer;
@@ -384,6 +389,8 @@ static ssize_t pn_output_write_sasl(pn_transport_t* transport, unsigned int laye
if (pni_sasl_impl_can_encrypt(transport)) {
sasl->max_encrypt_size = pni_sasl_impl_max_encrypt_size(transport);
+ if (transport->trace & PN_TRACE_DRV)
+ pn_transport_logf(transport, "SASL Encryption enabled: buffer=%d", sasl->max_encrypt_size);
transport->io_layers[layer] = &sasl_encrypt_layer;
} else if (sasl->client) {
return pni_passthru_layer.process_output(transport, layer, bytes, available );
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org