You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/02/04 06:08:35 UTC

[GitHub] [ozone] sadanand48 commented on a change in pull request #1888: HDDS-4787.Trash emptier fails to create checkpoints in a secure setup

sadanand48 commented on a change in pull request #1888:
URL: https://github.com/apache/ozone/pull/1888#discussion_r569968400



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -1688,11 +1697,17 @@ public void createVolume(OmVolumeArgs args) throws IOException {
    */
   private void checkAcls(ResourceType resType, StoreType store,
       ACLType acl, String vol, String bucket, String key)
-      throws OMException {
+      throws IOException {
     checkAcls(resType, store, acl, vol, bucket, key,
-        ProtobufRpcEngine.Server.getRemoteUser(),
-        ProtobufRpcEngine.Server.getRemoteIp(),
-        ProtobufRpcEngine.Server.getRemoteIp().getHostName(),
+        ProtobufRpcEngine.Server.getRemoteUser() != null ?
+            ProtobufRpcEngine.Server.getRemoteUser() :

Review comment:
       Done.

##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/TrashOzoneFileSystem.java
##########
@@ -490,15 +497,38 @@ boolean processKeyPath(List<String> keyPathList) {
               .setDeleteKeys(deleteKeyArgs)
               .build();
       OzoneManagerProtocolProtos.OMRequest omRequest =
-          OzoneManagerProtocolProtos.OMRequest.newBuilder()
-              .setClientId(CLIENT_ID.toString())
-              .setDeleteKeysRequest(deleteKeysRequest)
-              .setCmdType(OzoneManagerProtocolProtos.Type.DeleteKeys)
-              .build();
+          null;
+      try {
+        omRequest = OzoneManagerProtocolProtos.OMRequest.newBuilder()
+            .setClientId(CLIENT_ID.toString())
+            .setUserInfo(getUserInfo())
+            .setDeleteKeysRequest(deleteKeysRequest)
+            .setCmdType(OzoneManagerProtocolProtos.Type.DeleteKeys)
+            .build();
+      } catch (IOException e) {
+        LOG.error("Couldn't get userinfo", e);
+      }
       return omRequest;
     }
   }
 
+  OzoneManagerProtocolProtos.UserInfo getUserInfo() throws IOException {
+    UserGroupInformation user = UserGroupInformation.getCurrentUser();
+    InetAddress remoteAddress = ozoneManager.getOmRpcServerAddr().getAddress();
+    OzoneManagerProtocolProtos.UserInfo.Builder userInfo =
+        OzoneManagerProtocolProtos.UserInfo.newBuilder();
+    if (user != null) {
+      userInfo.setUserName(user.getUserName());
+    }
+
+    if (remoteAddress != null) {
+      userInfo.setHostName(remoteAddress.getHostName());
+      userInfo.setRemoteAddress(remoteAddress.getHostAddress()).build();

Review comment:
       Done.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org