aboutsummaryrefslogtreecommitdiff
path: root/src/acl.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-10-15 16:21:32 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-10-15 16:21:32 +0300
commitb713e2208519e7cba1c779cbd9387137eb101e5e (patch)
treec1245c09d9cffa5d74ec8961ed0ffd820f0bd23e /src/acl.c
parent9dbe6b40d07df41255f0c8fda6895000b7c7e1a6 (diff)
downloadpies-b713e2208519e7cba1c779cbd9387137eb101e5e.tar.gz
pies-b713e2208519e7cba1c779cbd9387137eb101e5e.tar.bz2
Various fixes.
* README: Fix typo. * doc/usr-acl.texi: New file. * doc/Makefile.am (pies_TEXINFOS): Remove pies.texi, add usr-acl.texi (check-config, check-sub-config): Handle @deffnx * doc/pies.texi: Update. * src/Makefile.am (AM_CPPFLAGS): Remove superfluous defs, use ../gnu/configmake.h instead * src/acl.c (_acl_common_section_parser): Handle tag, depending on the value of `flag' parameter. Avoid coredumping on NULL pacl. (acl_section_parser, defacl_section_parser): Update calls to _acl_common_section_parser. * src/pies.c (STATEDIR): Replace with LOCALSTATEDIR. (GRECS_VALUE_IS_EMPTY): New define (possibly belongs to grecs more than to pies). (assert_grecs_value_type) (return_code_section_parser): Use GRECS_VALUE_IS_EMPTY to check for empty value. (_get_array_arg): Bugfix. (component_keywords, pies_keywords): Add missing docstrings. * src/progman.c (TYPE_RETR): Rename to TYPE_REDIRECTOR. All uses updated.
Diffstat (limited to 'src/acl.c')
-rw-r--r--src/acl.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/acl.c b/src/acl.c
index ad3ea1d..c78dc61 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -360,16 +360,22 @@ parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl,
return 0;
}
+#define ACL_TAG_NONE 0
+#define ACL_TAG_IGNORE 1
+#define ACL_TAG_OPTIONAL 2
+#define ACL_TAG_REQUIRED 3
+
int
_acl_common_section_parser (enum grecs_callback_command cmd,
grecs_locus_t *locus,
grecs_value_t *value,
pies_acl_t *pacl,
- int need_tag)
+ int flag)
{
pies_acl_t acl;
grecs_locus_t defn_loc;
const char *tag = NULL;
+ int has_value = 0;
switch (cmd)
{
@@ -381,9 +387,26 @@ _acl_common_section_parser (enum grecs_callback_command cmd,
grecs_error (locus, 0, _("ACL name must be a string"));
return 1;
}
- tag = value->v.string;
+ has_value = value->v.string != NULL;
+ }
+ if (has_value)
+ {
+ switch (flag)
+ {
+ case ACL_TAG_NONE:
+ grecs_error (locus, 0, _("ACL name is not expected"));
+ return 1;
+
+ case ACL_TAG_IGNORE:
+ grecs_warning (locus, 0, _("ACL name is ignored"));
+ break;
+
+ case ACL_TAG_OPTIONAL:
+ case ACL_TAG_REQUIRED:
+ tag = value->v.string;
+ }
}
- else if (need_tag)
+ else if (flag == ACL_TAG_REQUIRED)
{
grecs_error (locus, 0, _("missing ACL name"));
return 1;
@@ -398,7 +421,8 @@ _acl_common_section_parser (enum grecs_callback_command cmd,
_("location of the previous definition"));
return 1;
}
- *pacl = acl;
+ if (pacl)
+ *pacl = acl;
break;
case grecs_callback_section_end:
@@ -415,9 +439,11 @@ acl_section_parser (enum grecs_callback_command cmd,
grecs_value_t *value,
void *cb_data)
{
- if (_acl_common_section_parser (cmd, locus, value, varptr, 1) == 0)
+ int rc = _acl_common_section_parser (cmd, locus, value, varptr,
+ ACL_TAG_NONE);
+ if (rc == 0)
*(void**)cb_data = *(pies_acl_t*)varptr;
- return 0;
+ return rc;
}
int
@@ -427,8 +453,8 @@ defacl_section_parser (enum grecs_callback_command cmd,
grecs_value_t *value,
void *cb_data)
{
- _acl_common_section_parser (cmd, locus, value, cb_data, 0);
- return 0;
+ return _acl_common_section_parser (cmd, locus, value, cb_data,
+ ACL_TAG_REQUIRED);
}
static int

Return to:

Send suggestions and report system problems to the System administrator.