Handle hostnames with upper-case letters
[webmin.git] / file / delete.cgi
1 #!/usr/local/bin/perl
2 # delete.cgi
3 # Delete some file or directory
4
5 require './file-lib.pl';
6 $disallowed_buttons{'delete'} && &error($text{'ebutton'});
7 &ReadParse();
8 &webmin_log("delete", undef, $in{'file'}, \%in);
9 print "Content-type: text/plain\n\n";
10 if ($access{'ro'} || !&can_access($in{'file'})) {
11         print &text('delete_eaccess', $in{'file'}),"\n";
12         exit;
13         }
14 if (&indexof($in{'file'}, @allowed_roots) >= 0) {
15         print &text('delete_eroot', $in{'file'}),"\n";
16         exit;
17         }
18 if (-r &unmake_chroot($in{'file'}) && !-d &unmake_chroot($in{'file'})) {
19         &switch_acl_uid_and_chroot();
20         $rv = unlink($in{'file'});
21         if (!$rv) { print "$!\n"; }
22         else { print "\n"; }
23         }
24 else {
25         &switch_acl_uid();
26         ($ok, $err) = &unlink_file(&unmake_chroot($in{'file'}));
27         if (!$ok) { print "$err\n"; }
28         else { print "\n"; }
29         }
30