bug fix. master
authorIan Kelling <iank@fsf.org>
Tue, 2 Jul 2024 17:35:04 +0000 (13:35 -0400)
committerIan Kelling <iank@fsf.org>
Tue, 2 Jul 2024 17:35:04 +0000 (13:35 -0400)
roles/kvmhost/files/simple/usr/local/bin/savannah-virsh

index 5d0471d78f309c7664009901f498b0e72453a9a0..fb8e3e569b324817a2029c9a5cdc21ba05e96541 100755 (executable)
@@ -32,13 +32,16 @@ regex='^[a-z0-9. ]*$'
 
 # restricted ssh does not allow arguments, but they exist in this env variable.
 # The var comes with a leading space, remove it.
 
 # restricted ssh does not allow arguments, but they exist in this env variable.
 # The var comes with a leading space, remove it.
-args="${SSH_ORIGINAL_COMMAND#* }"
+args="${SSH_ORIGINAL_COMMAND# }"
 
 if [[ ! $args =~ $regex ]]; then
   echo "error: bad argument. args=$args" >&2; exit 1
 fi
 
 
 if [[ ! $args =~ $regex ]]; then
   echo "error: bad argument. args=$args" >&2; exit 1
 fi
 
-arg1="${args%% *}"
+IFS=" " read -r -a arg_array <<<"$args"
+
+
+arg1="${arg_array[0]}"
 
 case "$arg1" in
   list)
 
 case "$arg1" in
   list)
@@ -51,8 +54,7 @@ case "$arg1" in
     ;;
 esac
 
     ;;
 esac
 
-# just 2 args, so split the space.
-arg2="${args## *}"
+arg2="${arg_array[1]}"
 
 
 case "$arg2" in
 
 
 case "$arg2" in