From 451e1f48798b3e018cf370c00373bbad25db5ee4 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 3 Sep 2014 09:32:53 +0000 Subject: * setfacl.c (getaclentry): Fix previous fix again. Allow lone 'm' as well as any lone default entry if action is Delete. Fix comments. (usage): Align usage text. --- winsup/utils/setfacl.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'winsup/utils/setfacl.c') diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c index a3b2226c3..867838d73 100644 --- a/winsup/utils/setfacl.c +++ b/winsup/utils/setfacl.c @@ -109,15 +109,21 @@ getaclentry (action_t action, char *c, aclent_t *ace) /* Skip to next field. */ c = c2; if (!*c) - return action == Delete && (ace->a_type & CLASS_OBJ); - /* If this is a user or group entry, check if next char is a colon char. - If so, skip it, otherwise it's the name of a user or group. */ - if (!(ace->a_type & (USER_OBJ | GROUP_OBJ))) + { + /* Nothing follows. This is only valid if action is Delete and the + type is CLASS_OBJ, or if ACL_DEFAULT is set. */ + if (action != Delete + || (!(ace->a_type & (CLASS_OBJ | ACL_DEFAULT)))) + return FALSE; + } + else if (!(ace->a_type & (USER_OBJ | GROUP_OBJ))) { /* Mask and other entries may contain an extra colon. */ if (*c == ':') ++c; } + /* If this is a user or group entry, check if next char is a colon char. + If so, skip it, otherwise it's the name of a user or group. */ else if (*c == ':') ++c; else if (*c) @@ -344,12 +350,13 @@ usage (FILE * stream) " Acl_entries to be deleted should be specified without\n" " permissions, as in the following list:\n" "\n" - " u[ser]:uid\n" - " g[roup]:gid\n" - " d[efault]:u[ser]:uid\n" - " d[efault]:g[roup]:gid\n" - " d[efault]:m[ask]:\n" - " d[efault]:o[ther]:\n" + " u[ser]:uid[:]\n" + " g[roup]:gid[:]\n" + " m[ask][:]\n" + " d[efault]:u[ser][:uid]\n" + " d[efault]:g[roup][:gid]\n" + " d[efault]:m[ask][:]\n" + " d[efault]:o[ther][:]\n" "\n" "-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n" " characters are ignored, and the character \"#\" may be used\n" -- cgit v1.2.3