From common-commits-return-98738-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed May 6 04:25:52 2020 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 [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 245FF180626 for ; Wed, 6 May 2020 06:25:52 +0200 (CEST) Received: (qmail 9084 invoked by uid 500); 6 May 2020 04:25:50 -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 9075 invoked by uid 99); 6 May 2020 04:25:49 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2020 04:25:49 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 764898BFAB; Wed, 6 May 2020 04:25:49 +0000 (UTC) Date: Wed, 06 May 2020 04:25:49 +0000 To: "common-commits@hadoop.apache.org" Subject: [hadoop] branch branch-3.3.0 updated: HDFS-15334. INodeAttributeProvider's new API checkPermissionWithContext not getting called in for authorization. (#1998) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <158873914920.10987.12060616744598843353@gitbox.apache.org> From: weichiu@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: hadoop X-Git-Refname: refs/heads/branch-3.3.0 X-Git-Reftype: branch X-Git-Oldrev: adfb68cb220eaeae5af4709313f6e8515ad27c9e X-Git-Newrev: 3d8e392eb49f5ccc1031b97a0ae4f976ef70a8cd X-Git-Rev: 3d8e392eb49f5ccc1031b97a0ae4f976ef70a8cd X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. weichiu pushed a commit to branch branch-3.3.0 in repository https://gitbox.apache.org/repos/asf/hadoop.git The following commit(s) were added to refs/heads/branch-3.3.0 by this push: new 3d8e392 HDFS-15334. INodeAttributeProvider's new API checkPermissionWithContext not getting called in for authorization. (#1998) 3d8e392 is described below commit 3d8e392eb49f5ccc1031b97a0ae4f976ef70a8cd Author: Wei-Chiu Chuang AuthorDate: Tue May 5 16:04:54 2020 -0700 HDFS-15334. INodeAttributeProvider's new API checkPermissionWithContext not getting called in for authorization. (#1998) Reviewed-by: Arpit Agarwal (cherry picked from commit adecdb8b534c536354f4f47789467ffb82dd1496) (cherry picked from commit f4c05f1d93718c5cd574abf40c14510886289353) --- .../org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java index 15389d6..7eae564 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java @@ -73,6 +73,7 @@ import javax.annotation.Nullable; import java.io.Closeable; import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -225,8 +226,18 @@ public class FSDirectory implements Closeable { Class[] cArg = new Class[1]; cArg[0] = INodeAttributeProvider.AuthorizationContext.class; + INodeAttributeProvider.AccessControlEnforcer enforcer = + attributeProvider.getExternalAccessControlEnforcer(null); + + // If external enforcer is null, we use the default enforcer, which + // supports the new API. + if (enforcer == null) { + useAuthorizationWithContextAPI = true; + return; + } + try { - Class clazz = attributeProvider.getClass(); + Class clazz = enforcer.getClass(); clazz.getDeclaredMethod("checkPermissionWithContext", cArg); useAuthorizationWithContextAPI = true; LOG.info("Use the new authorization provider API"); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org