From b4cb361754e226fee9ec76ce80ee1163e2c1a129 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Tue, 14 May 2024 10:42:00 +0200 Subject: [PATCH] HDDS-10371. NPE in OzoneAclUtils.isOwner --- .../org/apache/hadoop/ozone/om/OzoneAclUtils.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneAclUtils.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneAclUtils.java index cb42a0a881c..ed2527e0302 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneAclUtils.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneAclUtils.java @@ -83,8 +83,6 @@ public static void checkAllAcls(OmMetadataReader omMetadataReader, String bucketOwner, UserGroupInformation user, InetAddress remoteAddress, String hostName) throws IOException { - boolean isVolOwner = isOwner(user, volOwner); - switch (resType) { //For Volume level access we only need to check {OWNER} equal // to Volume Owner. @@ -100,7 +98,7 @@ public static void checkAllAcls(OmMetadataReader omMetadataReader, // volume owner if current ugi user is volume owner else we need check //{OWNER} equals bucket owner for bucket/key/prefix. case PREFIX: - if (isVolOwner) { + if (isOwner(user, volOwner)) { omMetadataReader.checkAcls(resType, storeType, aclType, vol, bucket, key, user, remoteAddress, hostName, true, @@ -184,12 +182,6 @@ public static IAccessAuthorizer.ACLType getParentNativeAcl( private static boolean isOwner(UserGroupInformation callerUgi, String ownerName) { - if (ownerName == null) { - return false; - } - if (callerUgi.getShortUserName().equals(ownerName)) { - return true; - } - return false; + return ownerName != null && ownerName.equals(callerUgi.getShortUserName()); } }