access-control: Introduce new translator

The access control translator is required for performing permission
checks on files and directories in line with posix conformance.
This is required to be kept separate from storage/posix so that
ACL support can also be later integrated into this translator.

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 400 (Support auxiliary gids in GlusterFS)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=400
This commit is contained in:
Shehjar Tikoo 2010-03-31 07:27:00 +00:00 committed by Anand V. Avati
parent 26f826c75c
commit fce2ae459b
6 changed files with 1918 additions and 1 deletions

View File

@ -105,6 +105,8 @@ AC_CONFIG_FILES([Makefile
extras/volgen/glusterfs-volgen
contrib/Makefile
contrib/fuse-util/Makefile
xlators/features/access-control/Makefile
xlators/features/access-control/src/Makefile
glusterfs.spec])
AC_CANONICAL_HOST

View File

@ -1,3 +1,3 @@
SUBDIRS = locks trash quota read-only #path-converter # filter
SUBDIRS = locks trash quota read-only access-control #path-converter # filter
CLEANFILES =

View File

@ -0,0 +1,3 @@
SUBDIRS = src
CLEANFILES =

View File

@ -0,0 +1,13 @@
xlator_LTLIBRARIES = access-control.la
xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features
access_control_la_LDFLAGS = -module -avoidversion
access_control_la_SOURCES = access-control.c
access_control_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
noinst_HEADERS = access-control.h
AM_CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Wall -D$(GF_HOST_OS)\
-I$(top_srcdir)/libglusterfs/src -shared -nostartfiles $(GF_CFLAGS)\
-L$(xlatordir)/
CLEANFILES =

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
/*
Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com>
This file is part of GlusterFS.
GlusterFS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
GlusterFS is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
<http://www.gnu.org/licenses/>.
*/
#ifndef __ACCESS_CONTROL_H_
#define __ACCESS_CONTROL_H_
#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif
#define ACTRL "access-control"
#define ACCTEST_READ 0x1
#define ACCTEST_WRITE 0x2
#define ACCTEST_EXEC 0x4
#define ACCTEST_DONTCARE 0x8
/* Note if the caller is only interested in ownership test i.e. one of the below
+ * in combination with GF_ACCTEST_DONTCARE, then only one type of user's owner
+ * ship can be tested with one call to gf_test_access, i.e. we can only
+ * check of either owner and group, if both need to be tested for a specific
+ * (uid, gid) pair then two calls will be needed.
+ */
#define ACCTEST_OWNER 0x1
#define ACCTEST_GROUP 0x2
#define ACCTEST_OTHER 0x4
/* Signifies any user, as long as we get access. */
#define ACCTEST_ANY (ACCTEST_OWNER | ACCTEST_GROUP | ACCTEST_OTHER)
#define ac_test_owner(acc) ((acc) & ACCTEST_OWNER)
#define ac_test_group(acc) ((acc) & ACCTEST_GROUP)
#define ac_test_other(acc) ((acc) & ACCTEST_OTHER)
#define ac_test_dontcare(acc) ((acc) & ACCTEST_DONTCARE)
#define ac_test_read(acc) ((acc) & ACCTEST_READ)
#define ac_test_write(acc) ((acc) & ACCTEST_WRITE)
#define ac_test_exec(acc) ((acc) & ACCTEST_EXEC)
#endif