rzo1 commented on code in PR #3640:
URL: https://github.com/apache/storm/pull/3640#discussion_r1632858195


##########
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:
   I think so, yes. The first call is actually a test, if the user actually 
exist on the system (otherwise the parsing of the 2nd call would fail). 



-- 
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-unsubscr...@storm.apache.org

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

Reply via email to