Handle hostnames with upper-case letters
[webmin.git] / sendmail / backup_config.pl
1
2 do 'sendmail-lib.pl';
3 do 'aliases-lib.pl';
4 do 'virtusers-lib.pl';
5 do 'mailers-lib.pl';
6 do 'generics-lib.pl';
7 do 'domain-lib.pl';
8 do 'access-lib.pl';
9
10 # backup_config_files()
11 # Returns files and directories that can be backed up
12 sub backup_config_files
13 {
14 # Add main config file
15 local @rv = ( $config{'sendmail_cf'} );
16 local $conf = &get_sendmailcf();
17
18 # Add files references in .cf
19 local $f;
20 foreach $f (&find_type("F", $conf)) {
21         if ($f->{'value'} =~ /^[wMtGR][^\/]*(\/\S+)/ ||
22             $f->{'value'} =~ /^\{[wMtGR]\}[^\/]*(\/\S+)/) {
23                 push(@rv, $1);
24                 }
25         }
26
27 # Add other maps
28 local $afiles = &aliases_file($conf);
29 push(@rv, $afiles);
30 local $vfile = &virtusers_file($conf);
31 push(@rv, $vfile) if ($vfile);
32 local $mfile = &mailers_file($conf);
33 push(@rv, $mfile) if ($mfile);
34 local $gfile = &generics_file($conf);
35 push(@rv, $gfile) if ($gfile);
36 local $dfile = &domains_file($conf);
37 push(@rv, $dfile) if ($dfile);
38 local $afile = &access_file($conf);
39 push(@rv, $afile) if ($afile);
40
41 # Add .m4 files
42 push(@rv, $config{'sendmail_mc'}) if ($config{'sendmail_mc'});
43
44 return @rv;
45 }
46
47 # pre_backup(&files)
48 # Called before the files are actually read
49 sub pre_backup
50 {
51 return undef;
52 }
53
54 # post_backup(&files)
55 # Called after the files are actually read
56 sub post_backup
57 {
58 return undef;
59 }
60
61 # pre_restore(&files)
62 # Called before the files are restored from a backup
63 sub pre_restore
64 {
65 return undef;
66 }
67
68 # post_restore(&files)
69 # Called after the files are restored from a backup
70 sub post_restore
71 {
72 &restart_sendmail();
73 return undef;
74 }
75
76 1;
77