Handle hostnames with upper-case letters
[webmin.git] / exports / delete_exports.cgi
1 #!/usr/local/bin/perl
2 # Delete, disable or enable all exports for some directories
3
4 require './exports-lib.pl';
5
6 # Validate inputs
7 &error_setup($text{'delete_err'});
8 &ReadParse();
9 @d = split(/\0/, $in{'d'});
10 @d || &error($text{'delete_enone'});
11
12 # Find the actual clients
13 &lock_file($config{'exports_file'});
14 @exps = &list_exports();
15 foreach $e (@exps) {
16         if (&indexof($e->{'dir'}, @d) >= 0) {
17                 push(@dels, $e);
18                 }
19         }
20
21 # Take them out, one by one
22 foreach $d (reverse(@dels)) {
23         if ($in{'delete'}) {
24                 &delete_export($d);
25                 }
26         elsif ($in{'disable'} && $d->{'active'}) {
27                 $d->{'active'} = 0;
28                 &modify_export($d, $d);
29                 }
30         elsif ($in{'enable'} && !$d->{'active'}) {
31                 $d->{'active'} = 1;
32                 &modify_export($d, $d);
33                 }
34         }
35 &unlock_file($config{'exports_file'});
36 &webmin_log($in{'delete'} ? "delete" : $in{'disable'} ? "disable" : "enable",
37             "exports", scalar(@dels));
38 &redirect("");
39