" if (!$cmd->{'raw'}); } $remote_custom_error = undef; if ($h == 0) { # Run locally ($got, $out, $timeout, $ex) = &execute_custom_command( $cmd, $env, $export, $str, $cmd->{'format'} ne 'redirect' && $cmd->{'format'} ne 'form'); } else { # Remote foreign call eval { $SIG{'ALRM'} = sub { die "timeout" }; alarm($cmd->{'timeout'} ? $cmd->{'timeout'} + 5 : 60); &remote_foreign_require($server->{'host'}, "custom", "custom-lib.pl"); &remote_foreign_call($server->{'host'}, "custom", "set_parameter_envs", $cmd, $cmd->{'cmd'}, \@user_info, \%in, 1); ($got, $out, $timeout, $ex) = &remote_foreign_call( $server->{'host'}, "custom", "execute_custom_command", $cmd, $env, $export, $str); }; if ($@ =~ /timeout/) { $timeout = 1; } alarm(0); } if ($h == 0) { &additional_log('exec', undef, $displaystr); } if (!$remote_custom_error) { print $out if ($h != 0 && $cmd->{'format'} ne 'redirect' && $cmd->{'format'} ne 'form'); if (!$got && !$cmd->{'format'}) { print "$text{'run_noout'}\n"; } } if (!$cmd->{'format'}) { print "
\n"; } elsif ($timeout) { print "",&text('run_timeout', $cmd->{'timeout'} || 60),"
\n"; } elsif ($ex) { print "",&text('run_failed', $ex),"
\n"; } } # Only log non-upload inputs %cmdin = ( %$cmd ); foreach $i (keys %in) { ($arg) = grep { $_->{'name'} eq $i } @{$cmd->{'args'}}; if ($arg->{'type'} != 10) { $cmdin{$i} = $in{$i}; } } } &webmin_log("exec", "command", $cmd->{'id'}, \%cmdin); unlink(@unlink) if (@unlink); if (!$cmd->{'format'}) { &ui_print_footer("", $text{'index_return'}); } elsif ($cmd->{'format'} eq 'redirect') { &redirect(""); } elsif ($cmd->{'format'} eq 'form') { &redirect("form.cgi?id=".$in{'id'}."&idx=".$in{'idx'}); } sub remote_custom_handler { $remote_custom_error = join("", @_); }