functionality-test-suite-20020114
[openafs.git] / src / tests / acladdnegrights.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", "rl"]],);
20 ($pos2, $neg2) = &AFS_fs_getacl($path);
21 while ($ret = pop(@$neg2)) {
22     @tmp2=@$ret;
23     if ($tmp2[0] eq "user1") { 
24         $found++;
25     } else {
26         unshift @tmp, @$ret;
27     }
28 }
29
30 if ($found != 1) {
31     exit(1);
32 }
33
34 @tmp2=();
35 while ($ret = pop(@$neg1)) {
36     unshift @tmp2, @$ret;
37 }
38
39 exit(0);
40
41
42