Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Win32::NetResource

by Necos (Friar)
on Sep 15, 2001 at 05:58 UTC ( [id://112592]=perlquestion: print w/replies, xml ) Need Help??

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

There seems to be a slight problem with Win32::NetResource. Apparently, if you have a server that uses user-level security (i.e., defining who can access the share based on who they are logged in as), you can't set the permissions on the share. I have a program that create a directory, sets the permissions on the directory for local use, but it also needs to set the same permissions that are local for the share (which is user-based). I can't seem to find a structure (C/C++ structure that is...) that will support what I need to do. Has anyone come up with a workaround for this? If so, please let me know. I really would like to finish up this program soon. Thanks for any help.

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

Replies are listed 'Best First'.
Re: Win32::NetResource
by idnopheq (Chaplain) on Sep 15, 2001 at 14:57 UTC
    Can you post your code, the specific errors? It will be far easier to assist with an example.

    Short of that, try Win32::Lanman. UPDATE: also, check out Win32::Perms from Dave Roth for the NTFS permissions.

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

      In "Win32 Perl Scripting: An Administrator's Handbook", Roth writes a section (I believe it's in chapter 3) about Win32::NetResource, Win32::Perms, and Win32::NetAdmin. He mentions that with Win32::NetResource, you can not set user-level share permissions. With Win32::FileSecurity, you can set the permissions on the folder itself. However, those are not the same as the permissions that are allowed when the folder/directory/file/etc. is accessed from a sharepoint (or at least that has been my experience over the last 6 yrs with WinNT.). Please correct me if my thinking is wrong (I could use a slice of humble pie). I looked over the SHARE_INFO_502 C++ structure on MSDN, and it too does not show any way of specifying sharepoint permissions. The only way I know of so far is to set them manually. The program I'm writting right now is for adding lots of users (I can post the module I've written to house most of the code for the server-side.) via RPC. Basically, a student sits down, enters their info, and requests that an account be created. I've seen it done in ASDI, but I wanted to try something different. Also, this setup (after some tweaking), gives me the option of running it on as many servers as I want without adding network traffic (since the RPC.pm only blocks locally). I've been workin on this project for a year now, mainly because the netadmins here in the school district said it can't be done. There are basically 3 parts. The server, the module (Student.pm), and the client. The server is like 6-10 lines (because all the server routines are packed in the module). The module is about 250 lines (because it has routines shared by both server and client). The client portion is also about 250 lines (if you count the routines that are used from the modules, it would amount to about 300-400 lines). If anyone wants to look at this madness code, I'm willing to give it out. It's meant to work with SIS (Student Information System) dumps from the LAUSD system.

      Just as a note, I don't believe this is just a Win32::NetResource problem, but something involving the structure of WindowsNT.

      Theodore Charles III (aka Necos/Secon)
      Network Administrator
      Los Angeles High
      email->secon_kun@hotmail.com()
        Humble appologies if my advice was not to your question. Again, if you can post a snippit I might have been more help.

        Regardless of that, maybe you'll just have to make systems calls to net share. Or, use Win32::API. IIRC, it is possible to write sharepoints directly to the registry via Win32::Registry, Win32::TieRegistry, or Win32API::Registry. YMMV.

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

      Update: The Registry creates two keys. One for the share (which is what Win32::Netresource does), while the other describes the security set on the sharepoint (I tested this on my Windows2000 workstation, so it may be different on my servers, which run NT 4.0 SP5). The first one was easy to figure out with a chr(hex()) mapping. The second, however, leaves me braindead. I can not figure out what the hell it is. When I do the same map, all I come out with is garbage (control chars and such). Maybe I need to do a different mapping to figure out the security data.

      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: perlquestion [id://112592]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-25 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found