File_security(3)                                              File_security(3)



NNAAMMEE
       File_security -

SSYYNNOOPPSSIISS
   PPuubblliicc MMeetthhooddss
       void ssaavvee__sseellff ()
       void llooaadd__sseellff ()
       void ccrreeaattee ()
       string ggeett__ssuubbddiirr (string path)
       string * qquueerryy__ddiirr__ggrroouuppss (string path, int req_type)
       string qquueerryy__aacccceessss (string path, string uid, int req_type)
       int aadddd__ggrroouupp__uuiidd (string uid, string group)
       int rreemmoovvee__ggrroouupp__uuiidd (string uid, string group)
       string * qquueerryy__ggrroouupp__uuiidd (string uid)
       int ttoo__rreeqq__ttyyppee (string str)
       int aadddd__ddiirr__ggrroouupp (string path, string group, int req_type)
       int rreemmoovvee__ddiirr__ggrroouupp (string path, string group, int req_type)
       int sseett__ddiirr__oowwnneerr (string path, string owner)
       string qquueerryy__ddiirr__oowwnneerr (string path)
       string qquueerryy__ffiillee__oowwnneerr (string path)
       int sseett__ffiillee__oowwnneerr (string file, string owner)
       mapping qquueerryy__aacccceessss__ttaabbllee (int req_type)
       int qquueerryy__aallllooww__sseett (object caller, object callee)

   PPuubblliicc AAttttrriibbuutteess
       mapping ggrroouuppss
       mapping aallllooww__mmiinniimmaall__rreeaadd
       mapping aallllooww__nnoorrmmaall__rreeaadd
       mapping aallllooww__ccrreeaattee
       mapping aallllooww__mmooddiiffyy
       mapping ffiillee__oowwnneerr

   SSttaattiicc PPuubblliicc AAttttrriibbuutteess
       string * uuiidd__lliisstt

DDEETTAAIILLEEDD DDEESSCCRRIIPPTTIIOONN
       This file was first commented before Doxygen, so the documentation
       might be a little strange in spots. It could use some updates. Read any
       help files/docs you can find on MUD file security and it will help this
       code make sense. The following is some notes from development, trying
       to decide how things would work:

       Each directory needs to have:

       The groups that have full access to that directory.

       Groups that may create new files in that directory (they may only edit
       the files they own).

       Groups that may read files in a directory. Each file needs to have:

       An owner--name of the group that created it. Each file accessor must
       have:

       A list of groups of which they are a member. (their default group is
       their UID, additional groups are kept here).

       Access is always granted if *any* of the groups have access to a file.
       If you do not have an entry in 'groups', then you are a member of only
       the groups 'all' and the group with your name. If you do have an entry
       (which is an array of string) then you add all those entries to your
       uid list.

       The 'owner' of a directory is the first person given on the
       allow_modify list for the directory.

       file_owner is a list of exceptions to the file ownership rules. It is
       assumed that a file belongs to the directory owner, unless that file
       (full path as a key) has an entry in this mapping. The only
       circumstance for adding entries (short of attribute changes) is when a
       person with allow_create access to a directory makes a file there. That
       file then belongs to them, and they may modify it later. In directories
       to which something only has allow_create access, they may only modify
       those files which they own.

       Note: keys for directories all end in '/', so when passing in
       directories, append a '/' to their name.

       Definition at line 56 of file file_security.c.

