diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-23 13:19:46 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-23 16:55:07 -0700 |
commit | b914693a33ffcf0764ea9bc87bcc573e5ddf9943 (patch) | |
tree | a5f1451810cf940d03aa33d0761aa82b050e819e /src/data.lisp | |
parent | e4bda1ac845991cb79e6f3ad21db1d54ee36ddd2 (diff) | |
download | consfigurator-b914693a33ffcf0764ea9bc87bcc573e5ddf9943.tar.gz |
convert CONNECTION slots to connattrs & fix finding homedirs
HOME does not take into account /etc/passwd inside the chroot, even when
starting a login shell with, e.g., "chroot /chroot sh -lc 'echo $HOME'" -- we
would need something which emulates login(1), like su(1), but the -c argument
to su(1) is not portable. getent(1) is not POSIX. So use tilde expansion.
Additionally, avoid having UPLOAD-ALL-PREREQUISITE-DATA store values for the
remote UID, remote homedir etc. from *before* the chroot/setuid operation.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/data.lisp')
-rw-r--r-- | src/data.lisp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/data.lisp b/src/data.lisp index 25d0338..de54665 100644 --- a/src/data.lisp +++ b/src/data.lisp @@ -326,6 +326,10 @@ new versions of data, to avoid them piling up.")) (dir (ensure-directory-pathname (remote-data-pathname iden1 iden2)))) (delete-remote-trees dir))) +(defmethod connection-connattr + ((connection connection) (k (eql 'cached-data))) + (make-hash-table :test #'equal)) + (defun upload-all-prerequisite-data (&key (upload-string-data t) (connection *connection*)) "Upload all prerequisite data required by the current deployment to the remote @@ -339,9 +343,6 @@ This is called by implementations of ESTABLISH-CONNECTION which call CONTINUE-DEPLOY* or CONTINUE-DEPLOY*-PROGRAM." ;; Retrieving & keeping in memory refers to how %GET-DATA stores items of ;; string data in *STRING-DATA*. - (unless (get-connattr 'cached-data connection) - (setf (get-connattr 'cached-data connection) - (make-hash-table :test #'equal))) (flet ((record-cached-data (iden1 iden2 version) (let ((*connection* connection)) (setf (gethash (cons iden1 iden2) (get-connattr 'cached-data)) |