Repository: kudu
Updated Branches:
  refs/heads/master 4c9ea94a5 -> dc454dcd0


negotiation: add tracing of negotiated authn type

Change-Id: Ida0137503a9f43de0398b7a885e14aaef20cb567
Reviewed-on: http://gerrit.cloudera.org:8080/6079
Reviewed-by: Dan Burkert <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/77e88493
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/77e88493
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/77e88493

Branch: refs/heads/master
Commit: 77e884935400a1c26994bbbe8c9b9d758b2592f3
Parents: 4c9ea94
Author: Todd Lipcon <[email protected]>
Authored: Sun Feb 19 17:07:08 2017 -0800
Committer: Todd Lipcon <[email protected]>
Committed: Wed Feb 22 04:48:57 2017 +0000

----------------------------------------------------------------------
 src/kudu/rpc/client_negotiation.cc |  1 +
 src/kudu/rpc/negotiation.cc        | 19 ++++++++++++-------
 src/kudu/rpc/negotiation.h         |  4 +++-
 src/kudu/rpc/server_negotiation.cc |  1 +
 4 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/77e88493/src/kudu/rpc/client_negotiation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/client_negotiation.cc 
b/src/kudu/rpc/client_negotiation.cc
index 1f3f648..95efa7d 100644
--- a/src/kudu/rpc/client_negotiation.cc
+++ b/src/kudu/rpc/client_negotiation.cc
@@ -164,6 +164,7 @@ Status ClientNegotiation::Negotiate() {
     NegotiatePB response;
     RETURN_NOT_OK(RecvNegotiatePB(&response, &recv_buf));
     RETURN_NOT_OK(HandleNegotiate(response));
+    TRACE("Negotiated authn=$0", 
AuthenticationTypeToString(negotiated_authn_));
   }
 
   // Step 3: if both ends support TLS, do a TLS handshake.

http://git-wip-us.apache.org/repos/asf/kudu/blob/77e88493/src/kudu/rpc/negotiation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/negotiation.cc b/src/kudu/rpc/negotiation.cc
index d8cdfe3..f303179 100644
--- a/src/kudu/rpc/negotiation.cc
+++ b/src/kudu/rpc/negotiation.cc
@@ -20,6 +20,7 @@
 #include <sys/time.h>
 #include <poll.h>
 
+#include <ostream>
 #include <string>
 
 #include <gflags/gflags.h>
@@ -67,14 +68,18 @@ using strings::Substitute;
 namespace kudu {
 namespace rpc {
 
-std::ostream& operator<<(std::ostream& o, AuthenticationType 
authentication_type) {
-  switch (authentication_type) {
-    case AuthenticationType::INVALID: o << "INVALID"; break;
-    case AuthenticationType::SASL: o << "SASL"; break;
-    case AuthenticationType::TOKEN: o << "TOKEN"; break;
-    case AuthenticationType::CERTIFICATE: o << "CERTIFICATE"; break;
+const char* AuthenticationTypeToString(AuthenticationType t) {
+  switch (t) {
+    case AuthenticationType::INVALID: return "INVALID"; break;
+    case AuthenticationType::SASL: return "SASL"; break;
+    case AuthenticationType::TOKEN: return "TOKEN"; break;
+    case AuthenticationType::CERTIFICATE: return "CERTIFICATE"; break;
   }
-  return o;
+  return "<cannot reach here>";
+}
+
+std::ostream& operator<<(std::ostream& o, AuthenticationType 
authentication_type) {
+  return o << AuthenticationTypeToString(authentication_type);
 }
 
 // Wait for the client connection to be established and become ready for 
writing.

http://git-wip-us.apache.org/repos/asf/kudu/blob/77e88493/src/kudu/rpc/negotiation.h
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/negotiation.h b/src/kudu/rpc/negotiation.h
index 11b108a..83539c0 100644
--- a/src/kudu/rpc/negotiation.h
+++ b/src/kudu/rpc/negotiation.h
@@ -17,7 +17,7 @@
 #ifndef KUDU_RPC_NEGOTIATION_H
 #define KUDU_RPC_NEGOTIATION_H
 
-#include <ostream>
+#include <iosfwd>
 
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/util/monotime.h"
@@ -34,6 +34,8 @@ enum class AuthenticationType {
   TOKEN,
   CERTIFICATE,
 };
+const char* AuthenticationTypeToString(AuthenticationType t);
+
 std::ostream& operator<<(std::ostream& o, AuthenticationType 
authentication_type);
 
 class Negotiation {

http://git-wip-us.apache.org/repos/asf/kudu/blob/77e88493/src/kudu/rpc/server_negotiation.cc
----------------------------------------------------------------------
diff --git a/src/kudu/rpc/server_negotiation.cc 
b/src/kudu/rpc/server_negotiation.cc
index 76f0214..bbd2c58 100644
--- a/src/kudu/rpc/server_negotiation.cc
+++ b/src/kudu/rpc/server_negotiation.cc
@@ -137,6 +137,7 @@ Status ServerNegotiation::Negotiate() {
     NegotiatePB request;
     RETURN_NOT_OK(RecvNegotiatePB(&request, &recv_buf));
     RETURN_NOT_OK(HandleNegotiate(request));
+    TRACE("Negotiated authn=$0", 
AuthenticationTypeToString(negotiated_authn_));
   }
 
   // Step 3: if both ends support TLS, do a TLS handshake.

Reply via email to