-
Notifications
You must be signed in to change notification settings - Fork 16
/
getfacl.cgi
46 lines (37 loc) · 1013 Bytes
/
getfacl.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
require './filemin-lib.pl';
use lib './lib';
&ReadParse();
get_paths();
print_ajax_header();
# Remove exploiting "../"
$name = $in{'name'};
$name =~ s/\.\.//g;
$name = &simplify_path($name);
# my @errors;
# $command = "getfacl ".quotemeta("$cwd$name")." 2>&1";
# $result = `$command`;
# print Mojo::JSON::to_json({'success' => "$result"});
$out = &backquote_command("getfacl ".quotemeta("$cwd$name")." 2>&1");
if ($?) {
print $out,"\n";
}
else {
foreach $l (split(/\n/, $out)) {
$l =~ s/#.*$//;
$l =~ s/\s+$//;
push(@rv, $l) if ($l =~ /\S/);
}
if (!@rv) {
print "Filesystem does not support ACLs\n";
}
else {
print "\n";
foreach $l (@rv) {
# $l =~ s/:/ /g;
if (index($l, "user") != -1) {
print $l,"\n";
}
}
}
}