aboutsummaryrefslogtreecommitdiff
path: root/src/connection/sudo.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-02-23 13:40:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-02-23 13:40:25 -0700
commitbe461462885b987222eef811fef4cd3551a14527 (patch)
tree8e7fcffc2a50a5ddf325df1b9dd750ee300dd081 /src/connection/sudo.lisp
parente969e942985c7a5afdeda3c1d8334c9aa5b2d3d5 (diff)
downloadconsfigurator-be461462885b987222eef811fef4cd3551a14527.tar.gz
attempt to fix streaming data into remote sudo
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection/sudo.lisp')
-rw-r--r--src/connection/sudo.lisp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/connection/sudo.lisp b/src/connection/sudo.lisp
index 71eecd5..75b7ec8 100644
--- a/src/connection/sudo.lisp
+++ b/src/connection/sudo.lisp
@@ -75,13 +75,20 @@
(typecase input
(stream input)
(string (make-string-input-stream input))))
- (password (slot-value c 'password))
- (password-stream (and password
- (make-string-input-stream
- (format nil "~A~A" password (code-char 13)))))
+ (password (when-let ((password (slot-value c 'password)))
+ (format nil "~A~A" password (code-char 13))))
+ (password-stream (and password (make-string-input-stream password)))
(new-input (cond
((and password input)
- (make-concatenated-stream password-stream input-stream))
+ (make-concatenated-stream
+ (case (stream-element-type input-stream)
+ (character
+ password-stream)
+ (t
+ (babel-streams:make-in-memory-input-stream
+ (babel:string-to-octets password :encoding :UTF-8)
+ :element-type (stream-element-type input-stream))))
+ input-stream))
(password
password-stream)
(input