Repository: kudu Updated Branches: refs/heads/branch-1.3.x 2fcef0e34 -> 00813f96b
[macOS] fix security test failures Change-Id: I5c4d464edc09f41151f95ad2f0e694f2bc00b0f0 Reviewed-on: http://gerrit.cloudera.org:8080/6346 Tested-by: Kudu Jenkins Reviewed-by: Alexey Serbin <[email protected]> Reviewed-on: http://gerrit.cloudera.org:8080/6353 Reviewed-by: Todd Lipcon <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/00813f96 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/00813f96 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/00813f96 Branch: refs/heads/branch-1.3.x Commit: 00813f96b9cb0c9ec57a17e5c85242f7679db0e0 Parents: 2fcef0e Author: Dan Burkert <[email protected]> Authored: Fri Mar 10 12:46:18 2017 -0800 Committer: David Ribeiro Alves <[email protected]> Committed: Sat Mar 11 17:48:00 2017 +0000 ---------------------------------------------------------------------- src/kudu/rpc/client_negotiation.cc | 2 +- src/kudu/rpc/connection.cc | 2 +- src/kudu/security/init.cc | 28 ++++------------------------ 3 files changed, 6 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/00813f96/src/kudu/rpc/client_negotiation.cc ---------------------------------------------------------------------- diff --git a/src/kudu/rpc/client_negotiation.cc b/src/kudu/rpc/client_negotiation.cc index 9a3acfa..4279f0a 100644 --- a/src/kudu/rpc/client_negotiation.cc +++ b/src/kudu/rpc/client_negotiation.cc @@ -527,7 +527,7 @@ Status ClientNegotiation::AuthenticateByToken(faststring* recv_buf) { } Status ClientNegotiation::SendSaslInitiate() { - TRACE("Initiating SASL $0 handshake", negotiated_mech_); + TRACE("Initiating SASL $0 handshake", SaslMechanism::name_of(negotiated_mech_)); // At this point we've already chosen the SASL mechanism to use // (negotiated_mech_), but we need to let the SASL library know. SASL likes to http://git-wip-us.apache.org/repos/asf/kudu/blob/00813f96/src/kudu/rpc/connection.cc ---------------------------------------------------------------------- diff --git a/src/kudu/rpc/connection.cc b/src/kudu/rpc/connection.cc index 809abe5..66aecd2 100644 --- a/src/kudu/rpc/connection.cc +++ b/src/kudu/rpc/connection.cc @@ -143,7 +143,7 @@ void Connection::Shutdown(const Status &status) { if (inbound_ && inbound_->TransferStarted()) { double secs_since_active = (reactor_thread_->cur_time() - last_activity_time_).ToSeconds(); - LOG(WARNING) << "Shutting down connection " << ToString() << " with pending inbound data (" + LOG(WARNING) << "Shutting down " << ToString() << " with pending inbound data (" << inbound_->StatusAsString() << ", last active " << HumanReadableElapsedTime::ToShortString(secs_since_active) << " ago, status=" << status.ToString() << ")"; http://git-wip-us.apache.org/repos/asf/kudu/blob/00813f96/src/kudu/security/init.cc ---------------------------------------------------------------------- diff --git a/src/kudu/security/init.cc b/src/kudu/security/init.cc index fb27f40..294a96b 100644 --- a/src/kudu/security/init.cc +++ b/src/kudu/security/init.cc @@ -364,29 +364,6 @@ Status GetConfiguredPrincipal(string* principal) { *principal = p; return Status::OK(); } - -// macOS's Heimdal library has a no-op implementation of -// krb5_aname_to_localname, so instead this does a crude approximation by -// grabbing the username from the principal. -#ifdef __APPLE__ -// Grabs the username from a krb5 principal, and writes it to the provided -// buffer with a null terminator. -krb5_error_code principal_to_username(krb5_const_principal princ, - int len, - char* buf) { - if (princ->length == 0) { - return KRB5_LNAME_NOTRANS; - } - auto username = princ->data[0]; - if (username.length + 1 > len) { - return KRB5_CONFIG_NOTENUFSPACE; - } - // Copy username and a trailing null byte. - memcpy(buf, username.data, username.length); - username.data[username.length + 1] = 0; - return 0; -} -#endif } // anonymous namespace @@ -420,7 +397,10 @@ Status MapPrincipalToLocalName(const std::string& principal, std::string* local_ #ifndef __APPLE__ rc = krb5_aname_to_localname(g_krb5_ctx, princ, arraysize(buf), buf); #else - rc = principal_to_username(princ, arraysize(buf), buf); + // macOS's Heimdal library has a no-op implementation of + // krb5_aname_to_localname, so instead we fall down to below and grab the + // first component of the principal. + rc = KRB5_LNAME_NOTRANS; #endif if (rc == KRB5_LNAME_NOTRANS) { // No name mapping specified. We fall back to simply taking the first component
