Merge branch 'master' of github.com:webmin/webmin

This commit is contained in:
Jamie Cameron
2022-02-01 19:34:50 -08:00
3 changed files with 6 additions and 61 deletions

View File

@@ -2168,23 +2168,6 @@ foreach my $l (@{$conf_lref}) {
if ($conf_block_opening == $conf_block_closing) {
my $conf_lvl = 0;
my $conf_prev_line;
my $conf_curr_line;
my $conf_virthost;
my @confs_separate =
(
'Protocols',
'SuexecUserGroup',
'ServerName',
'ScriptAlias',
'DocumentRoot',
'ErrorLog',
'DirectoryIndex',
'Alias',
'RewriteEngine',
'Fcgid',
'SSL',
);
foreach my $l (@{$conf_lref}) {
my $indent_current = $indent x $conf_lvl;
@@ -2194,59 +2177,20 @@ if ($conf_block_opening == $conf_block_closing) {
# Indent up next line if a new block
if ($l =~ /(<[a-zA-Z]+).*>/) {
$conf_lvl++;
if ($l =~ /(<VirtualHost).*>/) {
$conf_virthost++;
}
}
# Indent down next line if a closing block
if ($l =~ /(<\/[a-zA-Z]+).*>/) {
$conf_lvl--;
if ($l =~ /(<\/VirtualHost).*>/) {
$conf_virthost--;
}
# Change current indent right now as it is a closing block
$indent_current = $indent x $conf_lvl;
}
}
# Store previous and current lines
$conf_prev_line = &trim($conf_curr_line);
$conf_curr_line = &trim($l);
# Replace beginning spaces with needed indent
$l =~ s/^\s*/$indent_current/
if($l);
# Check if current line needs to be prepended
# with a new line for better readability
if (!$config{'format_config_lines'}) {
# Allow new line insertion only inside of VirtualHost block
if ($conf_virthost) {
# If current line is not part of a commented block
if ($conf_curr_line !~ /^\s*#/) {
# If previous line is not already an empty line
if (length($conf_prev_line)) {
# If the previous line was something
# we want to take a break before and after match
if (grep {$conf_curr_line =~ /^$_/} @confs_separate &&
grep {$conf_prev_line !~ /^$_/} @confs_separate) {
# If not the first directive in VirtualHost
if($conf_prev_line !~ /(^<VirtualHost).*>/) {
$l = "\n$l"
}
}
# If current is opening block
elsif ($conf_curr_line =~ /(^<[a-zA-Z]+).*>/) {
$l = "\n$l";
}
}
}
}
}
}
}
}

View File

@@ -32,7 +32,7 @@ $ctemp = &transname();
$ktemp = &transname();
$outtemp = &transname();
$size = $in{'size_def'} ? $default_key_size : $in{'size'};
&open_execute_command(CA, "$cmd req -newkey rsa:$size -x509 -nodes -out $ctemp -keyout $ktemp -days $in{'days'} >$outtemp 2>&1", 0);
&open_execute_command(CA, "$cmd req -newkey rsa:$size -x509 -nodes -out ".quotemeta($ctemp)." -keyout ".quotemeta($ktemp)." -days $in{'days'} >".quotemeta($outtemp)." 2>&1", 0);
print CA ($in{'countryName'} || "."),"\n";
print CA ($in{'stateOrProvinceName'} || "."),"\n";
print CA ($in{'cityName'} || "."),"\n";
@@ -42,7 +42,8 @@ print CA ($in{'commonName_def'} ? "*" : $in{'commonName'}),"\n";
print CA ($in{'emailAddress'} || "."),"\n";
close(CA);
$rv = $?;
$out = `cat $outtemp`;
$qouttemp = quotemeta($outtemp);
$out = `cat $qouttemp`;
&unlink_file($outtemp);
if (!-r $ctemp || !-r $ktemp || $?) {
print "<p>$text{'newkey_essl'}<br>\n";
@@ -51,7 +52,7 @@ if (!-r $ctemp || !-r $ktemp || $?) {
exit;
}
&lock_file($in{'newfile'});
&execute_command("cat $ctemp $ktemp 2>&1 >'$in{'newfile'}'", undef, \$catout);
&execute_command("cat ".quotemeta($ctemp)." ".quotemeta($ktemp)." 2>&1 >'$in{'newfile'}'", undef, \$catout);
&unlink_file($ctemp);
&unlink_file($ktemp);
if ($catout || $?) {

View File

@@ -2021,9 +2021,9 @@ my $subject = &build_ssl_subject($in{'countryName'},
$in{'emailAddress'});
my $conf = &build_ssl_config(\@cns);
my $out = &backquote_logged(
"$cmd req -newkey rsa:$size -x509 -sha256 -nodes -out $ctemp -keyout $ktemp ".
"$cmd req -newkey rsa:$size -x509 -sha256 -nodes -out ".quotemeta($ctemp)." -keyout ".quotemeta($ktemp)." ".
"-days ".quotemeta($in{'days'})." -subj ".quotemeta($subject)." ".
"-config $conf -reqexts v3_req -utf8 2>&1");
"-config ".quotemeta($conf)." -reqexts v3_req -utf8 2>&1");
if (!-r $ctemp || !-r $ktemp || $?) {
return $text{'newkey_essl'}."<br>"."<pre>".&html_escape($out)."</pre>";
}