aboutsummaryrefslogtreecommitdiff
path: root/src/connection
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-03-25 11:44:46 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-03-25 11:44:46 -0700
commitfbd6e6169d4b711461c44f8273cc758fc21d25a0 (patch)
tree87a025a56706b60973b4a6c60dc2c0bd9fa6af42 /src/connection
parent2524874860ddf7b05b682a9c3a0012c290192744 (diff)
downloadconsfigurator-fbd6e6169d4b711461c44f8273cc758fc21d25a0.tar.gz
fix setting HOME in :SETUID
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection')
-rw-r--r--src/connection/setuid.lisp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/connection/setuid.lisp b/src/connection/setuid.lisp
index ad4de7b..100e98c 100644
--- a/src/connection/setuid.lisp
+++ b/src/connection/setuid.lisp
@@ -32,11 +32,11 @@
(informat 1 "~&SETUIDing to ~A" to)
(re:register-groups-bind ((#'parse-integer uid gid))
(#?/uid=([0-9]+).+gid=([0-9]+)/ (mrun "id" to))
- (with-fork-connection (remaining)
- (unless (zerop (setgid gid))
- (error "setgid(2) failed; are you root?"))
- (unless (zerop (setuid uid))
- (error "setuid(2) failed; are you root?"))
- (let ((home (user:passwd-entry 5 uid)))
+ (let ((home (user:passwd-entry 5 uid)))
+ (with-fork-connection (remaining)
+ (unless (zerop (setgid gid))
+ (error "setgid(2) failed; are you root?"))
+ (unless (zerop (setuid uid))
+ (error "setuid(2) failed; are you root?"))
(setf (getenv "HOME") home)
(uiop:chdir home)))))