MMEEMMBBEERR FFUUNNCCTTIIOONN DDOOCCUUMMEENNTTAATTIIOONN
   iinntt aadddd__ddiirr__ggrroouupp ((ssttrriinngg ppaatthh,, ssttrriinngg ggrroouupp,, iinntt rreeqq__ttyyppee))
       Add a group to the list that may access a directory in req_type style.
       Returns 0 if req_type is invalid.

       Definition at line 332 of file file_security.c.

       References allow_create, allow_minimal_read, allow_modify,
       allow_normal_read, query_dir_groups(), and save_self().

   iinntt aadddd__ggrroouupp__uuiidd ((ssttrriinngg uuiidd,, ssttrriinngg ggrroouupp))
       Adds a group to a base UID. For example, if I have the base UID of
       'bob' and you call add_group_uid('bob', 'world'), it would allow me
       (bob) to access all things which the 'world' uid has access to. Returns
       true on successful.

       Definition at line 263 of file file_security.c.

       References groups, and save_self().

   vvooiidd ccrreeaattee (())
       Initializes all the mappings to default (fairly useless) settings, and
       loads the object. If there is no file security information to load, you
       will start with the default settings. You should go through your MUD
       then and setup things how you want them.

       Definition at line 96 of file file_security.c.

       References allow_create, allow_minimal_read, allow_modify,
       allow_normal_read, file_owner, groups, and load_self().

   ssttrriinngg ggeett__ssuubbddiirr ((ssttrriinngg ppaatthh))
       Returns the subdirectory of _p_a_t_h. Used internally.

       Definition at line 146 of file file_security.c.

       Referenced by query_dir_groups(), and query_dir_owner().

   vvooiidd llooaadd__sseellff (())
       Loads the file security data from disk.

       Definition at line 86 of file file_security.c.

       Referenced by create().

   ssttrriinngg qquueerryy__aacccceessss ((ssttrriinngg ppaatthh,, ssttrriinngg uuiidd,, iinntt rreeqq__ttyyppee))
       Uses the rules above. Returns a uid if _r_e_q___t_y_p_e access is allowed,
       false if it is not. Note that ban_list is an array of regular
       expressions. This function does not use previous_object for the caller;
       functions like valid_read which actually matter should. The uid which
       is returned is the one by which the user is allowed to access the file;
       this is useful in assigning ownership.

       See file_security.h for information on request types.

       Definition at line 195 of file file_security.c.

       References file_owner, groups, query_dir_groups(), and uid_list.

   mmaappppiinngg qquueerryy__aacccceessss__ttaabbllee ((iinntt rreeqq__ttyyppee))
       RReettuurrnnss::
           One of the file access mappings. It would generally be unkosher to
           modify the mapping returned (that would change file access
           information), but that is a valid way to do it; if you do this,
           however, see ssaavvee__sseellff(()).

       Definition at line 507 of file file_security.c.

       References allow_create, allow_minimal_read, allow_modify, and
       allow_normal_read.

   iinntt qquueerryy__aallllooww__sseett ((oobbjjeecctt ccaalllleerr,, oobbjjeecctt ccaalllleeee))
       RReettuurrnnss::
           True if _c_a_l_l_e_r is allowed to modify variables in _c_a_l_l_e_e, false
           otherwise.

       Definition at line 524 of file file_security.c.

       References groups, and uid_list.

   ssttrriinngg** qquueerryy__ddiirr__ggrroouuppss ((ssttrriinngg ppaatthh,, iinntt rreeqq__ttyyppee))
       Pass in the path of a *directory* which you are curious about, and the
       type of requests that you are interested in, and this function will
       return an array of uid's which have access to that directory. If that
       directory has no uid's which are set for a given request type, then 0
       will be returned. The directory path must end in '/'

       See file_security.h for information on request types.

       Definition at line 167 of file file_security.c.

       References allow_create, allow_minimal_read, allow_modify,
       allow_normal_read, and get_subdir().

       Referenced by add_dir_group(), query_access(), remove_dir_group(), and
       set_dir_owner().

   ssttrriinngg qquueerryy__ddiirr__oowwnneerr ((ssttrriinngg ppaatthh))
       RReettuurrnnss::
           The owner of the directory specified by _p_a_t_h.

       Definition at line 434 of file file_security.c.

       References allow_modify, and get_subdir().

       Referenced by query_file_owner().

   ssttrriinngg qquueerryy__ffiillee__oowwnneerr ((ssttrriinngg ppaatthh))
       RReettuurrnnss::
           The owner of a file. This function will return 0 if there is no
           owner set for the file, but this should be vanishingly rare (it
           indicates an ownerless directory, which although not kosher is
           possible -- if directories are created from an outside shell for
           example, and recursing back finds nothing).

       Definition at line 452 of file file_security.c.

       References file_owner, and query_dir_owner().

       Referenced by set_file_owner().

   ssttrriinngg** qquueerryy__ggrroouupp__uuiidd ((ssttrriinngg uuiidd))
       RReettuurrnnss::
           All groups to which _u_i_d has access, or 0 if no special groups have
           been added. Note that the implied groups _u_i_d and _a_l_l are not
           included in the returned array.

       Definition at line 311 of file file_security.c.

       References groups.

   iinntt rreemmoovvee__ddiirr__ggrroouupp ((ssttrriinngg ppaatthh,, ssttrriinngg ggrroouupp,, iinntt rreeqq__ttyyppee))
       Reverses the effect of add_dir_group.

       RReettuurrnnss::
           1 if successful, 0 if not.

       Definition at line 367 of file file_security.c.

       References allow_create, allow_minimal_read, allow_modify,
       allow_normal_read, query_dir_groups(), and save_self().

   iinntt rreemmoovvee__ggrroouupp__uuiidd ((ssttrriinngg uuiidd,, ssttrriinngg ggrroouupp))
       Inverse of add_group_uid, removes access to a group for a given uid.
       Returns 1 if the uid was removed successfully, 0 on error or if the uid
       didn't have access anyway.

       Definition at line 285 of file file_security.c.

       References groups, and save_self().

   vvooiidd ssaavvee__sseellff (())
       Used to backup the file security data to disk. All modifications of the
       file security information call this immediately, so you don't have
       people 'undoing' changes by calling llooaadd__sseellff(()).

       Definition at line 81 of file file_security.c.

       Referenced by add_dir_group(), add_group_uid(), remove_dir_group(),
       remove_group_uid(), set_dir_owner(), and set_file_owner().

   iinntt sseett__ddiirr__oowwnneerr ((ssttrriinngg ppaatthh,, ssttrriinngg oowwnneerr))
       Sets the owner of a directory. This is basically a special way of
       setting the 'modify' list, since the first entry on the modify list is
       considered the owner.

       _p_a_t_h must end in a '/'

       Definition at line 410 of file file_security.c.

       References allow_modify, query_dir_groups(), and save_self().

   iinntt sseett__ffiillee__oowwnneerr ((ssttrriinngg ffiillee,, ssttrriinngg oowwnneerr))
       Sets the owner of a file. You must pass in the full path to the file.
       This will work even if the file doesn't exist. Later on, however, there
       should be a daemon that cleans up file owner entries for nonexistent
       files, so don't try to use this to hide information or similar.

       Definition at line 486 of file file_security.c.

       References file_owner, query_file_owner(), and save_self().

   iinntt ttoo__rreeqq__ttyyppee ((ssttrriinngg ssttrr))
       Used to convert a string specifying request type into the corresponding
       integer constant. Valid values for _s_t_r are view, read, create, or
       modify.

       Definition at line 321 of file file_security.c.

