mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Allow manual editing of all config files
This commit is contained in:
@@ -5,31 +5,7 @@ do 'postfix-lib.pl';
|
||||
# Returns files and directories that can be backed up
|
||||
sub backup_config_files
|
||||
{
|
||||
local @rv;
|
||||
|
||||
# Add main config file
|
||||
push(@rv, $config{'postfix_config_file'});
|
||||
|
||||
# Add known map files
|
||||
push(@rv, &get_maps_files("alias_maps"));
|
||||
push(@rv, &get_maps_files("alias_database"));
|
||||
push(@rv, &get_maps_files("canonical_maps"));
|
||||
push(@rv, &get_maps_files("recipient_canonical_maps"));
|
||||
push(@rv, &get_maps_files("sender_canonical_maps"));
|
||||
push(@rv, &get_maps_files($virtual_maps));
|
||||
push(@rv, &get_maps_files("transport_maps"));
|
||||
push(@rv, &get_maps_files("relocated_maps"));
|
||||
|
||||
# Add other files in /etc/postfix
|
||||
local $cdir = &guess_config_dir();
|
||||
opendir(DIR, $cdir);
|
||||
foreach $f (readdir(DIR)) {
|
||||
next if ($f eq "." || $f eq ".." || $f =~ /\.(db|dir|pag)$/i);
|
||||
push(@rv, "$cdir/$f");
|
||||
}
|
||||
closedir(DIR);
|
||||
|
||||
return &unique(@rv);
|
||||
return &get_all_config_files();
|
||||
}
|
||||
|
||||
# pre_backup(&files)
|
||||
|
||||
@@ -7,7 +7,7 @@ $access{'manual'} || &error($text{'cmanual_ecannot'});
|
||||
&ui_print_header(undef, $text{'cmanual_title'}, "");
|
||||
|
||||
# Work out and show the files
|
||||
@files = ( $config{'postfix_config_file'}, $config{'postfix_master'} );
|
||||
@files = &get_all_config_files();
|
||||
$in{'file'} ||= $files[0];
|
||||
&indexof($in{'file'}, @files) >= 0 || &error($text{'cmanual_efile'});
|
||||
print &ui_form_start("manual.cgi");
|
||||
@@ -19,9 +19,11 @@ print &ui_form_end();
|
||||
|
||||
# Show the file contents
|
||||
print &ui_form_start("manual_update.cgi", "form-data");
|
||||
print &ui_table_start(undef, undef, 2);
|
||||
print &ui_hidden("file", $in{'file'}),"\n";
|
||||
$data = &read_file_contents($in{'file'});
|
||||
print &ui_textarea("data", $data, 20, 80),"\n";
|
||||
print &ui_table_row(undef, &ui_textarea("data", $data, 20, 80), 2);
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
@@ -7,7 +7,7 @@ $access{'manual'} || &error($text{'cmanual_ecannot'});
|
||||
&ReadParseMime();
|
||||
|
||||
# Work out the file
|
||||
@files = ( $config{'postfix_config_file'}, $config{'postfix_master'} );
|
||||
@files = &get_all_config_files();
|
||||
&indexof($in{'file'}, @files) >= 0 || &error($text{'cmanual_efile'});
|
||||
$in{'data'} =~ s/\r//g;
|
||||
if ($in{'file'} eq $files[0]) {
|
||||
|
||||
@@ -2217,5 +2217,37 @@ my ($cmd) = @_;
|
||||
return &has_command($cmd);
|
||||
}
|
||||
|
||||
# get_all_config_files()
|
||||
# Returns a list of all possible postfix config files
|
||||
sub get_all_config_files
|
||||
{
|
||||
my @rv;
|
||||
|
||||
# Add main config file
|
||||
push(@rv, $config{'postfix_config_file'});
|
||||
push(@rv, $config{'postfix_master'});
|
||||
|
||||
# Add known map files
|
||||
push(@rv, &get_maps_files("alias_maps"));
|
||||
push(@rv, &get_maps_files("alias_database"));
|
||||
push(@rv, &get_maps_files("canonical_maps"));
|
||||
push(@rv, &get_maps_files("recipient_canonical_maps"));
|
||||
push(@rv, &get_maps_files("sender_canonical_maps"));
|
||||
push(@rv, &get_maps_files($virtual_maps));
|
||||
push(@rv, &get_maps_files("transport_maps"));
|
||||
push(@rv, &get_maps_files("relocated_maps"));
|
||||
|
||||
# Add other files in /etc/postfix
|
||||
local $cdir = &guess_config_dir();
|
||||
opendir(DIR, $cdir);
|
||||
foreach $f (readdir(DIR)) {
|
||||
next if ($f eq "." || $f eq ".." || $f =~ /\.(db|dir|pag)$/i);
|
||||
push(@rv, "$cdir/$f");
|
||||
}
|
||||
closedir(DIR);
|
||||
|
||||
return &unique(@rv);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user