You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by jh...@apache.org on 2017/05/03 16:03:57 UTC
hadoop git commit: HDFS-11730: libhdfs++: RpcConnection should handle
authorization error call id. Contributed by James Clampffer
Repository: hadoop
Updated Branches:
refs/heads/HDFS-8707 1749462e3 -> e73bd5352
HDFS-11730: libhdfs++: RpcConnection should handle authorization error call id. Contributed by James Clampffer
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e73bd535
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e73bd535
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e73bd535
Branch: refs/heads/HDFS-8707
Commit: e73bd5352533a56db3bc18c3596ca494b66f47ce
Parents: 1749462
Author: James <jh...@apache.org>
Authored: Wed May 3 12:03:29 2017 -0400
Committer: James <jh...@apache.org>
Committed: Wed May 3 12:03:29 2017 -0400
----------------------------------------------------------------------
.../src/main/native/libhdfspp/include/hdfspp/status.h | 2 ++
.../src/main/native/libhdfspp/lib/common/status.cc | 13 +++++++++++++
.../native/libhdfspp/lib/rpc/rpc_connection_impl.cc | 4 +++-
3 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e73bd535/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 d2c32b2..6fc00b1 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
@@ -44,6 +44,8 @@ class Status {
static Status Error(const char *error_message);
static Status AuthenticationFailed();
static Status AuthenticationFailed(const char *msg);
+ static Status AuthorizationFailed();
+ static Status AuthorizationFailed(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/e73bd535/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 590a036..5903553 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
@@ -143,6 +143,19 @@ Status Status::AuthenticationFailed(const char *msg) {
return Status(kAuthenticationFailed, formatted.c_str());
}
+Status Status::AuthorizationFailed() {
+ return Status::AuthorizationFailed(nullptr);
+}
+
+Status Status::AuthorizationFailed(const char *msg) {
+ std::string formatted = "AuthorizationFailed";
+ if(msg) {
+ formatted += ": ";
+ formatted += msg;
+ }
+ return Status(kPermissionDenied, formatted.c_str());
+}
+
Status Status::Canceled() {
return Status(kOperationCanceled, "Operation canceled");
}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e73bd535/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection_impl.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection_impl.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection_impl.cc
index 7accaf8..1012a37 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection_impl.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_connection_impl.cc
@@ -175,9 +175,11 @@ Status RpcConnection::HandleRpcResponse(std::shared_ptr<Response> response) {
auto req = RemoveFromRunningQueue(h.callid());
if (!req) {
- LOG_WARN(kRPC, << "RPC response with Unknown call id " << h.callid());
+ LOG_WARN(kRPC, << "RPC response with Unknown call id " << (int32_t)h.callid());
if((int32_t)h.callid() == RpcEngine::kCallIdSasl) {
return Status::AuthenticationFailed("You have an unsecured client connecting to a secured server");
+ } else if((int32_t)h.callid() == RpcEngine::kCallIdAuthorizationFailed) {
+ return Status::AuthorizationFailed("RPC call id indicates an authorization failure");
} else {
return Status::Error("Rpc response with unknown call id");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org