File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,10 @@ keys. All other option key pairs will be passed as SSH config options."
359
359
(reflect/call-method
360
360
com.jcraft.jsch.ChannelSession 'setPty [Boolean/TYPE]
361
361
shell (boolean (opts :pty ))))
362
+ (when (contains? opts :agent-forwarding )
363
+ (reflect/call-method
364
+ com.jcraft.jsch.ChannelSession 'setAgentForwarding [Boolean/TYPE]
365
+ shell (boolean (opts :agent-forwarding ))))
362
366
(if out-inputstream
363
367
(do
364
368
(connect shell)
@@ -390,6 +394,10 @@ keys. All other option key pairs will be passed as SSH config options."
390
394
(reflect/call-method
391
395
com.jcraft.jsch.ChannelSession 'setPty [Boolean/TYPE]
392
396
exec (boolean (opts :pty ))))
397
+ (when (contains? opts :agent-forwarding )
398
+ (reflect/call-method
399
+ com.jcraft.jsch.ChannelSession 'setAgentForwarding [Boolean/TYPE]
400
+ exec (boolean (opts :agent-forwarding ))))
393
401
(if out-inputstream
394
402
(do
395
403
(connect exec)
Original file line number Diff line number Diff line change @@ -265,7 +265,14 @@ list, Alan Dipert and MeikelBrandmeyer."
265
265
(let [result (ssh-shell session " exit $(tty -s)" " UTF-8" {:pty true })]
266
266
(is (= 0 (first result))))
267
267
(let [result (ssh-shell session " exit $(tty -s)" " UTF-8" {:pty nil })]
268
- (is (= 1 (first result))))))))
268
+ (is (= 1 (first result))))
269
+ (let [result (ssh-shell session " ssh-add -l" " UTF-8" {})]
270
+ (is (pos? (first result))))
271
+ (let [result (ssh-shell session " ssh-add -l" " UTF-8" {:agent-forwarding false })]
272
+ (is (pos? (first result))))
273
+ (let [result (ssh-shell session " ssh-add -l" " UTF-8" {:agent-forwarding true })]
274
+ (is (re-find #"RSA" (second result)))
275
+ (is (= 0 (first result))))))))
269
276
270
277
(deftest ssh-exec-test
271
278
(with-ssh-agent [false ]
You can’t perform that action at this time.
0 commit comments