From 00f11fc81d0150e19a5803a64367ae740ec04c94 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Wed, 16 Oct 2024 12:28:39 +0300 Subject: [PATCH] Fix to quote usernames in `xfs_quota` command https://forum.virtualmin.com/t/issue-regarding-with-restore/129843/4?u=ilia --- quota/linux-lib.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/quota/linux-lib.pl b/quota/linux-lib.pl index d71eac16a..e3690fb38 100755 --- a/quota/linux-lib.pl +++ b/quota/linux-lib.pl @@ -411,7 +411,7 @@ sub user_filesystems my ($user) = @_; my $n = 0; if (&has_command("xfs_quota")) { - $n = &parse_xfs_quota_output("xfs_quota -xc 'quota -b -i -u $user'"); + $n = &parse_xfs_quota_output("xfs_quota -xc 'quota -b -i -u \'$user\''"); } return &parse_quota_output($config{'user_quota_command'}." ". quotemeta($user), $n); @@ -429,7 +429,7 @@ sub group_filesystems my ($group) = @_; my $n = 0; if (&has_command("xfs_quota")) { - $n = &parse_xfs_quota_output("xfs_quota -xc 'quota -b -i -g $group'"); + $n = &parse_xfs_quota_output("xfs_quota -xc 'quota -b -i -g \'$group\''"); } return &parse_quota_output($config{'group_quota_command'}." ". quotemeta($group), $n); @@ -1010,7 +1010,9 @@ Set XFS quotas for some user and FS sub set_user_quota { my ($user, $fs, $sblocks, $hblocks, $sfiles, $hfiles) = @_; -my $out = &backquote_logged("xfs_quota -x -c 'limit -u bsoft=${sblocks}k bhard=${hblocks}k isoft=$sfiles ihard=$hfiles $user' $fs 2>&1"); +my $out = &backquote_logged("xfs_quota -x -c 'limit -u bsoft=${sblocks}k ". + "bhard=${hblocks}k isoft=$sfiles ihard=$hfiles ". + "\'$user\'' $fs 2>&1"); &error($out) if ($?); } @@ -1027,7 +1029,9 @@ Set XFS quotas for some group and FS sub set_group_quota { my ($group, $fs, $sblocks, $hblocks, $sfiles, $hfiles) = @_; -my $out = &backquote_logged("xfs_quota -x -c 'limit -g bsoft=${sblocks}k bhard=${hblocks}k isoft=$sfiles ihard=$hfiles $group' $fs 2>&1"); +my $out = &backquote_logged("xfs_quota -x -c 'limit -g bsoft=${sblocks}k ". + "bhard=${hblocks}k isoft=$sfiles ihard=$hfiles ". + "\'$group\'' $fs 2>&1"); &error($out) if ($?); }