Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: Re: Re: Win32::NetResource

by Necos (Friar)
on Sep 17, 2001 at 22:21 UTC ( [id://112989]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Re: Re: Win32::NetResource
in thread Win32::NetResource

This is a quote directly from the book (Win32 Perl Programming: The Standard Extensions, page 39):

"The capability to specify user-level permissions (that is, permissions assigned to users and/or groups) on a share is currently not supported under any of the standard Win32 extensions."

Then there is another statement some ways later in the book that reads (page 48):

"Currently, the Win32::NetResource extension is not capable of applying account-based permissions on a network share. Users who need to apply permissions can use the Explorer or Server Manager programs that come with WindowsNT."

This is my subroutine:
sub usr_add { my $obj = shift; my $usr = shift; my $bday = Student::get_attr($obj, 'BDAY_ID'); print STDERR "$bday\n"; my @bday = split(/\x2F/,$bday); $bday = join("",@bday); print STDERR "$bday\n"; my $hdir = ""; my @buf2; my $buf1 = Student::get_attr($obj, 'LN'); print STDERR "$buf1\n"; my $buf2 = Student::get_attr($obj, 'FN'); print STDERR "$buf2\n"; $buf2 =~ s/^\s+//; $buf2 =~ s/\s+$//; $buf1 =~ s/^\s+//; $buf1 =~ s/\s+$//; @buf2 = split(/\s/, $buf2); $buf2 = "$buf2[0]"; $buf2 =~ s/^\s+//; $buf2 =~ s/\s+$//; $hdir = join(',', $buf1, $buf2); print STDERR "$hdir\n"; my $hdir_srv = 'd:/' . "$hdir"; print STDERR "$hdir_srv\n"; mkdir($hdir_srv, '0777'); my $student_perms = Win32::FileSecurity::MakeMask( qw( CHANGE GENE +RIC_WRITE GENERIC_READ GENERIC_EXECUTE ) ); my $staff_perms = Win32::FileSecurity::MakeMask( qw( CHANGE GENERI +C_WRITE GENERIC_READ GENERIC_EXECUTE ) ); my $admin_perms = Win32::FileSecurity::MakeMask( qw(FULL GENERIC_A +LL) ); my %hdir_perm_hash; if ( Win32::FileSecurity::Get($hdir_srv, \%hdir_perm_hash) ) { print STDERR "$hdir_srv has been opened\n"; } $hdir_perm_hash{'CLC\\Domain Patricians'} = $staff_perms; $hdir_perm_hash{'CLC\\Domain Admins'} = $admin_perms; $hdir_perm_hash{'CLC\\Domain Plebs'} = $student_perms; delete($hdir_perm_hash{'Everyone'}); if ( Win32::FileSecurity::Set($hdir_srv, \%hdir_perm_hash) ) { print STDERR "$hdir_srv has been set\n"; } print "\n"; print STDERR "$usr\n"; return($usr, $bday, $hdir); }


This code works for everything that I've done so far. The next step after creating the directory and setting local permissions for it is to share it and set the permissions for accessing it through the sharepoint (since it will be the user's home directory, we don't want anyone just accessing it any ole way. I might have to hack together a Win32::Registry routine that sets the permissions in the registry itself (I'm still researching that) if that's possible. More updates to come...

Theodore Charles III
Network Administrator
Los Angeles High
email->secon_kun@hotmail.com()

Replies are listed 'Best First'.
Nested Re: Win32::NetResource
by idnopheq (Chaplain) on Sep 18, 2001 at 12:45 UTC
    A tool that will help w/ the registry keys is RegMon from SysInternals. It will spit out odles and odles of registry access info depending on how much stuff you have running at the time, but it helped me with the various and sundary keys in tracking down the TCP/IP settings.

    When you get something hacked together, I'd be happy to help you test it as pennace for my inappropriate and/or inaccurate response before.

    UPDATE: check out HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Services\lanmanserver\Shares !!!

    HTH
    --
    idnopheq
    Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

      I was just reading some stuff on the MS Knowledge Base about that reg key. The only weird thing is that the whole thing is in hex/bin. I have yet to figure out the data stored there, but it's apparent that is what we are lookin for. I guess if we figure out some sort of hex/bin->dec/ascii conversion, I'll have what I need to finish this madness up. Thanks again for putting up with my madness. I ask some pretty obscure questions when it comes to Perl, mainly because I've never seen them asked before.

      Hopefully, I'll be able to get this stuff done without too much more trouble. Thanks again for all the leads.

      Theodore Charles III
      Network Administrator
      Los Angeles High
      email->secon_kun@hotmail.com()

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://112989]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.