From b914693a33ffcf0764ea9bc87bcc573e5ddf9943 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 23 May 2021 13:19:46 -0700 Subject: 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 --- src/data.lisp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/data.lisp') 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)) -- cgit v1.2.3