MMEEMMBBEERR DDAATTAA DDOOCCUUMMEENNTTAATTIIOONN
   mmaappppiinngg aallllooww__ccrreeaattee
       allow_'s are indexed by directory (FULL PATH).

       Definition at line 65 of file file_security.c.

       Referenced by add_dir_group(), create(), query_access_table(),
       query_dir_groups(), and remove_dir_group().

   mmaappppiinngg aallllooww__mmiinniimmaall__rreeaadd
       allow_'s are indexed by directory (FULL PATH).

       Definition at line 65 of file file_security.c.

       Referenced by add_dir_group(), create(), query_access_table(),
       query_dir_groups(), and remove_dir_group().

   mmaappppiinngg aallllooww__mmooddiiffyy
       allow_'s are indexed by directory (FULL PATH).

       Definition at line 65 of file file_security.c.

       Referenced by add_dir_group(), create(), query_access_table(),
       query_dir_groups(), query_dir_owner(), remove_dir_group(), and
       set_dir_owner().

   mmaappppiinngg aallllooww__nnoorrmmaall__rreeaadd
       allow_'s are indexed by directory (FULL PATH).

       Definition at line 65 of file file_security.c.

       Referenced by add_dir_group(), create(), query_access_table(),
       query_dir_groups(), and remove_dir_group().

   mmaappppiinngg ffiillee__oowwnneerr
       file_owner is indexed by file name (FULL PATH).

       Definition at line 65 of file file_security.c.

       Referenced by create(), query_access(), query_file_owner(), and
       set_file_owner().

   mmaappppiinngg ggrroouuppss
       groups is indexed by uid

       Definition at line 65 of file file_security.c.

       Referenced by add_group_uid(), create(), query_access(),
       query_allow_set(), query_group_uid(), and remove_group_uid().

   ssttrriinngg** uuiidd__lliisstt [[ssttaattiicc]]
       A list of UID's used as a temporary variable in some functions.

       Definition at line 75 of file file_security.c.

       Referenced by query_access(), and query_allow_set().


AAUUTTHHOORR
       Generated automatically by Doxygen for Walraven from the source code.



Walraven                          8 Jan 2004                  File_security(3)
