onetime has asked for the wisdom of the Perl Monks concerning the following question:

I am currently trying to set the attribute on a folder to inherit permissions from it's parent if it is not already set to do so using ADsSecurity from the Windows 2003 Resource kit, but I can't seem to figure this out. From everything I've read the below code should work okay, can anyone point out something that I'm missing? In the end the plan is to set a folder to inherit permissions if it already isn't inheriting and then set one explicit permission on that folder for a specific user.
use constant SE_DACL_PROTECTED => 0x1000; my $ADsSecurity = Win32::OLE->new("ADsSecurity"); my $objSD = $ADsSecurity->GetSecurityDescriptor("FILE://". $path); #get the control flags my $control_flags = $objSD->{Control}; print "Current Flag: $control_flags\n"; #37892 = 0x9404 = no inheritance set if($control_flags == 37892){ #37892 ^ 4096 (0x1000) = 33796 = 0x8404 = set inheritance $control_flags = $control_flags ^ SE_DACL_PROTECTED; $objSD->{Control} = $control_flags; $ADsSecurity->SetSecurityDescriptor($objSD); print "Set for Inheritance: $control_flags\n"; }
Any help would be apperciated. Thanks.

Replies are listed 'Best First'.
Re: Modifying NTFS Permissions
by BrowserUk (Patriarch) on Jul 17, 2008 at 17:08 UTC
Re: Modifying NTFS Permissions
by Anonymous Monk on Jul 18, 2008 at 08:19 UTC