GetFileSecurity return ERROR_ACCESS_DENIED

GetFileSecurity return ERROR_ACCESS_DENIED

Secure Home | Search | About
 Microsoft Applications Security    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content add this group's latest topics to your Google content
Subject Author Date
GetFileSecurity return ERROR_ACCESS_DENIED Nahanni 10-07-2005
Posted by Nahanni on October 7, 2005, 2:32 am
If you were  Registered and logged in, you could reply and use other advanced thread options
Hi,

I am working on a C CGI application running under IIS6 (W2K3). The
security for this CGI is "Windows Integrated Authentification"
(Challenge/Response), so it is executed under the account of the user
that launched Internet Explorer (a domain user).

In that CGI, I need to execute functions such as "CreateFile" or
"GetFileSecurity" on files through the network (drive mapped or UNC).
These functions return ERROR_ACCESS_DENIED error code.

Question 1 : Why these functions return ERROR_ACCESS_DENIED ?


In order to make these functions works, I try to impersonate the user
by using "LogonUser" and "ImpersonateLoggedOnUser" with hard coded
username and password. It works but it is not a possible solution as I
can't hard code all username and password.

Then I tried to call "ImpersonateLoggedOnUser" with a user token get
with OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, hToken).
"GetTokenInformation" return the correct user name and Impersonation
works, but I sill have ERROR_ACCESS_DENIED.

Question 2 : Why "LogonUser" + "ImpersonateLoggedOnUser" make my code
work and not "OpenProcessToken" + "ImpersonateLoggedOnUser" ?


I hope to be clear.

Thank you for your help.

Dominique


Posted by Roger Abell [MVP] on October 7, 2005, 3:20 am
If you were  Registered and logged in, you could reply and use other advanced thread options
I believe you should be asking in either the MSDN forums or
in one of the inetserver newsgroups. However, I notice that
your first paragraph's conclusion
> so it is executed under the account of the user
> that launched Internet Explorer (a domain user).
is not necessarily true, for example, when the web is not
configured for non-anonymous access.

> Hi,
>
> I am working on a C CGI application running under IIS6 (W2K3). The
> security for this CGI is "Windows Integrated Authentification"
> (Challenge/Response), so it is executed under the account of the user
> that launched Internet Explorer (a domain user).
>
> In that CGI, I need to execute functions such as "CreateFile" or
> "GetFileSecurity" on files through the network (drive mapped or UNC).
> These functions return ERROR_ACCESS_DENIED error code.
>
> Question 1 : Why these functions return ERROR_ACCESS_DENIED ?
>
>
> In order to make these functions works, I try to impersonate the user
> by using "LogonUser" and "ImpersonateLoggedOnUser" with hard coded
> username and password. It works but it is not a possible solution as I
> can't hard code all username and password.
>
> Then I tried to call "ImpersonateLoggedOnUser" with a user token get
> with OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, hToken).
> "GetTokenInformation" return the correct user name and Impersonation
> works, but I sill have ERROR_ACCESS_DENIED.
>
> Question 2 : Why "LogonUser" + "ImpersonateLoggedOnUser" make my code
> work and not "OpenProcessToken" + "ImpersonateLoggedOnUser" ?
>
>
> I hope to be clear.
>
> Thank you for your help.
>
> Dominique
>



Similar ThreadsPosted
Re: MBSA12 return code to KB914791 June 16, 2007, 10:54 pm
Eventcombmt scans return erro 1722 October 18, 2005, 2:55 pm
Windows Firewall Dropping Return UDP Packets March 6, 2008, 3:22 am

The site map in XML format XML site map

Contact Us | Privacy Policy