Handle hostnames with upper-case letters
[webmin.git] / stunnel / backup_config.pl
1
2 do 'stunnel-lib.pl';
3
4 # backup_config_files()
5 # Returns files and directories that can be backed up
6 sub backup_config_files
7 {
8 local @tunnels = &list_stunnels();
9 local @rv = map { $_->{'file'} } @tunnels;
10 local $t;
11 local $ver = &get_stunnel_version();
12 foreach $t (@tunnels) {
13         if ($ver >= 4) {
14                 if ($t->{'args'} =~ /^(\S+)\s+(\S+)/) {
15                         local $cfile = $2;
16                         local @conf = &get_stunnel_config($cfile);
17                         push(@rv, $cfile);
18                         local ($conf) = grep { !$_->{'name'} } @conf;
19                         if ($conf->{'values'}->{'cert'}) {
20                                 push(@rv, $conf->{'values'}->{'cert'});
21                                 }
22                         }
23                 }
24         else {
25                 if ($t->{'args'} =~ /\s*-p\s+(\S+)/) {
26                         push(@rv, $1);
27                         }
28                 }
29         }
30 return &unique(@rv);
31 }
32
33 # pre_backup(&files)
34 # Called before the files are actually read
35 sub pre_backup
36 {
37 return undef;
38 }
39
40 # post_backup(&files)
41 # Called after the files are actually read
42 sub post_backup
43 {
44 return undef;
45 }
46
47 # pre_restore(&files)
48 # Called before the files are restored from a backup
49 sub pre_restore
50 {
51 return undef;
52 }
53
54 # post_restore(&files)
55 # Called after the files are restored from a backup
56 sub post_restore
57 {
58 return &apply_configuration();
59 }
60
61 1;
62