aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-25 11:41:16 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-25 11:41:16 -0700
commit2524874860ddf7b05b682a9c3a0012c290192744 (patch)
treea94782890927e502d538d4eb9f16087bc1e6e129 /src
parent0cc6a897279c84567f2115ecc1909d476b221927 (diff)
downloadconsfigurator-2524874860ddf7b05b682a9c3a0012c290192744.tar.gz
add and call RESET-REMOTE-HOME
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r--src/connection.lisp7
-rw-r--r--src/connection/fork.lisp1
-rw-r--r--src/package.lisp1
3 files changed, 9 insertions, 0 deletions
diff --git a/src/connection.lisp b/src/connection.lisp
index 725c408..4690848 100644
--- a/src/connection.lisp
+++ b/src/connection.lisp
@@ -75,6 +75,13 @@ For an example of usage, see the :SUDO connection type."))
:documentation
"Effective user-id of the remote (deploying) user")))
+(defun reset-remote-home ()
+ "Clear the cache of the remote user's home directory.
+Used by implementations of ESTABLISH-CONNECTION which will invalidate the
+cached value, such as a connection which forks and then SETUIDs to another
+user. Should not be called by properties."
+ (setf (slot-value *connection* 'remote-home) nil))
+
(defclass lisp-connection (connection) ())
(defclass posix-connection (connection) ())
diff --git a/src/connection/fork.lisp b/src/connection/fork.lisp
index 6a4ad0c..a0a7a98 100644
--- a/src/connection/fork.lisp
+++ b/src/connection/fork.lisp
@@ -67,6 +67,7 @@ for example, such that we don't see it."
;; has the data cached, a socket open etc.
(mapc #'clear-input
(list *standard-input* *debug-io* *terminal-io*))
+ (reset-remote-home)
,@forms
;; it would be nice to reenter Consfigurator's primary loop by
;; just calling (return-from establish-connection
diff --git a/src/package.lisp b/src/package.lisp
index 3a51f9a..d12a335 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -81,6 +81,7 @@
#:lisp-connection
#:posix-connection
#:lisp-connection-p
+ #:reset-remote-home
#:connection-run
#:connection-readfile
#:connection-writefile