summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--NEWS2
-rw-r--r--examples/echo/client.scm.in5
-rw-r--r--examples/sssh.scm.in3
-rw-r--r--ssh/session.scm8
5 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 96a3990..b948f4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-31 Artyom Poptsov <poptsov.artyom@gmail.com>
+
+ * ssh/session.scm (bytevector->hex-string): New procedure.
+ * examples/echo/client.scm.in (main): Use it.
+ * examples/sssh.scm.in (main): Use it.
+
2014-05-30 Artyom Poptsov <poptsov.artyom@gmail.com>
* ssh/session-func.c (guile_ssh_get_public_key_hash): Return the
diff --git a/NEWS b/NEWS
index e4e38e7..4280392 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ Copyright (C) Artyom V. Poptsov <poptsov.artyom@gmail.com>
* Unreleased
** `get-public-key-hash' now returns the hash as a bytevector
+** New procedure `bytevector->hex-string'
+ in =(ssh session)=
* Changes in version 0.6.0 (2014-03-23)
** Remove username from parameter list of auth procedures
diff --git a/examples/echo/client.scm.in b/examples/echo/client.scm.in
index ac3ecce..6a9fc41 100644
--- a/examples/echo/client.scm.in
+++ b/examples/echo/client.scm.in
@@ -142,8 +142,9 @@ errors."
(case (authenticate-server session)
((not-known)
- (display "The server is unknown. Please check MD5 sum:\n")
- (format #t " ~a~%" (get-public-key-hash session))))
+ (let ((hash (get-public-key-hash session)))
+ (display "The server is unknown. Please check MD5 sum:\n")
+ (format #t " ~a~%" (bytevector->hex-string hash)))))
(let* ((private-key (get-prvkey session identity-file))
(public-key (get-pubkey session private-key)))
diff --git a/examples/sssh.scm.in b/examples/sssh.scm.in
index e58819b..a80875d 100644
--- a/examples/sssh.scm.in
+++ b/examples/sssh.scm.in
@@ -175,7 +175,8 @@ Options:
((ok) (print-debug " ok\n"))
((not-known) (display " The server is unknown. Please check MD5.\n")))
- (format-debug " MD5 hash: ~a~%" (get-public-key-hash session))
+ (let ((hash (get-public-key-hash session)))
+ (format-debug " MD5 hash: ~a~%" (bytevector->hex-string hash)))
(print-debug "5. userauth-autopubkey!\n")
(let ((res (userauth-autopubkey! session)))
diff --git a/ssh/session.scm b/ssh/session.scm
index a3152e7..054f77e 100644
--- a/ssh/session.scm
+++ b/ssh/session.scm
@@ -43,6 +43,7 @@
(define-module (ssh session)
#:use-module (ice-9 optargs)
+ #:use-module (rnrs bytevectors)
#:export (session
session?
%make-session
@@ -55,6 +56,7 @@
connected?
authenticate-server
get-public-key-hash
+ bytevector->hex-string
write-known-host!
get-error))
@@ -95,6 +97,12 @@ Return a new SSH session."
(session-set-if-specified! compression-level)
session))
+(define (bytevector->hex-string bv)
+ "Convert bytevector BV to a colon separated hex string."
+ (string-join (map (lambda (e) (format #f "~2,'0x" e))
+ (bytevector->u8-list bv))
+ ":"))
+
(load-extension "libguile-ssh" "init_session")
;;; session.scm ends here