You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by "bipinprasad (via GitHub)" <gi...@apache.org> on 2024/06/08 02:23:14 UTC
Re: [PR] STORM-4057 - Validate user with the id cmd (storm)
bipinprasad commented on code in PR #3640:
URL: https://github.com/apache/storm/pull/3640#discussion_r1631826169
##########
storm-server/src/main/java/org/apache/storm/utils/ServerUtils.java:
##########
@@ -1102,6 +1102,17 @@ public static int getUserId(String user) {
cmdArgs.add("-u");
if (user != null && !user.isEmpty()) {
cmdArgs.add(user);
+ int exitCode = 0;
+ try {
+ exitCode = new ProcessBuilder(cmdArgs).start().waitFor();
+ } catch (Exception e) {
+ // Ignore
+ } finally {
+ if (exitCode != 0) {
+ LOG.debug("CMD: '{}' returned exit code of {}", String.join(" ", cmdArgs), exitCode);
+ cmdArgs.remove(user);
+ }
+ }
}
LOG.debug("CMD: {}", String.join(" ", cmdArgs));
ProcessBuilder pb = new ProcessBuilder(cmdArgs);
Review Comment:
Still need this?
--
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@storm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org