OT - file permission checks on Windows

logistix logstx at bellatlantic.net
Mon Mar 4 17:25:53 EST 2002


Yeah,

Windows permissions are totally different than Unix and alot more robust,
assuming you don't go with the default install ;)

There are 13 (I believe) different "flags" that can be applied to files.
Each of these is attached to a user or group in an Access Control List.  The
list size is entirely arbitrary, so you're not tied into User, Group, Other
levels.  Then in W2K you can even specify explicit Denies that override
permissions.  This allows you to do all sorts of goofy stuff like preventing
the Administrator (root) from even being able to view files, or granting all
"RESEARCH" users change control unless that "RESEARCH" user is "JOE"

xcacls is the command line equiv. of chmod if you want to get a quick idea
of how different things are.
--
-

"Skip Montanaro" <skip at pobox.com> wrote in message
news:mailman.1015266376.28131.python-list at python.org...
>
> Sorry for the off-topic post.  My entire C programming world these days is
> in the Python community, so I'm completely disconnected from other C
> programming resources.  (Pointer to information about porting Unix code to
> MSVC would be much appreciated.)
>
> Given this simple file access permission code:
>
>     mode_check(struct stat *buf, uid_t uid, uid_t gid,
>                unsigned int umask, unsigned int gmask, unsigned int omask)
>     {
>         /* root always gets to go */
>         if (uid == 0) return 1;
>
>         if (uid == buf->st_uid) return buf->st_mode & umask;
>
>         if (gid == buf->st_gid) return buf->st_mode & gmask;
>
>         return buf->st_mode & omask;
>     }
>
> how would I do this under Windows?  Is the permission model there even
> remotely similar to what I'm used to on Unix systems?  I poked around
> posixmodule.c, but it makes next to no use of uids and gids.  As far as I
> can tell, Windows doesn't know about uid_t or gid_t, though it has a
struct
> _stat type whose st_uid and st_gid fields are shorts, so I can work around
> the missing types.
>
> Thx,
>
> --
> Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
>





More information about the Python-list mailing list