diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-07-23 11:37:25 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-07-24 15:51:09 -0700 |
commit | 4719c2966d0ddb4cfa6855aacfc6a4774c18bd70 (patch) | |
tree | 6dd56937302c65c1b0688e67202179b7c9542bda | |
parent | 927cdd896fd1a4d64691d50a90cdd11ce7d675f9 (diff) | |
download | consfigurator-4719c2966d0ddb4cfa6855aacfc6a4774c18bd70.tar.gz |
return type in FOREIGN-FUNCALL of geteuid(2) is unsigned
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
(cherry picked from commit 885b9f3f762cdf18ff358509fd8838f8222b43ba)
-rw-r--r-- | src/connection/as.lisp | 2 | ||||
-rw-r--r-- | src/connection/chroot.lisp | 5 | ||||
-rw-r--r-- | src/connection/setuid.lisp | 3 | ||||
-rw-r--r-- | src/util.lisp | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/src/connection/as.lisp b/src/connection/as.lisp index 6f6edc6..024603d 100644 --- a/src/connection/as.lisp +++ b/src/connection/as.lisp @@ -21,7 +21,7 @@ ;; currently we only check whether we're root, but, for example, on Linux, we ;; might have a CAP_* which lets us setuid as non-root (defun can-setuid () - (zerop (foreign-funcall "geteuid" :int))) + (zerop (foreign-funcall "geteuid" :unsigned-int))) (defmethod establish-connection ((type (eql :as)) remaining &key to) "Establish a :SETUID or :SU connection to another user account, depending on diff --git a/src/connection/chroot.lisp b/src/connection/chroot.lisp index f0a4c73..730335f 100644 --- a/src/connection/chroot.lisp +++ b/src/connection/chroot.lisp @@ -21,7 +21,7 @@ ;; currently we only check whether we're root, but, for example, on Linux, we ;; might have a CAP_* which lets us chroot as non-root (defun can-chroot () - (zerop (foreign-funcall "geteuid" :int))) + (zerop (foreign-funcall "geteuid" :unsigned-int))) (defmethod establish-connection ((type (eql :chroot)) remaining &key into) (establish-connection (if (and (lisp-connection-p) @@ -113,7 +113,8 @@ should be the mount point, without the chroot's root prefixed.") (rehome-connection chroot-connection fork-connection) ()) (defmethod establish-connection ((type (eql :chroot.fork)) remaining &key into) - (unless (and (lisp-connection-p) (zerop (foreign-funcall "geteuid" :int))) + (unless (and (lisp-connection-p) + (zerop (foreign-funcall "geteuid" :unsigned-int))) (error "~&Forking into a chroot requires a Lisp image running as root")) (informat 1 "~&Forking into chroot at ~A" into) (let* ((into* (ensure-directory-pathname into)) diff --git a/src/connection/setuid.lisp b/src/connection/setuid.lisp index 8b3353f..e61222b 100644 --- a/src/connection/setuid.lisp +++ b/src/connection/setuid.lisp @@ -32,7 +32,8 @@ (defclass setuid-connection (rehome-connection fork-connection) ()) (defmethod establish-connection ((type (eql :setuid)) remaining &key to) - (unless (and (lisp-connection-p) (zerop (foreign-funcall "geteuid" :int))) + (unless (and (lisp-connection-p) + (zerop (foreign-funcall "geteuid" :unsigned-int))) (error "~&SETUIDing requires a Lisp image running as root")) (informat 1 "~&SETUIDing to ~A" to) (multiple-value-bind (match groups) diff --git a/src/util.lisp b/src/util.lisp index c371cfb..8c45b30 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -390,7 +390,7 @@ Should be called soon after fork(2) in child processes." (defun posix-login-environment (logname home) "Reset the environment after switching UID, or similar, in a :LISP connection. Does not currently establish a PAM session." - (let ((euid (foreign-funcall "geteuid" :int)) + (let ((euid (foreign-funcall "geteuid" :unsigned-int)) (maybe-preserve '("TERM"))) (when (zerop euid) (push "SSH_AUTH_SOCK" maybe-preserve)) |