access_table() challenge - win a Samba t-shirt!

Michael Stockman pgmtekn-micke at algonet.se
Mon Jan 17 16:54:45 GMT 2000


> > //
> > //  Define the generic mapping array.  This is used to denote the
> > //  mapping of each generic access right to a specific access
mask.
> > //
> >
> > typedef struct _GENERIC_MAPPING {
> >     ACCESS_MASK GenericRead;
> >     ACCESS_MASK GenericWrite;
> >     ACCESS_MASK GenericExecute;
> >     ACCESS_MASK GenericAll;
> > } GENERIC_MAPPING;
> > typedef GENERIC_MAPPING *PGENERIC_MAPPING;
>
> are they insane????  they haven't... they wouldn't... they wouldn't
have
> four sets of access rights on files, would they???

Insane, probably sometimes.

However they might mot be as insane as it seems as it is
possible/probable that each of the members is treated as a boolean. I
do note that there is a function to convert between a GENERIC_MAPPING
and an ACCESS_MASK.

--- example ---
ACCESS_MASK mask = GENERIC_READ;
GENERIC_MAPPING map;

MapGenericMask( &mask, &map );

/* Possible result */
map.GenericRead == true;
map.GenericWrite == false;
map.GenericExecute == false;
map.GenericAll == false;
--- end example ---
--- possible implmentation ---
void MapGenericMask( PACCESS_MASK mask, PGENERIC_MAPPING map )
{
  map->GenericRead = !!(*mask & GENERIC_READ);
  map->GenericWrite = !!(*mask & GENERIC_WRITE);
  map->GenericExecute = !!(*mask & GENERIC_EXECUTE);
  map->GenericAll = !!(*mask & GENERIC_ALL);
}
--- end implementation ---

This doesn't tell how it is, just how it might be. I'm not going to go
near NT for a while it seems, so you'll just have to find out if it's
important to you.

Best regards
  Michael Stockman
  pgmtekn-micke at algonet.se





More information about the samba-technical mailing list