drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From par...@apache.org
Subject drill git commit: DRILL-2672: C++ Client - Add support for authentication
Date Sun, 05 Apr 2015 18:41:02 GMT
Repository: drill
Updated Branches:
  refs/heads/master 4f213570f -> 862ab91e9


DRILL-2672: C++ Client - Add support for authentication


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/862ab91e
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/862ab91e
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/862ab91e

Branch: refs/heads/master
Commit: 862ab91e93f56469c05412822ea308bba783d879
Parents: 4f21357
Author: Parth Chandra <pchandra@maprtech.com>
Authored: Fri Apr 3 16:32:32 2015 -0700
Committer: Parth Chandra <pchandra@maprtech.com>
Committed: Sun Apr 5 11:40:46 2015 -0700

----------------------------------------------------------------------
 .../native/client/src/clientlib/drillClient.cpp |   2 +-
 .../client/src/clientlib/drillClientImpl.cpp    |  47 +++-
 .../client/src/clientlib/drillClientImpl.hpp    |   6 +-
 contrib/native/client/src/clientlib/errmsgs.cpp |   8 +-
 contrib/native/client/src/clientlib/errmsgs.hpp |   5 +-
 .../native/client/src/include/drill/common.hpp  |  13 +-
 contrib/native/client/src/protobuf/User.pb.cc   | 206 ++++++++++++++++-
 contrib/native/client/src/protobuf/User.pb.h    | 230 ++++++++++++++++++-
 8 files changed, 488 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/clientlib/drillClient.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClient.cpp b/contrib/native/client/src/clientlib/drillClient.cpp
