private final Integer myPort;
private final String myCommand;
private final Logger myLogger;
+ private final Map<String, String> myOptions;
private JSchClient(@NotNull String host,
@Nullable String username,
@Nullable Integer port,
@NotNull String command,
- @NotNull Logger logger) {
+ @NotNull Logger logger,
+ @NotNull Map<String, String> options) {
myHost = host;
myUsername = username;
myPort = port;
myCommand = command;
myLogger = logger;
+ myOptions = options;
}
//
// we need to combine them ourselves.
+ final Map<String, String> options = new HashMap<String, String>();
+
int i = 0;
+
+ if ("-o".equals(args[i])) {
+ i++;
+ final String[] op = args[i++].split("=");
+ options.put(op[0], op[1]);
+ }
+
Integer port = null;
//noinspection HardCodedStringLiteral
if ("-p".equals(args[i])) {
}
command = commandWithArguments.toString();
}
- return new JSchClient(host, user, port, command, logger);
+ return new JSchClient(host, user, port, command, logger, options);
}
if (authMethods != null && authMethods.length() > 0)
session.setConfig("PreferredAuthentications", authMethods);
+ if (!myOptions.isEmpty()) {
+ for (final Map.Entry<String, String> opEntry : myOptions.entrySet()) {
+ session.setConfig(opEntry.getKey(), opEntry.getValue());
+ }
+ }
+
EmptySecurityCallbackHandler.install();
// It looks like sometimes session/channel close() doesn't interrupt