Fix bug parsing menu files on remote system
authorJamie Cameron <jcameron@webmin.com>
Tue, 17 Aug 2010 00:17:59 +0000 (17:17 -0700)
committerJamie Cameron <jcameron@webmin.com>
Tue, 17 Aug 2010 00:17:59 +0000 (17:17 -0700)
custom/custom-lib.pl
custom/run.cgi

index e1c0b3c..506ed6d 100755 (executable)
@@ -376,13 +376,13 @@ for($i=0; defined($name = $in{"name_$i"}); $i++) {
        }
 }
 
-# set_parameter_envs(&command, command-str, &uinfo, [set-in])
+# set_parameter_envs(&command, command-str, &uinfo, [set-in], [skip-menu-check])
 # Sets $ENV variables based on parameter inputs, and returns the list of
 # environment variable commands, the export commands, the command string,
 # and the command string to display.
 sub set_parameter_envs
 {
-local ($cmd, $str, $uinfo, $setin) = @_;
+local ($cmd, $str, $uinfo, $setin, $skipfound) = @_;
 $setin ||= \%in;
 local $displaystr = $str;
 local ($env, $export, @vals);
@@ -414,7 +414,7 @@ foreach my $a (@{$cmd->{'args'}}) {
                foreach my $l (&read_opts_file($a->{'opts'})) {
                        $found++ if ($l->[0] eq $setin->{$n});
                        }
-               $found || &error($text{'run_eopt'});
+               $found || $skipfound || &error($text{'run_eopt'});
                $rv = $setin->{$n};
                }
        elsif ($a->{'type'} == 10) {
@@ -439,7 +439,7 @@ foreach my $a (@{$cmd->{'args'}}) {
                        foreach my $l (@opts) {
                                $found++ if ($l->[0] eq $v);
                                }
-                       $found || &error($text{'run_eopt'});
+                       $found || $skipfound || &error($text{'run_eopt'});
                        }
                $rv = join(" ", @vals);
                }
index 6c5fe5c..ba4340d 100755 (executable)
@@ -60,7 +60,7 @@ foreach $h (@hosts) {
                                        "custom-lib.pl");
                &remote_foreign_call($server->{'host'}, "custom",
                                     "set_parameter_envs", $cmd, $cmd->{'cmd'},
-                                    \@user_info, \%in);
+                                    \@user_info, \%in, 1);
                ($got, $out, $timeout) = &remote_foreign_call(
                        $server->{'host'}, "custom", "execute_custom_command",
                        $cmd, $env, $export, $str);