Getting share & file permissions

Discussion in 'ASP .Net Security' started by David Thielen, Dec 30, 2006.

  1. Hi;

    Ok, I've almost got my system to handle opening files using any uname/pw
    setup. One item remains.

    If a share and file is set to allow "Everyone" then I want to allow any user
    to open it. This requires either:
    1) Is there a way to get the access rights for a share and for a file in the
    share? In this case I can test for "Everyone" and have my ASP.NET user open
    it.
    2) Is there a way to impersonate an anonymous user and open it? This would
    then fail if access was not set to Everyone.
    3) Is there another way to do this?

    BTW - once I get this part solved, I will put the full code in my blog and
    post a link from here. This will give file access a system similiar to
    XmlUrlResolver for http/ftp.

    --
    thanks - dave
    david_at_windward_dot_net
    http://www.windwardreports.com

    Cubicle Wars - http://www.windwardreports.com/film.htm
    David Thielen, Dec 30, 2006
    #1
    1. Advertising

  2. David Thielen

    Joe Kaplan Guest

    David, it is almost never a good idea to try to interpret the security
    descriptor yourself. It is very easy to get the logic wrong.

    Instead, the better thing to do is to call the Win32 AccessCheck API. Once
    again, there is no good .NET equivalent, but I bet there is a wrapper
    available at www.pinvoke.net or something.

    Best of luck,

    Joe K.

    --
    Joe Kaplan-MS MVP Directory Services Programming
    Co-author of "The .NET Developer's Guide to Directory Services Programming"
    http://www.directoryprogramming.net
    --
    "David Thielen" <> wrote in message
    news:...
    > Hi;
    >
    > Ok, I've almost got my system to handle opening files using any uname/pw
    > setup. One item remains.
    >
    > If a share and file is set to allow "Everyone" then I want to allow any
    > user
    > to open it. This requires either:
    > 1) Is there a way to get the access rights for a share and for a file in
    > the
    > share? In this case I can test for "Everyone" and have my ASP.NET user
    > open
    > it.
    > 2) Is there a way to impersonate an anonymous user and open it? This would
    > then fail if access was not set to Everyone.
    > 3) Is there another way to do this?
    >
    > BTW - once I get this part solved, I will put the full code in my blog and
    > post a link from here. This will give file access a system similiar to
    > XmlUrlResolver for http/ftp.
    >
    > --
    > thanks - dave
    > david_at_windward_dot_net
    > http://www.windwardreports.com
    >
    > Cubicle Wars - http://www.windwardreports.com/film.htm
    >
    >
    Joe Kaplan, Dec 31, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles LaCour
    Replies:
    0
    Views:
    597
    Charles LaCour
    Feb 6, 2004
  2. Amol Shambharker
    Replies:
    1
    Views:
    419
    Cor Ligthert
    Apr 30, 2004
  3. Saraswati lakki
    Replies:
    0
    Views:
    1,277
    Saraswati lakki
    Jan 6, 2012
  4. Jack
    Replies:
    2
    Views:
    193
  5. Eric Wong
    Replies:
    0
    Views:
    188
    Eric Wong
    Feb 13, 2010
Loading...

Share This Page