diff --git a/src/main/java/com/jcraft/jsch/JSch.java b/src/main/java/com/jcraft/jsch/JSch.java index a1f5d96c..43bedd8f 100644 --- a/src/main/java/com/jcraft/jsch/JSch.java +++ b/src/main/java/com/jcraft/jsch/JSch.java @@ -60,9 +60,12 @@ public class JSch { "hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1")); config.put("compression.s2c", Util.getSystemProperty("jsch.compression", "none")); config.put("compression.c2s", Util.getSystemProperty("jsch.compression", "none")); - // Do not ask re-entering password after the first failure. Useful when authenticating with a script that uses the same password every time. Set true to activate. - config.put("user_auth_keyboard_interactive_single_attempt", Util.getSystemProperty("jsch.user_auth_keyboard_interactive_single_attempt", "false")); - config.put("user_auth_single_attempt", Util.getSystemProperty("jsch.user_auth_single_attempt", "false")); + // Do not ask re-entering password after the first failure. Useful when authenticating with a + // script that uses the same password every time. Set true to activate. + config.put("user_auth_keyboard_interactive_single_attempt", + Util.getSystemProperty("jsch.user_auth_keyboard_interactive_single_attempt", "false")); + config.put("user_auth_single_attempt", + Util.getSystemProperty("jsch.user_auth_single_attempt", "false")); config.put("lang.s2c", Util.getSystemProperty("jsch.lang", "")); config.put("lang.c2s", Util.getSystemProperty("jsch.lang", "")); diff --git a/src/main/java/com/jcraft/jsch/UserAuthKeyboardInteractive.java b/src/main/java/com/jcraft/jsch/UserAuthKeyboardInteractive.java index 7215766a..e460cd07 100644 --- a/src/main/java/com/jcraft/jsch/UserAuthKeyboardInteractive.java +++ b/src/main/java/com/jcraft/jsch/UserAuthKeyboardInteractive.java @@ -78,7 +78,8 @@ public boolean start(Session session) throws Exception { if (session.getTimeout() > 0 && System.currentTimeMillis() > timeout) { throw new JSchAuthCancelException("keyboard-interactive"); } - // Do not ask re-entering password after the first failure. Useful when authenticating with a script that uses the same password every time. + // Do not ask re-entering password after the first failure. Useful when authenticating with + // a script that uses the same password every time. if (isMaxFailuresReached(auth_failures_initial, session.auth_failures)) { return false; } @@ -205,6 +206,7 @@ public boolean start(Session session) throws Exception { } private boolean isMaxFailuresReached(int initial, int current) { - return Boolean.parseBoolean(JSch.getConfig("user_auth_keyboard_interactive_single_attempt")) && current > initial; + return Boolean.parseBoolean(JSch.getConfig("user_auth_keyboard_interactive_single_attempt")) + && current > initial; } } diff --git a/src/main/java/com/jcraft/jsch/UserAuthPassword.java b/src/main/java/com/jcraft/jsch/UserAuthPassword.java index 37aefc02..f66a825f 100644 --- a/src/main/java/com/jcraft/jsch/UserAuthPassword.java +++ b/src/main/java/com/jcraft/jsch/UserAuthPassword.java @@ -163,7 +163,8 @@ public boolean start(Session session) throws Exception { } session.auth_failures++; - // Do not ask re-entering password after the first failure. Useful when authenticating with a script that uses the same password every time. + // Do not ask re-entering password after the first failure. Useful when authenticating + // with a script that uses the same password every time. if (Boolean.parseBoolean(JSch.getConfig("user_auth_single_attempt"))) { return false; }