Is GetSecurityDescriptor broken?? 
Author Message
 Is GetSecurityDescriptor broken??

I'm using VBScript with WSH as part of a project to consolidate data on our
servers. One of the functions of the script is to copy a file, along with
its permissions,  and I've got ADSI's security package (ADsSecurity.dll)
registered to help with this.

OK, so I use the GetSecurityDescriptor method to get the Security Descriptor
for the file before I copy it. All works well. UNLESS I have no permissions
at all on the file, at which time an access violation occurs and I get a
message

The instruction 0x77f8d6d7 referenced memory at 0x0000003. The memory could
not be "read"

Consider the following:

filespec="c:\blah.txt"
filespec="FILE://"&filespec
set osdUtil = CreateObject("ADsSecurity")
set sd = osdUtil.GetSecurityDescriptor(cStr(filespec))

If I have permissions to c:\blah.txt (I am running everything as Domain
Admin) then GetSecurityDescriptor returns me the Security Descriptor. If I
don't have permissions, rather than return an error, or a null object,
ADsSecurity.dll crashes (at the last line in this example)!!!

This is a bit of chicken and the egg situation. How do I tell if I have
permissions on a file without attempting to read the permissions? Surely
there must be some way to do this.



Tue, 05 Oct 2004 07:24:14 GMT  
 Is GetSecurityDescriptor broken??

Quote:
> This is a bit of chicken and the egg situation. How do I tell if I
> have permissions on a file without attempting to read the
> permissions? Surely there must be some way to do this.

shell out and run cacls "<filename>" and capture the output.  If there aren't any ACLs on the file, all you get back is one line of output containing only the file name that was passed.  At least that's how cacls behaves on Win2000 pro when I run it against a filename on a FAT32 volume...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Tue, 05 Oct 2004 08:33:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Is GetSecurityDescriptor broken??

2. I am looking for a HTTP/1.1 ASP component

3. onkeypress - what am i doing wrong

4. a procedure I am writing for using with kshow

5. I am serious.

6. Am I stupid? Window width/height

7. --- I am new and need help!!!

8. Am I writing over something ?

9. I am Looking for a senior Postscript Programmer

10. What am I missing here

11. Not very important, but I am curious

12. What Function am I in?

 

 
Powered by phpBB® Forum Software