You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "fateh288 (via GitHub)" <gi...@apache.org> on 2023/03/02 04:34:52 UTC

[GitHub] [ranger] fateh288 opened a new pull request, #223: RANGER-4043: getent group command incorrectly used with 2 parameters …

fateh288 opened a new pull request, #223:
URL: https://github.com/apache/ranger/pull/223

   …which caused command to return null instead of group info. Corrected the command usage
   
   Description of your changes
   Original command: String[] cmd = new String[] {"bash", "-c", command + " '" + group + "'"};
   Results in: bash -c getent group test_group1 'test_group1' - incorrect
   
   New changed command: String[] cmd = new String[] {"bash", "-c", command };
   Results in: bash -c getent group test_group1 - correct
   
   ## How was this patch tested?
   ranger.usersync.group.enumerategroup property set to "root,wheel,daemon"
   Obtained logs suggest getent command successfully got executed:
   ```
   2023-03-01 21:11:58,625 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: Executing: [bash, -c, getent group root]
   2023-03-01 21:11:58,630 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: bash -c getent group root for group root returned root:x:0:
   2023-03-01 21:11:58,630 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: Executing: [bash, -c, getent group wheel]
   2023-03-01 21:11:58,639 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: bash -c getent group wheel for group wheel returned wheel:x:10:jenkins
   2023-03-01 21:11:58,639 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: Executing: [bash, -c, getent group daemon]
   2023-03-01 21:11:58,647 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: bash -c getent group daemon for group daemon returned daemon:x:2:
   2023-03-01 21:11:58,647 DEBUG org.apache.ranger.unixusersync.process.UnixUserGroupBuilder: Done adding extra groups 
   ```
   Verified the obtained log results by executing commands such as "bash -c getent group daemon" which returned consistent results as logs.
   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

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


[GitHub] [ranger] mneethiraj commented on a diff in pull request #223: RANGER-4043: Fix 'getent group' command when enumerate groups is enabled

Posted by "mneethiraj (via GitHub)" <gi...@apache.org>.
mneethiraj commented on code in PR #223:
URL: https://github.com/apache/ranger/pull/223#discussion_r1124884277


##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/UnixUserGroupBuilder.java:
##########
@@ -538,7 +538,7 @@ private void buildUnixGroupList(String allGroupsCmd, String groupCmd, boolean us
 
 			for (String group : groups) {
 				String command = String.format(groupCmd, group);
-				String[] cmd = new String[]{"bash", "-c", command + " '" + group + "'"};
+				String[] cmd = new String[]{"bash", "-c", command};

Review Comment:
   It looks like this fix would be needed in line #507 as well. @fateh288  - can you please review?



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

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


[GitHub] [ranger] kumaab commented on pull request #223: RANGER-4043: Fix 'getent group' command when enumerate groups is enabled

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab commented on PR #223:
URL: https://github.com/apache/ranger/pull/223#issuecomment-1452915634

   Please resolve the jira.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

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


[GitHub] [ranger] fateh288 commented on a diff in pull request #223: RANGER-4043: Fix 'getent group' command when enumerate groups is enabled

Posted by "fateh288 (via GitHub)" <gi...@apache.org>.
fateh288 commented on code in PR #223:
URL: https://github.com/apache/ranger/pull/223#discussion_r1131230058


##########
ugsync/src/main/java/org/apache/ranger/unixusersync/process/UnixUserGroupBuilder.java:
##########
@@ -538,7 +538,7 @@ private void buildUnixGroupList(String allGroupsCmd, String groupCmd, boolean us
 
 			for (String group : groups) {
 				String command = String.format(groupCmd, group);
-				String[] cmd = new String[]{"bash", "-c", command + " '" + group + "'"};
+				String[] cmd = new String[]{"bash", "-c", command};

Review Comment:
   Thanks @mneethiraj 
   Created a new pull request for this with the suggested changes.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

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


[GitHub] [ranger] kumaab merged pull request #223: RANGER-4043: Fix 'getent group' command when enumerate groups is enabled

Posted by "kumaab (via GitHub)" <gi...@apache.org>.
kumaab merged PR #223:
URL: https://github.com/apache/ranger/pull/223


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@ranger.apache.org

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