summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorglenda <glenda@9front.local>2022-08-07 09:11:25 +0000
committerglenda <glenda@9front.local>2022-08-07 09:11:25 +0000
commite92e9cf193d9ab5fe29d9a2178c47bfd03dce315 (patch)
tree92a5d129ac1088250f26c54e0387e5eb51a8fade /rc
parentdd029bddc853eebb5aa96fc2d35c29792e9ad15e (diff)
rcpu: show error when we auth but don't connect
When a user isn't allowed to log into a file server, we used to silently dump the user back to the console, reporting that the command succeeded. We should give the user an error when they fail to log in, and we should exit unsuccessfully. This status is communicated by setting up a sentinel env var, and clearning it just before we execute the user command.
Diffstat (limited to 'rc')
-rwxr-xr-xrc/bin/rcpu6
1 files changed, 6 insertions, 0 deletions
diff --git a/rc/bin/rcpu b/rc/bin/rcpu
index 54f670c67..c29c4a163 100755
--- a/rc/bin/rcpu
+++ b/rc/bin/rcpu
@@ -23,6 +23,7 @@ fn server {
if(test -d /mnt/term/mnt/cpunote) {
rfork e
mainproc=$apid
+ rm -f /mnt/term/env/rfailed
{cat; echo -n hangup} </mnt/term/mnt/cpunote/data >/proc/$mainproc/notepg &
noteproc=$apid
wait $mainproc
@@ -33,6 +34,7 @@ fn server {
fn client {
echo -n >/env/rstatus
+ echo -n 'lost connection' > /env/rfailed
rfork n
bind '#|' /mnt/cpunote || exit
</fd/0 exec $exportfs -r / &
@@ -45,6 +47,10 @@ fn client {
echo -n interrupt
wait
}
+ if(test -e /env/rfailed){
+ >[1=2] echo lost connection
+ exit 'disconnected'
+ }
status=`{cat /env/rstatus}
exit $"status
}