This is an automated email from the ASF dual-hosted git repository.

ritesh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 459feac749 HDDS-10371. NPE in OzoneAclUtils.isOwner (#6676)
459feac749 is described below

commit 459feac74910dfc22d830f983bcbf58d53997776
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Wed May 15 01:44:59 2024 +0200

    HDDS-10371. NPE in OzoneAclUtils.isOwner (#6676)
---
 .../main/java/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 cb42a0a881..ed2527e030 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 final class OzoneAclUtils {
       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 final class OzoneAclUtils {
     // 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 final class OzoneAclUtils {
 
   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());
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to