From common-commits-return-80614-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Mon Mar 26 20:13:42 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E319E180649 for ; Mon, 26 Mar 2018 20:13:41 +0200 (CEST) Received: (qmail 20602 invoked by uid 500); 26 Mar 2018 18:13:23 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 18896 invoked by uid 99); 26 Mar 2018 18:13:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2018 18:13:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7695FF6861; Mon, 26 Mar 2018 18:13:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hanishakoneru@apache.org To: common-commits@hadoop.apache.org Date: Mon, 26 Mar 2018 18:13:34 -0000 Message-Id: In-Reply-To: <5fbdc9cd2baf4381a047e8378ae4388a@git.apache.org> References: <5fbdc9cd2baf4381a047e8378ae4388a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/50] [abbrv] hadoop git commit: HDFS-10685: libhdfs++: return explicit error when non-secured client connects to secured server. Contributed by Kai Jiang. HDFS-10685: libhdfs++: return explicit error when non-secured client connects to secured server. Contributed by Kai Jiang. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/996f140b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/996f140b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/996f140b Branch: refs/heads/HDFS-12996 Commit: 996f140b6c0792e2b8249478acd72a484505f1ca Parents: 881fc77 Author: James Authored: Wed Jan 11 10:54:50 2017 -0500 Committer: Hanisha Koneru Committed: Mon Mar 26 11:11:03 2018 -0700 ---------------------------------------------------------------------- .../src/main/native/libhdfspp/include/hdfspp/status.h | 1 + .../src/main/native/libhdfspp/lib/common/status.cc | 11 ++++++++++- .../main/native/libhdfspp/lib/rpc/cyrus_sasl_engine.cc | 2 +- .../src/main/native/libhdfspp/lib/rpc/rpc_connection.cc | 6 +++++- 4 files changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/996f140b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/status.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/status.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/status.h index 39cf8c6..d2c32b2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/status.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/status.h @@ -43,6 +43,7 @@ class Status { static Status Exception(const char *exception_class_name, const char *exception_details); static Status Error(const char *error_message); static Status AuthenticationFailed(); + static Status AuthenticationFailed(const char *msg); static Status Canceled(); static Status PathNotFound(const char *msg); static Status InvalidOffset(const char *msg); http://git-wip-us.apache.org/repos/asf/hadoop/blob/996f140b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/status.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/status.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/status.cc index 15d304a..590a036 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/status.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/status.cc @@ -131,7 +131,16 @@ Status Status::Error(const char *error_message) { } Status Status::AuthenticationFailed() { - return Status(kAuthenticationFailed, "Authentication failed"); + return Status::AuthenticationFailed(nullptr); +} + +Status Status::AuthenticationFailed(const char *msg) { + std::string formatted = "AuthenticationFailed"; + if(msg) { + formatted += ": "; + formatted += msg; + } + return Status(kAuthenticationFailed, formatted.c_str()); } Status Status::Canceled() { http://git-wip-us.apache.org/repos/asf/hadoop/blob/996f140b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/cyrus_sasl_engine.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/cyrus_sasl_engine.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/cyrus_sasl_engine.cc index ca82305..69b2267 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/cyrus_sasl_engine.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/cyrus_sasl_engine.cc @@ -91,7 +91,7 @@ Status make_status(int rc) { if (rc != SASL_OK && rc != SASL_CONTINUE && rc != SASL_INTERACT) { - return Status::Error(errStr(rc).c_str()); + return Status::AuthenticationFailed(errStr(rc).c_str()); } return Status::OK(); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/996f140b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc index 2068614..f629d1f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection.cc @@ -293,7 +293,11 @@ Status RpcConnection::HandleRpcResponse(std::shared_ptr response) { auto req = RemoveFromRunningQueue(h.callid()); if (!req) { LOG_WARN(kRPC, << "RPC response with Unknown call id " << h.callid()); - return Status::Error("Rpc response with unknown call id"); + if((int32_t)h.callid() == RpcEngine::kCallIdSasl) { + return Status::AuthenticationFailed("You have an unsecured client connecting to a secured server"); + } else { + return Status::Error("Rpc response with unknown call id"); + } } Status status; --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org