[Cvs-nserver-commits] CVS: cvs-nserver/acl dir-acl.c,1.1.2.18,1.1.2.19 dir-acl.h,1.1.2.9,1.1.2.10
Brought to you by:
tyranny
From: Alexey M. <ty...@us...> - 2002-06-08 23:30:07
|
Update of /cvsroot/cvs-nserver/cvs-nserver/acl In directory usw-pr-cvs1:/tmp/cvs-serv27049 Modified Files: Tag: NCLI-1-11-1 dir-acl.c dir-acl.h Log Message: Initial doxygen documentation Index: dir-acl.c =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/acl/Attic/dir-acl.c,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -u -d -r1.1.2.18 -r1.1.2.19 --- dir-acl.c 7 Jun 2002 13:18:36 -0000 1.1.2.18 +++ dir-acl.c 8 Jun 2002 23:30:00 -0000 1.1.2.19 @@ -15,9 +15,44 @@ */ + +/*! \file dir-acl.c + + \brief Directory-level ACL implementation. + + Directory-level permissions are kept in the DIRACL file in each + subdirectory where at list one ACE (access control list entry) + exists. + + DIRACL file is a plain text file. Each line starts with a single + letter, indicating type of this line. There are currently two types + of lines: + + - "/" line contains directory-level access control entry; + + - "D" line contains default file access control entry; + + The initial letter is followed by several tab-separated fields. + + Directory-level ACE lines contain the following fields: + + - name of the branch (or "<trunk>"); + + - name of the user to whom this ACE is applied; + + - directory permission string; + + + Directory permission strings contain either single word "none", + meaning no permission, or a sequence of one or more comma-separated + words "access" or "modify" with obvious meaning (see the + Administrator's Guide for more details). + +*/ + #define _BSD_SOURCE 1 -#include "config.h" +#include <config.h> #include "dir-acl.h" #include "branch-acl.h" @@ -52,18 +87,30 @@ #include <io.h> #endif -static char *toplevel_directory = "./"; +static char *current_toplevel_directory = "./"; + +/*! \fn void set_toplevel_directory (char* toplevel_directory); + \brief Sets the toplevel directory (most often this is a path to repository) + \param toplevel_directory Path to toplevel directory. + + ACLs are handled only for directories within this toplevel + directory. The get_dir_acl() function will return NULL if asked + about directory which is not within toplevel directory. + + Initial value is "./". + + */ void -set_toplevel_directory (char *new_tl_dir) +set_toplevel_directory (char *toplevel_directory) { - if (new_tl_dir == NULL) + if (toplevel_directory == NULL) return; - if (new_tl_dir[strlen(new_tl_dir) - 1] != '/') + if (toplevel_directory[strlen(toplevel_directory) - 1] != '/') return; - toplevel_directory = new_tl_dir; + current_toplevel_directory = toplevel_directory; } @@ -133,11 +180,11 @@ static DIR_ACL * internal_get_dir_acl (char *dir, char *branch, struct DIR_ACL *the_dir_acl) { - int toplevel_len = strlen(toplevel_directory); + int toplevel_len = strlen(current_toplevel_directory); char *last_component; /* check that requested directory derives from top-level directory */ - if (strncmp(dir, toplevel_directory, toplevel_len) != 0) + if (strncmp(dir, current_toplevel_directory, toplevel_len) != 0) return NULL; if (the_dir_acl == NULL) Index: dir-acl.h =================================================================== RCS file: /cvsroot/cvs-nserver/cvs-nserver/acl/Attic/dir-acl.h,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -d -r1.1.2.9 -r1.1.2.10 --- dir-acl.h 7 Jun 2002 13:18:36 -0000 1.1.2.9 +++ dir-acl.h 8 Jun 2002 23:30:01 -0000 1.1.2.10 @@ -18,9 +18,16 @@ #ifndef DIR_ACL_H #define DIR_ACL_H 1 +/*! \file dir-acl.h + \brief Directory-level ACL interface + +*/ + #include "stringbuf.h" -struct BRANCH_ACL; +/*! \struct DEFAULT_FILE_ACL + \brief Default file access control list for a branch +*/ struct DEFAULT_FILE_ACL { char *branch; @@ -28,14 +35,65 @@ struct DEFAULT_FILE_ACL *next; }; +/*! \struct DIR_ACL + \brief Access control list for a particular directory. + + */ + +struct BRANCH_ACL; + struct DIR_ACL { + /*! \var dirname + + \brief Full path to a directory + */ stringbuf *dirname; + + /*! \var user_acls + + \brief List of access control entries + + \todo FIXME: Currently directory-level permissions do not take + branches into account. + + */ struct USER_ACL *user_acls; + + /*! \var default_file_acl + + \brief Default file access control list + */ struct DEFAULT_FILE_ACL *default_file_acl; + + /*! \var top_dirs + + \brief List of DIR_ACL for all the parent directories of this + directory, up to toplevel directory. + */ + struct DIR_ACL **top_dirs; - struct BRANCH_ACL *branch_acls; + /*! \var top_dirs_count + + \brief Number of elements in top_dirs + */ int top_dirs_count; + + /*! \var top_dirs_allocated + + \brief Number of elements allocated for top_dirs + */ int top_dirs_allocated; + + /*! \var branch_acls + + \brief File-level access control list. + */ + struct BRANCH_ACL *branch_acls; + + /*! \var branch_acls_loaded + + \brief True if file-level ACL is loaded. + */ int branch_acls_loaded; }; |