Skip to content

Commit

Permalink
modules/ssh/session (make-session): Fix libssh 0.8 support
Browse files Browse the repository at this point in the history
* modules/ssh/session.scm (make-session): Don't try to set "parse-config?"
option when libssh version is older than 0.9.  Log a message and fallback to
the old Guile-SSH behavior instead (see
<#38>.)
  • Loading branch information
artyom-poptsov committed Nov 5, 2024
1 parent 1d47521 commit f8d8566
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/ssh/session.scm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
(define-module (ssh session)
#:use-module (ice-9 optargs)
#:use-module (ssh log)
#:use-module (ssh version)
#:export (session
session?
%make-session
Expand All @@ -67,6 +68,9 @@
(define-macro (session-set-if-specified! option)
`(if ,option (session-set! session (quote ,option) ,option)))

(define %libssh-minor-version
(string->number (cadr (string-split (get-libssh-version) #\.))))

;; This procedure is more convenient than primitive `%make-session',
;; but on other hand it should be a bit slower because of additional
;; checks. I think we can put up with this. -avp
Expand Down Expand Up @@ -94,7 +98,17 @@ Return a new SSH session."
(%gssh-session-parse-config! session #f))
(else
(throw 'guile-ssh-error "Wrong 'config' value" config))))
(session-set! session 'process-config? #f))
(if (>= %libssh-minor-version 9)
(session-set! session 'process-config? #f)
(format-log 'rare
'make-session
(string-append
"process-config? option is not available"
" (using libssh 0.~a.)"
" Falling back to the old Guile-SSH behavior "
" (no config setting.)"
" See <https://github.com/artyom-poptsov/guile-ssh/issues/38>.")
%libssh-minor-version)))

(session-set-if-specified! port)
(session-set-if-specified! user)
Expand Down

0 comments on commit f8d8566

Please sign in to comment.