Handle hostnames with upper-case letters
[webmin.git] / stunnel / delete_tunnels.cgi
1 #!/usr/local/bin/perl
2 # Delete several SSL tunnels
3
4 require './stunnel-lib.pl';
5 &ReadParse();
6 &error_setup($text{'delete_err'});
7 @d = split(/\0/, $in{'d'});
8 @d || &error($text{'delete_enone'});
9
10 # Do the deletions
11 @stunnels = &list_stunnels();
12 foreach $d (sort { $b <=> $a } @d) {
13         $st = $stunnels[$d];
14         &lock_file($st->{'file'});
15         if (&get_stunnel_version(\$dummy) >= 4) {
16                 if ($st->{'args'} =~ /^(\S+)\s+(\S+)/) {
17                         $cfile = $2;
18                         if ($cfile =~ /^\Q$module_config_directory\E\//) {
19                                 &lock_file($cfile);
20                                 unlink($cfile);
21                                 }
22                         }
23                 }
24         &delete_stunnel($st);
25         }
26
27 &unlock_all_files();
28 &webmin_log("delete", "stunnels", scalar(@d));
29 &redirect("");
30