I made mistakes in this script. On line 4 it should read
mkdir $cart or warn $!;
(I should listen to my own advice)
Also it fails if there is no ACE with everyone as the account. So I rejigged it as follows.
use Win32::Perms;
###
#
# get_index_of($account_name, $ace)
#
# Return an array of positions of ACEs
# with trustee of $account_name or if called
# in scalar context the index of the first matching ACE
#
###
sub get_index_of {
my ($account_name, $ace) = @_;
my $index = -1;
my @positions;
do {
$index++;
print "$index";
$perm = $$ace[$index];
print $perm;
if ($perm->{'Account'} eq $account_name) { push @positions, $i
+ndex };
} while ($index < $#$ace);
wantscalar and return $positions[0];
return @positions;
}
$cart='TestingFolder';
mkdir $cart or warn $!;
# Create a new Security Descriptor and auto import permissions
# from the directory
my @perms;
my $perm;
my $Dir = new Win32::Perms( $cart ) or die;
$Dir->Get(\@perms) or die; #Get permissions
$Dir->Dump;
my $acl_index = get_index_of('Everyone', \@perms);
print "Returned ", $acl_index;
print $perm->{'Account'};
if (defined $acl_index) {
$Dir->Remove($acl_index) or die $!;
$Dir->Set() or die$!;
}
$Dir->Dump;
If you --me can you let me know so I can learn?
--blm--