From b6b26120f58e4d0b4bb884b44c7cc867cd90c8a0 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 1 Apr 2022 18:19:47 -0700 Subject: connection chain specs.: consistently use :USER for the target user Signed-off-by: Sean Whitton --- src/connection/as.lisp | 4 ++-- src/connection/linux-namespace.lisp | 2 +- src/connection/setuid.lisp | 9 +++++---- src/connection/sudo.lisp | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/connection') diff --git a/src/connection/as.lisp b/src/connection/as.lisp index 0a15cf8..a78f13f 100644 --- a/src/connection/as.lisp +++ b/src/connection/as.lisp @@ -23,7 +23,7 @@ (defun can-setuid () (zerop (nix:geteuid))) -(defmethod establish-connection ((type (eql :as)) remaining &key to) +(defmethod establish-connection ((type (eql :as)) remaining &key user) "Establish a :SETUID or :SU connection to another user account, depending on whether it is possible to establish a :SETUID connection. @@ -32,4 +32,4 @@ Note that both these connection types require root." ;; portable. (establish-connection (if (and (lisp-connection-p) (can-setuid)) :setuid :su) - remaining :to to)) + remaining :user user)) diff --git a/src/connection/linux-namespace.lisp b/src/connection/linux-namespace.lisp index c5c3809..e4a72ef 100644 --- a/src/connection/linux-namespace.lisp +++ b/src/connection/linux-namespace.lisp @@ -159,7 +159,7 @@ and will work but - ((:ssh :user \"root\") :sbcl (:setuid :to \"user\") (:lxc :name \"foo\")) + ((:ssh :user \"root\") :sbcl (:setuid :user \"user\") (:lxc :name \"foo\")) will not. See \"Dumping and reinvoking Lisp\" in the \"Pitfalls and limitations\" section of the Consfigurator manual. diff --git a/src/connection/setuid.lisp b/src/connection/setuid.lisp index 6fba4c2..f99e4b8 100644 --- a/src/connection/setuid.lisp +++ b/src/connection/setuid.lisp @@ -20,12 +20,13 @@ (defclass setuid-connection (rehome-connection fork-connection) ()) -(defmethod establish-connection ((type (eql :setuid)) remaining &key to) +(defmethod establish-connection ((type (eql :setuid)) remaining &key user) (unless (and (lisp-connection-p) (zerop (nix:geteuid))) (error "~&SETUIDing requires a Lisp image running as root")) - (informat 1 "~&SETUIDing to ~A" to) - (let* ((ent (or (osicat:user-info to) - (failed-change "~&Could not look up user info for ~A." to))) + (informat 1 "~&SETUIDing to ~A" user) + (let* ((ent + (or (osicat:user-info user) + (failed-change "~&Could not look up user info for ~A." user))) (xdg-cache-home (ensure-directory-pathname (stripln diff --git a/src/connection/sudo.lisp b/src/connection/sudo.lisp index 486c8eb..8f3d238 100644 --- a/src/connection/sudo.lisp +++ b/src/connection/sudo.lisp @@ -25,9 +25,9 @@ ;; data to obtain passwords by following the conventions for having ;; prerequisite data sources provide them. -(defmethod preprocess-connection-args ((type (eql :sudo)) &key as (to "root")) +(defmethod preprocess-connection-args ((type (eql :sudo)) &key as (user "root")) (list :sudo - :user to + :user user :password (and as (destructuring-bind (user host) -- cgit v1.2.3