I suspect you have a SID that can't be translated into the readable
name. I think Win32::FileSecurity *should* be able to tolerate that, so
I'd say it's just buggy. Try using Win32::Security::NamedObject. It's
a bit more confusing, but it seems to work right (if you can figure out
how to install it):
G:\perl -e use Win32::Security::NamedObject; my $f =
Win32::Security::NamedObject-new('FILE','foo.txt'); my $d=$f-dacl();
print $d-dump;
Win32::Security::ACL-new('SE_FILE_OBJECT',
['ACCESS_ALLOWED_ACE_TYPE', 'INHERITED_ACE', 'READ',
'S-1-5-21-1242909238-215958010-794563710-513'],
['ACCESS_ALLOWED_ACE_TYPE', 'INHERITED_ACE', 'FULL',
'S-1-5-21-1242909238-215958010-794563710-7176'],
['ACCESS_ALLOWED_ACE_TYPE', 'INHERITED_ACE', 'READ',
'S-1-5-21-81088256-2045271245-1062434389-513'],
['ACCESS_ALLOWED_ACE_TYPE', 'INHERITED_ACE', 'FULL',
'S-1-5-21-854245398-842925246-682003330-500'],
['ACCESS_ALLOWED_ACE_TYPE', 'INHERITED_ACE', 'FULL',
'BUILTIN\Administrators'],
['ACCESS_ALLOWED_ACE_TYPE', 'INHERITED_ACE', 'READ', 'NT
AUTHORITY\Authentic
ated Users']
)
G:\perl -e use Win32::Security::NamedObject; my $f =
Win32::Security::NamedObject-new('FILE','foo.txt'); my $d=$f-dacl();
$d-deleteAces(sub {return ($_-trustee() =~
m/^S-1/)});$f-dacl($d,PROTECTED_DACL_SECURITY_INFORMATION);
G:\perl -e use Win32::Security::NamedObject; my $f =
Win32::Security::NamedObject-new('FILE','foo.txt'); my $d=$f-dacl();
print $d-dump;
Win32::Security::ACL-new('SE_FILE_OBJECT',
['ACCESS_ALLOWED_ACE_TYPE', undef, 'FULL', 'BUILTIN\Administrators'],
['ACCESS_ALLOWED_ACE_TYPE', undef, 'READ', 'NT
AUTHORITY\Authenticated Users']
)
Josh Quintus wrote:
I am trying to write a simple script that will copy all of the windows
file permissions from one file to another file. According to the
documentation, this is exactly what Win32::FileSecurity does. However
I keep coming into the same error, for which I cannot find any
documentation.
It pretty much boils down to whenever I call the 'Set' method i get
this runtime error:
Error handling error: 1722, LookupAccountName
I am running this in a winXP system with an NTFS formated file system,
using ActivePerl v5.8.
The code snippet provided is from the documentation for
Win32::FileSecurity
use Win32::FileSecurity qw(MakeMask Get Set);
# These masks show up as Full Control in File Manager
$file = MakeMask( qw( FULL ) );
$dir = MakeMask( qw(
FULL
GENERIC_ALL
) );
foreach( @ARGV ) {
s/\\$//;
next unless -e;
Get( $_, \%hash ) ;
$hash{Administrator} = ( -d ) ? $dir : $file ;
Set( $_, \%hash ) ;
}
thanks in advance
_
Planning a family vacation? Check out the MSN Family Travel guide!
http://dollar.msn.com
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm
--
, , , | Duane Bronson
/|/|/| , | [EMAIL PROTECTED]
( ( ( |/| | http://www.nerdlogic.com/
\( | | 453 Washington St. #4A, Boston, MA 02111
|/| (617) 515-2909
___
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm