fix dumptool on macos
[openafs.git] / src / tests / aclclearnegrights.pl
1 #!/usr/bin/env perl
2 use OpenAFS::CMU_copyright;
3 use OpenAFS::util qw(:DEFAULT %AFS_Help);
4 use OpenAFS::afsconf;
5 use OpenAFS::fs;
6 use OpenAFS::pts;
7 use OpenAFS::vos;
8 use OpenAFS::bos;
9
10 my ($wscell, $path, @pos1, @pos2, @neg1, @neg2, $ret, @tmp, @tmp2, @tmp3, $found);
11 &AFS_Init();
12 $wscell = &AFS_fs_wscell();
13 $found = 0;
14
15 eval { &AFS_pts_createuser(user1,,); };
16 $path = "/afs/${wscell}/service/acltest";
17 mkdir $path, 0777;
18 ($pos1, $neg1) = &AFS_fs_getacl($path);
19 $ret = &AFS_fs_setacl([$path],[],[["user1", "r"]],);
20 ($pos2, $neg2) = &AFS_fs_getacl($path);
21 while ($ret = pop(@$neg2)) {
22     @tmp2=@$ret;
23     if ($tmp2[0] eq "user1") { 
24         if ($tmp2[1] ne "r") {
25             exit 1;
26         }
27         $tmp2[1] = "rl";
28         unshift @tmp, @tmp2;
29     } else {
30         unshift @tmp, @$ret;
31     }
32 }
33
34 @tmp2=();
35 while ($ret = pop(@$neg1)) {
36     unshift @tmp2, @$ret;
37 }
38
39 if (@tmp != @tmp2) {
40     exit(1);
41 }
42 if (@pos1 != @pos2) {
43     exit(1);
44 }
45 exit(0);
46
47
48