hi all !!

I'm investigating about the gordian knot (not the rip pack!) of ntfs permissions. The core module in activeperl Win32::FileSecurity not cover all the 'features' of the filesystem. The API::File module is too complex so I'm trying to use Win32::Perms.

The task is to substitute one account with another one.
The Remove method ran correctly in a test script but when I put it in recursive sub the scripts hung with CPU at 100%.
Here the code:
###globals my $vecchio = 'DOMAIN\old_user'; my $vec_usr = 'old_user'; my $vec_dom='DOMAIN'; my $nuovo= '\\MACHINE\new_user'; my $nuo_usr= 'new_user'; my $new_dom= 'MACHINE'; ########## # take the root &substitute_dacl($root) ################### sub substitute_dacl { my $path = shift; print"\n-------------\n$path\n"; $perm = new Win32::Perms($path)|| die "$!"; $perm->Dump(\@list); my $owner=$perm->Owner(); if ($owner eq $vecchio) {$perm->Owner($nuovo); print "owner: $owner\t";print "Change owner\n"} foreach $elem(@list) { if (${$elem}{'Account'} eq $vec_usr) { print"-------> $vec_usr in $path\n"; my %hash=( 'Account' =>$nuo_usr, 'Domain' =>$nuo_dom, 'Mask' =>${$elem}{'Mask'}, #take the old 'Type' =>${$elem}{'Type'}, #options 'Flag' =>${$elem}{'Flag'}, # as is ); $perm->Add(\%hash)||warn "No add..\n"; $perm->Remove($vec_usr)||warn "$^E $!";# FAILS & HUNG if ($perm->Set()){print "Set ok\n"}else{warn "$^E $!"} #system "cacls \"$path\" /E /R ${$elem}{'Domain'}\\${$elem}{'Acc +ount'}";#THIS WORK BUT TERRIBLE last; } } }
What is happening ? any suggestion welcome

greetings from sunny hot roma
Lor*363341

In reply to Win32::Perms Remove method by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.