public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH] Check only first part of script parameter for executability
@ 2021-10-21  8:46 Phillipp Röll
  2021-10-21  9:05 ` Thomas Lamprecht
  0 siblings, 1 reply; 4+ messages in thread
From: Phillipp Röll @ 2021-10-21  8:46 UTC (permalink / raw)
  To: pve-devel

When giving a script parameter including arguments to the dump process,
the full script parameter including the arguments is checked for
executablility. The following will always abort with a "not executable"
error:

vzdump 100 --script "/usr/local/bin/myscript.pl myarg"

If we split the script argument and check only the first part, the
check works as expected.
---
 PVE/VZDump.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 88ac11b3..fe1a7f23 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -630,7 +630,9 @@ sub run_hook_script {
     my $script = $opts->{script};
     return if !$script;
 
-    if (!-x $script) {
+    my @script_args = split /\s+/, $script;
+
+    if (!-x $script_args[0]) {
 	die "The hook script '$script' is not executable.\n";
     }
 
-- 
2.33.0




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-22  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  8:46 [pve-devel] [PATCH] Check only first part of script parameter for executability Phillipp Röll
2021-10-21  9:05 ` Thomas Lamprecht
2021-10-21 18:15   ` Phillipp Röll
2021-10-22  7:36     ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal