[macOS] fix security test failures
Change-Id: I5c4d464edc09f41151f95ad2f0e694f2bc00b0f0
Reviewed-on: http://gerrit.cloudera.org:8080/6346
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Reviewed-on: http://gerrit.cloudera.org:8080/6353
Reviewed-by: Todd Lipcon <todd@apache.org>
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::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
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 @@
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() << ")";
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 @@
*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 @@
#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