index 90aa555..7162f63 100644
--- a/contrib/native/client/src/clientlib/drillClient.cpp
+++ b/contrib/native/client/src/clientlib/drillClient.cpp
@@ -122,7 +122,7 @@ logLevel_t DrillClientConfig::getLogLevel(){
 
 //Using boost assign to initialize maps. 
 const std::map<std::string, uint32_t>  DrillUserProperties::USER_PROPERTIES=boost::assign::map_list_of
-    ( USERPROP_USERNAME,    USERPROP_FLAGS_SERVERPROP|USERPROP_FLAGS_STRING )
+    ( USERPROP_USERNAME,    USERPROP_FLAGS_SERVERPROP|USERPROP_FLAGS_USERNAME|USERPROP_FLAGS_STRING
)
     ( USERPROP_PASSWORD,    USERPROP_FLAGS_SERVERPROP|USERPROP_FLAGS_PASSWORD)
     ( USERPROP_SCHEMA,      USERPROP_FLAGS_SERVERPROP|USERPROP_FLAGS_STRING)
     ( USERPROP_USESSL,      USERPROP_FLAGS_BOOLEAN|USERPROP_FLAGS_SSLPROP)

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/clientlib/drillClientImpl.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.cpp b/contrib/native/client/src/clientlib/drillClientImpl.cpp
index dce5bdc..a253829 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.cpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.cpp
@@ -243,12 +243,15 @@ void DrillClientImpl::handleHandshake(ByteBuf_t _buf,
         exec::user::BitToUserHandshake b2u;
         b2u.ParseFromArray(msg.m_pbody.data(), msg.m_pbody.size());
         this->m_handshakeVersion=b2u.rpc_version();
+        this->m_handshakeStatus=b2u.status();
+        this->m_handshakeErrorId=b2u.errorid();
+        this->m_handshakeErrorMsg=b2u.errormessage();
 
     }else{
         // boost error
         if(error==boost::asio::error::eof){ // Server broke off the connection
-        handleConnError(CONN_HANDSHAKE_FAILED,
-                getMessage(ERR_CONN_NOHSHAKE, DRILL_RPC_VERSION, m_handshakeVersion));
+            handleConnError(CONN_HANDSHAKE_FAILED,
+                getMessage(ERR_CONN_NOHSHAKE, DRILL_RPC_VERSION));
         }else{
             handleConnError(CONN_FAILURE, getMessage(ERR_CONN_RDFAIL, error.message().c_str()));
         }
@@ -284,12 +287,13 @@ connectionStatus_t DrillClientImpl::validateHandshake(DrillUserProperties*
prope
     u2b.set_support_listening(true);
 
     if(properties != NULL && properties->size()>0){
+        std::string username;
         std::string err;
         if(!properties->validate(err)){
             DRILL_LOG(LOG_INFO) << "Invalid user input:" << err << std::endl;
         }
         exec::user::UserProperties* userProperties = u2b.mutable_properties();
-          
+
         std::map<char,int>::iterator it;
         for(size_t i=0; i<properties->size(); i++){
             std::map<std::string,uint32_t>::const_iterator it=DrillUserProperties::USER_PROPERTIES.find(properties->keyAt(i));
@@ -302,6 +306,13 @@ connectionStatus_t DrillClientImpl::validateHandshake(DrillUserProperties*
prope
                 exec::user::Property* connProp = userProperties->add_properties();
                 connProp->set_key(properties->keyAt(i));
                 connProp->set_value(properties->valueAt(i));
+                //Username(but not the password) also needs to be set in UserCredentials
+                if(IS_BITSET((*it).second,USERPROP_FLAGS_USERNAME)){
+                    exec::shared::UserCredentials* creds = u2b.mutable_credentials();
+                    username=properties->valueAt(i);
+                    creds->set_user_name(username);
+                    //u2b.set_credentials(&creds);
+                }
                 if(IS_BITSET((*it).second,USERPROP_FLAGS_PASSWORD)){
                     DRILL_LOG(LOG_INFO) <<  properties->keyAt(i) << ": **********
" << std::endl;
                 }else{
@@ -324,11 +335,31 @@ connectionStatus_t DrillClientImpl::validateHandshake(DrillUserProperties*
prope
     if(ret!=CONN_SUCCESS){
         return ret;
     }
-    if(m_handshakeVersion != u2b.rpc_version()) {
-        DRILL_LOG(LOG_TRACE) << "Invalid rpc version.  Expected "
-            << DRILL_RPC_VERSION << ", actual "<< m_handshakeVersion <<
"." << std::endl;
-        return handleConnError(CONN_HANDSHAKE_FAILED,
-                getMessage(ERR_CONN_NOHSHAKE, DRILL_RPC_VERSION, m_handshakeVersion));
+    if(this->m_handshakeStatus != exec::user::SUCCESS){
+        switch(this->m_handshakeStatus){
+            case exec::user::RPC_VERSION_MISMATCH:
+                DRILL_LOG(LOG_TRACE) << "Invalid rpc version.  Expected "
+                    << DRILL_RPC_VERSION << ", actual "<< m_handshakeVersion
<< "." << std::endl;
+                return handleConnError(CONN_HANDSHAKE_FAILED,
+                        getMessage(ERR_CONN_BAD_RPC_VER, DRILL_RPC_VERSION,
+                            m_handshakeVersion,
+                            this->m_handshakeErrorId.c_str(),
+                            this->m_handshakeErrorMsg.c_str()));
+            case exec::user::AUTH_FAILED:
+                DRILL_LOG(LOG_TRACE) << "Authentication failed." << std::endl;
+                return handleConnError(CONN_HANDSHAKE_FAILED,
+                        getMessage(ERR_CONN_AUTHFAIL,
+                            this->m_handshakeErrorId.c_str(),
+                            this->m_handshakeErrorMsg.c_str()));
+            case exec::user::UNKNOWN_FAILURE:
+                DRILL_LOG(LOG_TRACE) << "Unknown error during handshake." <<
std::endl;
+                return handleConnError(CONN_HANDSHAKE_FAILED,
+                        getMessage(ERR_CONN_UNKNOWN_ERR,
+                            this->m_handshakeErrorId.c_str(),
+                            this->m_handshakeErrorMsg.c_str()));
+            default:
+                break;
+        }
     }
     // reset io_service after handshake is validated before running queries
     m_io_service.reset();

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/clientlib/drillClientImpl.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/drillClientImpl.hpp b/contrib/native/client/src/clientlib/drillClientImpl.hpp
index 95fe922..04d59c7 100644
--- a/contrib/native/client/src/clientlib/drillClientImpl.hpp
+++ b/contrib/native/client/src/clientlib/drillClientImpl.hpp
@@ -193,12 +193,13 @@ class DrillClientImpl{
         DrillClientImpl():
             m_coordinationId(1),
             m_handshakeVersion(0),
+            m_handshakeStatus(exec::user::SUCCESS),
             m_bIsConnected(false),
             m_pendingRequests(0),
             m_pError(NULL),
             m_pListenerThread(NULL),
-            m_socket(m_io_service),
             m_pWork(NULL),
+            m_socket(m_io_service),
             m_deadlineTimer(m_io_service),
             m_rbuf(NULL),
             m_wbuf(MAX_SOCK_RD_BUFSIZE)
@@ -307,6 +308,9 @@ class DrillClientImpl{
 
         int32_t m_coordinationId;
         int32_t m_handshakeVersion;
+        exec::user::HandshakeStatus m_handshakeStatus;
+        std::string m_handshakeErrorId;
+        std::string m_handshakeErrorMsg;
         bool m_bIsConnected;
 
         // number of outstanding read requests.

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/clientlib/errmsgs.cpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/errmsgs.cpp b/contrib/native/client/src/clientlib/errmsgs.cpp
index fa72721..11661f8 100644
--- a/contrib/native/client/src/clientlib/errmsgs.cpp
+++ b/contrib/native/client/src/clientlib/errmsgs.cpp
@@ -32,7 +32,8 @@ static Drill::ErrorMessages errorMessages[]={
     {ERR_CONN_RDFAIL, ERR_CATEGORY_CONN, 0, "Connection failed with error: %s."},
     {ERR_CONN_WFAIL, ERR_CATEGORY_CONN, 0, "Synchronous socket write failed with error: %s."},
     {ERR_CONN_ZOOKEEPER, ERR_CATEGORY_CONN, 0, "Zookeeper error. %s"},
-    {ERR_CONN_NOHSHAKE, ERR_CATEGORY_CONN, 0, "Handshake failed: Expected RPC version %d,
got %d."},
+    {ERR_CONN_NOHSHAKE, ERR_CATEGORY_CONN, 0, "Handshake failed because the server killed
the connection. "
+        "Expected RPC version %d."},
     {ERR_CONN_ZKFAIL, ERR_CATEGORY_CONN, 0, "Failed to connect to Zookeeper."},
     {ERR_CONN_ZKTIMOUT, ERR_CATEGORY_CONN, 0, "Timed out while waiting to connect."},
     {ERR_CONN_ZKERR, ERR_CATEGORY_CONN, 0, "Error in reading from Zookeeper (error code:
%d)."},
@@ -41,6 +42,11 @@ static Drill::ErrorMessages errorMessages[]={
     {ERR_CONN_ZKNOAUTH, ERR_CATEGORY_CONN, 0, "Authentication failed."},
     {ERR_CONN_ZKEXP, ERR_CATEGORY_CONN, 0, "Session expired."},
     {ERR_CONN_HSHAKETIMOUT, ERR_CATEGORY_CONN, 0, "Handshake Timeout."},
+    {ERR_CONN_BAD_RPC_VER, ERR_CATEGORY_CONN, 0, "Handshake failed because of a RPC version
mismatch. "
+        "Expected RPC version %d, got %d. [Server message was: (%s) %s]"},
+    {ERR_CONN_AUTHFAIL, ERR_CATEGORY_CONN, 0, "User authentication failed (please check the
username and password)."
+        "[Server message was: (%s) %s]"},
+    {ERR_CONN_UNKNOWN_ERR, ERR_CATEGORY_CONN, 0, "Handshake Failed due to an error on the
server. [Server message was: (%s) %s]"},
     {ERR_QRY_OUTOFMEM, ERR_CATEGORY_QRY, 0, "Out of memory."},
     {ERR_QRY_COMMERR, ERR_CATEGORY_QRY, 0, "Communication error. %s"},
     {ERR_QRY_INVREADLEN, ERR_CATEGORY_QRY, 0, "Internal Error: Received a message with an
invalid read length."},

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/clientlib/errmsgs.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/clientlib/errmsgs.hpp b/contrib/native/client/src/clientlib/errmsgs.hpp
index 22e544f..b82efaa 100644
--- a/contrib/native/client/src/clientlib/errmsgs.hpp
+++ b/contrib/native/client/src/clientlib/errmsgs.hpp
@@ -46,7 +46,10 @@ namespace Drill{
 #define ERR_CONN_ZKNOAUTH       DRILL_ERR_START+13
 #define ERR_CONN_ZKEXP          DRILL_ERR_START+14
 #define ERR_CONN_HSHAKETIMOUT   DRILL_ERR_START+15
-#define ERR_CONN_MAX            DRILL_ERR_START+15
+#define ERR_CONN_BAD_RPC_VER    DRILL_ERR_START+16
+#define ERR_CONN_AUTHFAIL       DRILL_ERR_START+17
+#define ERR_CONN_UNKNOWN_ERR    DRILL_ERR_START+18
+#define ERR_CONN_MAX            DRILL_ERR_START+18
 
 #define ERR_QRY_OUTOFMEM    ERR_CONN_MAX+1
 #define ERR_QRY_COMMERR     ERR_CONN_MAX+2

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/include/drill/common.hpp
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/include/drill/common.hpp b/contrib/native/client/src/include/drill/common.hpp
index 72b9a98..6662754 100644
--- a/contrib/native/client/src/include/drill/common.hpp
+++ b/contrib/native/client/src/include/drill/common.hpp
@@ -34,7 +34,7 @@
 #include <vector>
 #include <boost/shared_ptr.hpp>
 
-#define DRILL_RPC_VERSION 4
+#define DRILL_RPC_VERSION 5
 
 #define LENGTH_PREFIX_MAX_LENGTH 5
 #define LEN_PREFIX_BUFLEN LENGTH_PREFIX_MAX_LENGTH
@@ -142,11 +142,12 @@ typedef enum{
 // Used in DrillUserProperties::USER_PROPERTIES
 #define USERPROP_FLAGS_SERVERPROP 0x00000001
 #define USERPROP_FLAGS_SSLPROP    0x00000002
-#define USERPROP_FLAGS_PASSWORD   0x00000004
-#define USERPROP_FLAGS_FILENAME   0x00000008
-#define USERPROP_FLAGS_FILEPATH   0x00000010
-#define USERPROP_FLAGS_STRING     0x00000020
-#define USERPROP_FLAGS_BOOLEAN    0x00000040
+#define USERPROP_FLAGS_USERNAME   0x00000004
+#define USERPROP_FLAGS_PASSWORD   0x00000008
+#define USERPROP_FLAGS_FILENAME   0x00000010
+#define USERPROP_FLAGS_FILEPATH   0x00000020
+#define USERPROP_FLAGS_STRING     0x00000040
+#define USERPROP_FLAGS_BOOLEAN    0x00000080
 
 #define IS_BITSET(val, bit) \
     ((val&bit)==bit)

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/protobuf/User.pb.cc
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/User.pb.cc b/contrib/native/client/src/protobuf/User.pb.cc
index 360becb..59f2157 100644
--- a/contrib/native/client/src/protobuf/User.pb.cc
+++ b/contrib/native/client/src/protobuf/User.pb.cc
@@ -41,6 +41,7 @@ const ::google::protobuf::internal::GeneratedMessageReflection*
   BitToUserHandshake_reflection_ = NULL;
 const ::google::protobuf::EnumDescriptor* RpcType_descriptor_ = NULL;
 const ::google::protobuf::EnumDescriptor* QueryResultsMode_descriptor_ = NULL;
+const ::google::protobuf::EnumDescriptor* HandshakeStatus_descriptor_ = NULL;
 
 }  // namespace
 
@@ -136,8 +137,11 @@ void protobuf_AssignDesc_User_2eproto() {
       ::google::protobuf::MessageFactory::generated_factory(),
       sizeof(RunQuery));
   BitToUserHandshake_descriptor_ = file->message_type(5);
-  static const int BitToUserHandshake_offsets_[1] = {
+  static const int BitToUserHandshake_offsets_[4] = {
     GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BitToUserHandshake, rpc_version_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BitToUserHandshake, status_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BitToUserHandshake, errorid_),
+    GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(BitToUserHandshake, errormessage_),
   };
   BitToUserHandshake_reflection_ =
     new ::google::protobuf::internal::GeneratedMessageReflection(
@@ -152,6 +156,7 @@ void protobuf_AssignDesc_User_2eproto() {
       sizeof(BitToUserHandshake));
   RpcType_descriptor_ = file->enum_type(0);
   QueryResultsMode_descriptor_ = file->enum_type(1);
+  HandshakeStatus_descriptor_ = file->enum_type(2);
 }
 
 namespace {
@@ -219,15 +224,20 @@ void protobuf_AddDesc_User_2eproto() {
     "imum_responses\030\002 \001(\005\"q\n\010RunQuery\0221\n\014resu"
     "lts_mode\030\001 \001(\0162\033.exec.user.QueryResultsM"
     "ode\022$\n\004type\030\002 \001(\0162\026.exec.shared.QueryTyp"
-    "e\022\014\n\004plan\030\003 \001(\t\")\n\022BitToUserHandshake\022\023\n"
-    "\013rpc_version\030\002 \001(\005*\310\001\n\007RpcType\022\r\n\tHANDSH"
-    "AKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002\022\r\n\tRUN_QUERY"
-    "\020\003\022\020\n\014CANCEL_QUERY\020\004\022\023\n\017REQUEST_RESULTS\020"
-    "\005\022\016\n\nQUERY_DATA\020\006\022\020\n\014QUERY_HANDLE\020\007\022\026\n\022R"
-    "EQ_META_FUNCTIONS\020\010\022\026\n\022RESP_FUNCTION_LIS"
-    "T\020\t\022\020\n\014QUERY_RESULT\020\n*#\n\020QueryResultsMod"
-    "e\022\017\n\013STREAM_FULL\020\001B+\n\033org.apache.drill.e"
-    "xec.protoB\nUserProtosH\001", 943);
+    "e\022\014\n\004plan\030\003 \001(\t\"|\n\022BitToUserHandshake\022\023\n"
+    "\013rpc_version\030\002 \001(\005\022*\n\006status\030\003 \001(\0162\032.exe"
+    "c.user.HandshakeStatus\022\017\n\007errorId\030\004 \001(\t\022"
+    "\024\n\014errorMessage\030\005 \001(\t*\310\001\n\007RpcType\022\r\n\tHAN"
+    "DSHAKE\020\000\022\007\n\003ACK\020\001\022\013\n\007GOODBYE\020\002\022\r\n\tRUN_QU"
+    "ERY\020\003\022\020\n\014CANCEL_QUERY\020\004\022\023\n\017REQUEST_RESUL"
+    "TS\020\005\022\016\n\nQUERY_DATA\020\006\022\020\n\014QUERY_HANDLE\020\007\022\026"
+    "\n\022REQ_META_FUNCTIONS\020\010\022\026\n\022RESP_FUNCTION_"
+    "LIST\020\t\022\020\n\014QUERY_RESULT\020\n*#\n\020QueryResults"
+    "Mode\022\017\n\013STREAM_FULL\020\001*^\n\017HandshakeStatus"
+    "\022\013\n\007SUCCESS\020\001\022\030\n\024RPC_VERSION_MISMATCH\020\002\022"
+    "\017\n\013AUTH_FAILED\020\003\022\023\n\017UNKNOWN_FAILURE\020\004B+\n"
+    "\033org.apache.drill.exec.protoB\nUserProtos"
+    "H\001", 1122);
   ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
     "User.proto", &protobuf_RegisterTypes);
   Property::default_instance_ = new Property();
@@ -287,6 +297,22 @@ bool QueryResultsMode_IsValid(int value) {
   }
 }
 
+const ::google::protobuf::EnumDescriptor* HandshakeStatus_descriptor() {
+  protobuf_AssignDescriptorsOnce();
+  return HandshakeStatus_descriptor_;
+}
+bool HandshakeStatus_IsValid(int value) {
+  switch(value) {
+    case 1:
+    case 2:
+    case 3:
+    case 4:
+      return true;
+    default:
+      return false;
+  }
+}
+
 
 // ===================================================================
 
@@ -1774,6 +1800,9 @@ void RunQuery::Swap(RunQuery* other) {
 
 #ifndef _MSC_VER
 const int BitToUserHandshake::kRpcVersionFieldNumber;
+const int BitToUserHandshake::kStatusFieldNumber;
+const int BitToUserHandshake::kErrorIdFieldNumber;
+const int BitToUserHandshake::kErrorMessageFieldNumber;
 #endif  // !_MSC_VER
 
 BitToUserHandshake::BitToUserHandshake()
@@ -1793,6 +1822,9 @@ BitToUserHandshake::BitToUserHandshake(const BitToUserHandshake&
from)
 void BitToUserHandshake::SharedCtor() {
   _cached_size_ = 0;
   rpc_version_ = 0;
+  status_ = 1;
+  errorid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  errormessage_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
   ::memset(_has_bits_, 0, sizeof(_has_bits_));
 }
 
@@ -1801,6 +1833,12 @@ BitToUserHandshake::~BitToUserHandshake() {
 }
 
 void BitToUserHandshake::SharedDtor() {
+  if (errorid_ != &::google::protobuf::internal::kEmptyString) {
+    delete errorid_;
+  }
+  if (errormessage_ != &::google::protobuf::internal::kEmptyString) {
+    delete errormessage_;
+  }
   if (this != default_instance_) {
   }
 }
@@ -1829,6 +1867,17 @@ BitToUserHandshake* BitToUserHandshake::New() const {
 void BitToUserHandshake::Clear() {
   if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
     rpc_version_ = 0;
+    status_ = 1;
+    if (has_errorid()) {
+      if (errorid_ != &::google::protobuf::internal::kEmptyString) {
+        errorid_->clear();
+      }
+    }
+    if (has_errormessage()) {
+      if (errormessage_ != &::google::protobuf::internal::kEmptyString) {
+        errormessage_->clear();
+      }
+    }
   }
   ::memset(_has_bits_, 0, sizeof(_has_bits_));
   mutable_unknown_fields()->Clear();
@@ -1851,6 +1900,61 @@ bool BitToUserHandshake::MergePartialFromCodedStream(
         } else {
           goto handle_uninterpreted;
         }
+        if (input->ExpectTag(24)) goto parse_status;
+        break;
+      }
+
+      // optional .exec.user.HandshakeStatus status = 3;
+      case 3: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
+         parse_status:
+          int value;
+          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
+                   int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
+                 input, &value)));
+          if (::exec::user::HandshakeStatus_IsValid(value)) {
+            set_status(static_cast< ::exec::user::HandshakeStatus >(value));
+          } else {
+            mutable_unknown_fields()->AddVarint(3, value);
+          }
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(34)) goto parse_errorId;
+        break;
+      }
+
+      // optional string errorId = 4;
+      case 4: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_errorId:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_errorid()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->errorid().data(), this->errorid().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
+        if (input->ExpectTag(42)) goto parse_errorMessage;
+        break;
+      }
+
+      // optional string errorMessage = 5;
+      case 5: {
+        if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
+            ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
+         parse_errorMessage:
+          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
+                input, this->mutable_errormessage()));
+          ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+            this->errormessage().data(), this->errormessage().length(),
+            ::google::protobuf::internal::WireFormat::PARSE);
+        } else {
+          goto handle_uninterpreted;
+        }
         if (input->ExpectAtEnd()) return true;
         break;
       }
@@ -1878,6 +1982,30 @@ void BitToUserHandshake::SerializeWithCachedSizes(
     ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->rpc_version(), output);
   }
 
+  // optional .exec.user.HandshakeStatus status = 3;
+  if (has_status()) {
+    ::google::protobuf::internal::WireFormatLite::WriteEnum(
+      3, this->status(), output);
+  }
+
+  // optional string errorId = 4;
+  if (has_errorid()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->errorid().data(), this->errorid().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      4, this->errorid(), output);
+  }
+
+  // optional string errorMessage = 5;
+  if (has_errormessage()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->errormessage().data(), this->errormessage().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    ::google::protobuf::internal::WireFormatLite::WriteString(
+      5, this->errormessage(), output);
+  }
+
   if (!unknown_fields().empty()) {
     ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
         unknown_fields(), output);
@@ -1891,6 +2019,32 @@ void BitToUserHandshake::SerializeWithCachedSizes(
     target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->rpc_version(),
target);
   }
 
+  // optional .exec.user.HandshakeStatus status = 3;
+  if (has_status()) {
+    target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
+      3, this->status(), target);
+  }
+
+  // optional string errorId = 4;
+  if (has_errorid()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->errorid().data(), this->errorid().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        4, this->errorid(), target);
+  }
+
+  // optional string errorMessage = 5;
+  if (has_errormessage()) {
+    ::google::protobuf::internal::WireFormat::VerifyUTF8String(
+      this->errormessage().data(), this->errormessage().length(),
+      ::google::protobuf::internal::WireFormat::SERIALIZE);
+    target =
+      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
+        5, this->errormessage(), target);
+  }
+
   if (!unknown_fields().empty()) {
     target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
         unknown_fields(), target);
