1
/* Copyright (c) 2002, 2003, 2006 The Regents of the University of Michigan.
4
* Andy Adamson <andros@citi.umich.edu>
5
* David M. Richter <richterd@citi.umich.edu>
6
* Alexis Mackenzie <allamack@citi.umich.edu>
7
* Alex Soule <soule@umich.edu>
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
13
* 1. Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* 2. Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer in the
17
* documentation and/or other materials provided with the distribution.
18
* 3. Neither the name of the University nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
22
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
23
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
#include <sys/types.h>
41
#include "libacl_nfs4.h"
43
static void usage(int);
44
static void more_help();
45
static char *execname;
47
int main(int argc, char **argv)
52
execname = basename(argv[0]);
55
fprintf(stderr, "%s: you must specify a path.\n", execname);
58
} else if (argc > 2) {
59
fprintf(stderr, "%s: currently, you may only specify a single path.\n", execname);
62
} else if (!strcmp(argv[1], "-?") || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
66
} else if (!strcmp(argv[1], "-H") || !strcmp(argv[1], "--more-help")) {
71
acl = nfs4_acl_for_path(argv[1]);
73
nfs4_print_acl(stdout, acl);
80
static void usage(int label)
83
fprintf(stderr, "%s %s -- get NFSv4 file or directory access control lists.\n", execname, VERSION);
84
fprintf(stderr, "Usage: %s file\n -H, --more-help\tdisplay ACL format information\n -?, -h, --help\tdisplay this help text\n", execname);
87
static void more_help()
90
"%s %s -- get NFSv4 file or directory access control lists.\n\n"
91
"An NFSv4 ACL consists of one or more NFSv4 ACEs, each delimited by commas or whitespace.\n"
92
"An NFSv4 ACE is written as a colon-delimited, 4-field string in the following format:\n"
94
" <type>:<flags>:<principal>:<permissions>\n"
96
" * <type> - one of:\n"
102
" * <flags> - zero or more (depending on <type>) of:\n"
103
" 'f' file-inherit\n"
104
" 'd' directory-inherit\n"
105
" 'p' no-propagate-inherit\n"
106
" 'i' inherit-only\n"
107
" 'S' successful-access\n"
108
" 'F' failed-access\n"
109
" 'g' group (denotes that <principal> is a group)\n"
111
" * <principal> - named user or group, or one of: \"OWNER@\", \"GROUP@\", \"EVERYONE@\"\n"
113
" * <permissions> - one or more of:\n"
114
" 'r' read-data / list-directory \n"
115
" 'w' write-data / create-file \n"
116
" 'a' append-data / create-subdirectory \n"
119
" 'D' delete-child (directories only)\n"
122
" 'n' read-named-attrs\n"
123
" 'N' write-named-attrs\n"
129
"For more information and examples, please refer to the nfs4_acl(5) manpage.\n";
131
printf(info, execname, VERSION);