My apologies to those of you who subscribe to the Topica.com Perl-NT Admins
list.  You may get this message twice.  I'm re-posting to this list because
lately it can take several hours for my message to show up on the topica
list.

=========================================
ORIGINAL MESSAGE
=========================================


I have been working up a small program to practice dumping ACL's from a
share.  I'm running into two problems:  1)When I need to resolve the SID of
a server's local group account.  It's just showing up as empty.  Domain
group accounts show up fine.  2)If I try to get a list of "friendly" access
permission names using DecodeMask, it comes up empty as well. 

Is there any way to get around this?  

Here's my code:

########################################################

use strict;
use warnings;

use Win32::Perms;
my $fullpath = $ARGV[0];
opendir(PERMDIR,$fullpath) || die "Could not open path!";
my @files = readdir(PERMDIR);

foreach(@files){
        $_ = "$fullpath\\".$_;
}

open(OUTFILE,">perms.log") || die "Could not open logfile!";
foreach my $target(@files){
        unless($target =~ /\.{1,2}$/ || !-d $target){
                my $perm = new Win32::Perms($target) || die "Could not
create Perms object!";
                my @permslist = ();
                $perm->Get(\@permslist);
                my $count = @permslist;
                Tee("==============================================\n");
                Tee("Dumping ACL of $target\n");
                Tee("Total ACEs:  $count\n");
                Tee("==============================================\n");
                foreach(@permslist){
                        my(@FullList,@fnames);
                        my $name = Win32::Perms::ResolveAccount(${$_}{SID});
                        DecodeMask($_,\@FullList);
                        print OUTFILE "   .......................\n";
                        print OUTFILE "   Name:    $name\n";
                        print OUTFILE "   Access:  ";
                        foreach my $item(@FullList){
                                print OUTFILE "$item\|";
                        }
                        print OUTFILE "\n";
                }
        }
}

sub Tee{
        print @_;
        print OUTFILE @_;
}


Tim Johnson

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to