mirror of
https://github.com/webmin/webmin.git
synced 2025-08-17 19:06:28 +00:00
Support editing of servers with the same name and type, and check for clashes when creating and editing.
https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3309470&group_id=17457
This commit is contained in:
@ -76,3 +76,5 @@ Fixed the descriptions of logged events as shown in the Webmin Actions Log modul
|
||||
---- Changes since 1.510 ----
|
||||
Added support for CIDR maps and multiple SMTP client restriction maps.
|
||||
Added spam checking to the autoreply script, if spamassassin is installed.
|
||||
---- Changes since 1.550 ----
|
||||
Fixed a bug that prevented editing of server processes with the same name but different types, and add detection of clashes for servers with the same name and type.
|
||||
|
@ -18,7 +18,8 @@ if ($in{'new'}) {
|
||||
};
|
||||
}
|
||||
else {
|
||||
($prog) = grep { $_->{'name'} eq $in{'name'} } @$master;
|
||||
($prog) = grep { $_->{'name'} eq $in{'name'} &&
|
||||
$_->{'type'} eq $in{'type'} } @$master;
|
||||
$prog || &error($text{'master_egone'});
|
||||
&ui_print_header(undef, $text{'master_edit'}, "");
|
||||
}
|
||||
@ -26,6 +27,7 @@ else {
|
||||
print &ui_form_start("save_master.cgi", "post");
|
||||
print &ui_hidden("new", $in{'new'}),"\n";
|
||||
print &ui_hidden("old", $in{'name'}),"\n";
|
||||
print &ui_hidden("oldtype", $in{'type'}),"\n";
|
||||
print &ui_table_start($text{'master_header'}, "width=100%", 4);
|
||||
|
||||
print &ui_table_row($text{'master_type'},
|
||||
|
@ -676,6 +676,7 @@ master_max2=Maximum processes
|
||||
master_procs=At most $1
|
||||
master_name2=Server name/port
|
||||
master_egone=Server process no longer exists!
|
||||
master_eclash=A server process with the same name and transport type already exists
|
||||
master_err=Failed to save server process
|
||||
master_ename=Missing or invalid server name or port
|
||||
master_ehost=Invalid host address to listen on
|
||||
|
@ -17,7 +17,8 @@ print &ui_columns_start([ $text{'master_name'},
|
||||
$text{'master_max'} ], "100%");
|
||||
foreach $m (@$master) {
|
||||
print &ui_columns_row([
|
||||
"<a href='edit_master.cgi?name=".&urlize($m->{'name'})."'>".
|
||||
"<a href='edit_master.cgi?name=".&urlize($m->{'name'}).
|
||||
"&type=".&urlize($m->{'type'})."'>".
|
||||
$m->{'name'}."</a>",
|
||||
$m->{'enabled'} ? $text{'yes'} :
|
||||
"<font color=#ff0000>$text{'no'}</font>",
|
||||
|
@ -10,7 +10,8 @@ if ($in{'new'}) {
|
||||
$prog = { };
|
||||
}
|
||||
else {
|
||||
($prog) = grep { $_->{'name'} eq $in{'old'} } @$master;
|
||||
($prog) = grep { $_->{'name'} eq $in{'old'} &&
|
||||
$_->{'type'} eq $in{'oldtype'} } @$master;
|
||||
$prog || &error($text{'master_egone'});
|
||||
}
|
||||
&lock_file($config{'postfix_master'});
|
||||
@ -58,6 +59,17 @@ else {
|
||||
$prog->{'maxprocs'} = $in{'procs'};
|
||||
}
|
||||
|
||||
# Check for clash by name and type, but only between enabled servers
|
||||
if ($in{'enabled'}) {
|
||||
if ($in{'new'} || $in{'name'} ne $in{'old'} ||
|
||||
$in{'type'} ne $in{'oldtype'}) {
|
||||
($clash) = grep { $_->{'name'} eq $in{'name'} &&
|
||||
$_->{'type'} eq $in{'type'} &&
|
||||
$_->{'enabled'} } @$master;
|
||||
$clash && &error($text{'master_eclash'});
|
||||
}
|
||||
}
|
||||
|
||||
# Save or update
|
||||
if ($in{'new'}) {
|
||||
&create_master($prog);
|
||||
|
Reference in New Issue
Block a user