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