Try this and see what happens..

I've been successful using this code for a while (where the path is a
directory).  If this works, play with the perms you want to grant, from FULL
to change or whatever).

P.S. sorry for changing your variable name (it was just easier do a copy and
paste for what I had and change your var name)

use strict;
use Win32;
use Win32::Perms;

my $user;
my $path;
my $result;
my $Dir;
my $administrator;
my $admin_group;

$user = "DOMAIN_OR_COMPUTER\\rforbes";

$path = "c:\\inetpub\\wwwroot\\$user";

$Dir = new Win32::Perms("dir:$path",DIRECTORY) || print "error creating
Win32::Perms object\n";

if ($Dir->Allow( $user, GENERIC_ALL, CONTAINER_INHERIT_ACE )) {
  print "  - Allowed $user GENERIC_ALL permissions on Home Dir\n"; 
} else {
  print "  - Failed Allowing $user GENERIC_ALL permissions on Home Dir\n"; 
}
if ($Dir->Allow( $user, FULL, CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE ))
{
  print "  - Allowed $user FULL-INHERITABLE permissions on Dir\n"; 
} else {
  print "  - Failed Allowing $user FULL-INHERITABLE permissions on Dir\n";
}

print "Setting Perms on Home Dir";

if (!$Dir->Set()) {
  print " - Set did not work\n";
} else {
  print " - Success Setting Perms\n";
}

Steven

-----Original Message-----
From: Raymond Forbes [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 28, 2003 10:30 AM
To: Wiechel, Ben; [EMAIL PROTECTED]
Subject: RE: Win32::Perms


ok, that is kinda weird, but i guess nothing can be done about that.

so, this is the heart of my problem.  i can't seem to get this module to do
much of anything useful for me. i can use the Remove (-1) to COMPLETELY
screw up the permissions on an object, but this never comes through.

use strict;
use Win32;
use Win32::Perms;


my $user;
my $path;
my $result;
my $perm_object;
my $administrator;
my $admin_group;

$user = "rforbes";

$path = "c:\\inetpub\\wwwroot\\$user";

$perm_object = new Win32::Perms ($path);

$perm_object -> Allow ($user, CHANGE_DIR, DIR);
$perm_object -> Allow ($user, CHANGE_FILE, FILE);

$result = $perm_object -> Set ();

        print "$result\n";

$perm_object -> Dump ($perm_object);


the set and the dump work just fine, but i am always getting a 0 back for
the allow.  


-----Original Message-----
From: Wiechel, Ben [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 28, 2003 9:36 AM
To: Raymond Forbes; [EMAIL PROTECTED]
Subject: RE: Win32::Perms


Two things:

CheckSD is not a method in Win32::Perms.  I assume you were intending to use
GetSD, which should make your code work.

Second, after doing some testing, it appears that ResolveSID works fine
against a domain, but will not return a SID for a local user.  I could not
return a local user SID no matter what I changed.

--
Benjamin D. Wiechel
Xerox Connect
[EMAIL PROTECTED]
http://members.toast.net/strycher/

 




-----Original Message-----
From: Raymond Forbes [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 28, 2003 3:52 AM
To: [EMAIL PROTECTED]
Subject: RE: Win32::Perms


let's try that again...

        - --------------------------------------------------------- 
        
        
        i am at my wits end on this one.
         
        first, pertinent info...
         
        c:\dev\ioactive>perl -v
         
        This is perl, v5.6.1 built for MSWin32-x86-multi-thread
        (with 1 registered patch, see perl -V for more detail)
         
        Copyright 1987-2001, Larry Wall
         
        Binary build 635 provided by ActiveState Corp.
http://www.ActiveState.com
        Built 15:34:21 Feb  4 2003
         
        Win32-Perms      [0.2002.06.05] The Win32::Perms extension for
Win32 X86.
         
         
        ok, now to the problem.  for some reason i cannot get this to work
in any reasonable way.  i am not sure if i am doing something wrong, or ifit
is a misconfiguration but i thought i would run it by everybody here.
         
        here are some examples of things that don't work.... 
         
        use Win32::Perms;
        $dir = 'c:/inetpub';
         
        $perm = new Win32::Perms ($dir);
         
        $result = $perm -> CheckSD();
         
        print $result;
        

        
        ( $result is always 0 here)
         
        $result2 = Win32::Perms::ResolveSid ("W2KASVM1\\administrator");
        print "the sid is:$result2\n";
         
        this returns nothing in $result2.  not sure if it is a NULL or UNDEF
or what.
         
         
        the part that is so frustrating is it's impossible to see what is
actually going wrong.  since i can't get the Win32 error messages to bubble
to the top, i don't even know where to begin.
         
           
        
         
         
         
         
         

_______________________________________________
Perl-Win32-Admin mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to