@@ -1909,6 +2063,26 @@ int BitToUserHandshake::ByteSize() const {
           this->rpc_version());
     }
 
+    // optional .exec.user.HandshakeStatus status = 3;
+    if (has_status()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::EnumSize(this->status());
+    }
+
+    // optional string errorId = 4;
+    if (has_errorid()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->errorid());
+    }
+
+    // optional string errorMessage = 5;
+    if (has_errormessage()) {
+      total_size += 1 +
+        ::google::protobuf::internal::WireFormatLite::StringSize(
+          this->errormessage());
+    }
+
   }
   if (!unknown_fields().empty()) {
     total_size +=
@@ -1939,6 +2113,15 @@ void BitToUserHandshake::MergeFrom(const BitToUserHandshake& from)
{
     if (from.has_rpc_version()) {
       set_rpc_version(from.rpc_version());
     }
+    if (from.has_status()) {
+      set_status(from.status());
+    }
+    if (from.has_errorid()) {
+      set_errorid(from.errorid());
+    }
+    if (from.has_errormessage()) {
+      set_errormessage(from.errormessage());
+    }
   }
   mutable_unknown_fields()->MergeFrom(from.unknown_fields());
 }
@@ -1963,6 +2146,9 @@ bool BitToUserHandshake::IsInitialized() const {
 void BitToUserHandshake::Swap(BitToUserHandshake* other) {
   if (other != this) {
     std::swap(rpc_version_, other->rpc_version_);
+    std::swap(status_, other->status_);
+    std::swap(errorid_, other->errorid_);
+    std::swap(errormessage_, other->errormessage_);
     std::swap(_has_bits_[0], other->_has_bits_[0]);
     _unknown_fields_.Swap(&other->_unknown_fields_);
     std::swap(_cached_size_, other->_cached_size_);

http://git-wip-us.apache.org/repos/asf/drill/blob/862ab91e/contrib/native/client/src/protobuf/User.pb.h
----------------------------------------------------------------------
diff --git a/contrib/native/client/src/protobuf/User.pb.h b/contrib/native/client/src/protobuf/User.pb.h
index 69daf50..c7deac3 100644
--- a/contrib/native/client/src/protobuf/User.pb.h
+++ b/contrib/native/client/src/protobuf/User.pb.h
@@ -90,6 +90,27 @@ inline bool QueryResultsMode_Parse(
   return ::google::protobuf::internal::ParseNamedEnum<QueryResultsMode>(
     QueryResultsMode_descriptor(), name, value);
 }
+enum HandshakeStatus {
+  SUCCESS = 1,
+  RPC_VERSION_MISMATCH = 2,
+  AUTH_FAILED = 3,
+  UNKNOWN_FAILURE = 4
+};
+bool HandshakeStatus_IsValid(int value);
+const HandshakeStatus HandshakeStatus_MIN = SUCCESS;
+const HandshakeStatus HandshakeStatus_MAX = UNKNOWN_FAILURE;
+const int HandshakeStatus_ARRAYSIZE = HandshakeStatus_MAX + 1;
+
+const ::google::protobuf::EnumDescriptor* HandshakeStatus_descriptor();
+inline const ::std::string& HandshakeStatus_Name(HandshakeStatus value) {
+  return ::google::protobuf::internal::NameOfEnum(
+    HandshakeStatus_descriptor(), value);
+}
+inline bool HandshakeStatus_Parse(
+    const ::std::string& name, HandshakeStatus* value) {
+  return ::google::protobuf::internal::ParseNamedEnum<HandshakeStatus>(
+    HandshakeStatus_descriptor(), name, value);
+}
 // ===================================================================
 
 class Property : public ::google::protobuf::Message {
@@ -677,17 +698,57 @@ class BitToUserHandshake : public ::google::protobuf::Message {
   inline ::google::protobuf::int32 rpc_version() const;
   inline void set_rpc_version(::google::protobuf::int32 value);
 
+  // optional .exec.user.HandshakeStatus status = 3;
+  inline bool has_status() const;
+  inline void clear_status();
+  static const int kStatusFieldNumber = 3;
+  inline ::exec::user::HandshakeStatus status() const;
+  inline void set_status(::exec::user::HandshakeStatus value);
+
+  // optional string errorId = 4;
+  inline bool has_errorid() const;
+  inline void clear_errorid();
+  static const int kErrorIdFieldNumber = 4;
+  inline const ::std::string& errorid() const;
+  inline void set_errorid(const ::std::string& value);
+  inline void set_errorid(const char* value);
+  inline void set_errorid(const char* value, size_t size);
+  inline ::std::string* mutable_errorid();
+  inline ::std::string* release_errorid();
+  inline void set_allocated_errorid(::std::string* errorid);
+
+  // optional string errorMessage = 5;
+  inline bool has_errormessage() const;
+  inline void clear_errormessage();
+  static const int kErrorMessageFieldNumber = 5;
+  inline const ::std::string& errormessage() const;
+  inline void set_errormessage(const ::std::string& value);
+  inline void set_errormessage(const char* value);
+  inline void set_errormessage(const char* value, size_t size);
+  inline ::std::string* mutable_errormessage();
+  inline ::std::string* release_errormessage();
+  inline void set_allocated_errormessage(::std::string* errormessage);
+
   // @@protoc_insertion_point(class_scope:exec.user.BitToUserHandshake)
  private:
   inline void set_has_rpc_version();
   inline void clear_has_rpc_version();
+  inline void set_has_status();
+  inline void clear_has_status();
+  inline void set_has_errorid();
+  inline void clear_has_errorid();
+  inline void set_has_errormessage();
+  inline void clear_has_errormessage();
 
   ::google::protobuf::UnknownFieldSet _unknown_fields_;
 
   ::google::protobuf::int32 rpc_version_;
+  int status_;
+  ::std::string* errorid_;
+  ::std::string* errormessage_;
 
   mutable int _cached_size_;
-  ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
+  ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
 
   friend void  protobuf_AddDesc_User_2eproto();
   friend void protobuf_AssignDesc_User_2eproto();
@@ -1251,6 +1312,169 @@ inline void BitToUserHandshake::set_rpc_version(::google::protobuf::int32
value)
   rpc_version_ = value;
 }
 
+// optional .exec.user.HandshakeStatus status = 3;
+inline bool BitToUserHandshake::has_status() const {
+  return (_has_bits_[0] & 0x00000002u) != 0;
+}
+inline void BitToUserHandshake::set_has_status() {
+  _has_bits_[0] |= 0x00000002u;
+}
+inline void BitToUserHandshake::clear_has_status() {
+  _has_bits_[0] &= ~0x00000002u;
+}
+inline void BitToUserHandshake::clear_status() {
+  status_ = 1;
+  clear_has_status();
+}
+inline ::exec::user::HandshakeStatus BitToUserHandshake::status() const {
+  return static_cast< ::exec::user::HandshakeStatus >(status_);
+}
+inline void BitToUserHandshake::set_status(::exec::user::HandshakeStatus value) {
+  assert(::exec::user::HandshakeStatus_IsValid(value));
+  set_has_status();
+  status_ = value;
+}
+
+// optional string errorId = 4;
+inline bool BitToUserHandshake::has_errorid() const {
+  return (_has_bits_[0] & 0x00000004u) != 0;
+}
+inline void BitToUserHandshake::set_has_errorid() {
+  _has_bits_[0] |= 0x00000004u;
+}
+inline void BitToUserHandshake::clear_has_errorid() {
+  _has_bits_[0] &= ~0x00000004u;
+}
+inline void BitToUserHandshake::clear_errorid() {
+  if (errorid_ != &::google::protobuf::internal::kEmptyString) {
+    errorid_->clear();
+  }
+  clear_has_errorid();
+}
+inline const ::std::string& BitToUserHandshake::errorid() const {
+  return *errorid_;
+}
+inline void BitToUserHandshake::set_errorid(const ::std::string& value) {
+  set_has_errorid();
+  if (errorid_ == &::google::protobuf::internal::kEmptyString) {
+    errorid_ = new ::std::string;
+  }
+  errorid_->assign(value);
+}
+inline void BitToUserHandshake::set_errorid(const char* value) {
+  set_has_errorid();
+  if (errorid_ == &::google::protobuf::internal::kEmptyString) {
+    errorid_ = new ::std::string;
+  }
+  errorid_->assign(value);
+}
+inline void BitToUserHandshake::set_errorid(const char* value, size_t size) {
+  set_has_errorid();
+  if (errorid_ == &::google::protobuf::internal::kEmptyString) {
+    errorid_ = new ::std::string;
+  }
+  errorid_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* BitToUserHandshake::mutable_errorid() {
+  set_has_errorid();
+  if (errorid_ == &::google::protobuf::internal::kEmptyString) {
+    errorid_ = new ::std::string;
+  }
+  return errorid_;
+}
+inline ::std::string* BitToUserHandshake::release_errorid() {
+  clear_has_errorid();
+  if (errorid_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = errorid_;
+    errorid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void BitToUserHandshake::set_allocated_errorid(::std::string* errorid) {
+  if (errorid_ != &::google::protobuf::internal::kEmptyString) {
+    delete errorid_;
+  }
+  if (errorid) {
+    set_has_errorid();
+    errorid_ = errorid;
+  } else {
+    clear_has_errorid();
+    errorid_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
+// optional string errorMessage = 5;
+inline bool BitToUserHandshake::has_errormessage() const {
+  return (_has_bits_[0] & 0x00000008u) != 0;
+}
+inline void BitToUserHandshake::set_has_errormessage() {
+  _has_bits_[0] |= 0x00000008u;
+}
+inline void BitToUserHandshake::clear_has_errormessage() {
+  _has_bits_[0] &= ~0x00000008u;
+}
+inline void BitToUserHandshake::clear_errormessage() {
+  if (errormessage_ != &::google::protobuf::internal::kEmptyString) {
+    errormessage_->clear();
+  }
+  clear_has_errormessage();
+}
+inline const ::std::string& BitToUserHandshake::errormessage() const {
+  return *errormessage_;
+}
+inline void BitToUserHandshake::set_errormessage(const ::std::string& value) {
+  set_has_errormessage();
+  if (errormessage_ == &::google::protobuf::internal::kEmptyString) {
+    errormessage_ = new ::std::string;
+  }
+  errormessage_->assign(value);
+}
+inline void BitToUserHandshake::set_errormessage(const char* value) {
+  set_has_errormessage();
+  if (errormessage_ == &::google::protobuf::internal::kEmptyString) {
+    errormessage_ = new ::std::string;
+  }
+  errormessage_->assign(value);
+}
+inline void BitToUserHandshake::set_errormessage(const char* value, size_t size) {
+  set_has_errormessage();
+  if (errormessage_ == &::google::protobuf::internal::kEmptyString) {
+    errormessage_ = new ::std::string;
+  }
+  errormessage_->assign(reinterpret_cast<const char*>(value), size);
+}
+inline ::std::string* BitToUserHandshake::mutable_errormessage() {
+  set_has_errormessage();
+  if (errormessage_ == &::google::protobuf::internal::kEmptyString) {
+    errormessage_ = new ::std::string;
+  }
+  return errormessage_;
+}
+inline ::std::string* BitToUserHandshake::release_errormessage() {
+  clear_has_errormessage();
+  if (errormessage_ == &::google::protobuf::internal::kEmptyString) {
+    return NULL;
+  } else {
+    ::std::string* temp = errormessage_;
+    errormessage_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+    return temp;
+  }
+}
+inline void BitToUserHandshake::set_allocated_errormessage(::std::string* errormessage) {
+  if (errormessage_ != &::google::protobuf::internal::kEmptyString) {
+    delete errormessage_;
+  }
+  if (errormessage) {
+    set_has_errormessage();
+    errormessage_ = errormessage;
+  } else {
+    clear_has_errormessage();
+    errormessage_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+  }
+}
+
 
 // @@protoc_insertion_point(namespace_scope)
 
@@ -1269,6 +1493,10 @@ template <>
 inline const EnumDescriptor* GetEnumDescriptor< ::exec::user::QueryResultsMode>() {
   return ::exec::user::QueryResultsMode_descriptor();
 }
+template <>
+inline const EnumDescriptor* GetEnumDescriptor< ::exec::user::HandshakeStatus>() {
+  return ::exec::user::HandshakeStatus_descriptor();
+}
 
 }  // namespace google
 }  // namespace protobuf


Mime
View raw message