From patchwork Wed Feb 24 03:54:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 8398531 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BFEF59F2F0 for ; Wed, 24 Feb 2016 03:54:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23D382034E for ; Wed, 24 Feb 2016 03:54:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 587712035B for ; Wed, 24 Feb 2016 03:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755730AbcBXDy1 (ORCPT ); Tue, 23 Feb 2016 22:54:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:51477 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756160AbcBXDy0 (ORCPT ); Tue, 23 Feb 2016 22:54:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B1066AD98; Wed, 24 Feb 2016 03:54:24 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" Date: Wed, 24 Feb 2016 14:54:18 +1100 Cc: linux-nfs@vger.kernel.org Subject: [PATCH - nfsv4-acl-tools] nfs4_ace_from_string: ignore inheritance ACEs on non-directories. User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-suse-linux-gnu) Message-ID: <8760xen4ph.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If you try to use nfs4_setfacl -R -a A:d:........ directory to recursively set an inheritance ACE on all directories in a tree, it will fail on the first non-directory as setting an inheritance ACE there is not permitted (and as it aborts on the first sign of an error). So use the is_dir flag to avoid doing that, just as is done with the DELETE_CHILD permission. Signed-off-by: NeilBrown --- Hi Bruce, are you still maintaining nfsv4-acl-tools? Last commit was over a year ago!! I guess that means it is nearly perfect :-) A customer came across this problem and it seems simple to fix, but if I'm missing something important, please let me know. NeilBrown libnfs4acl/nfs4_ace_from_string.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libnfs4acl/nfs4_ace_from_string.c b/libnfs4acl/nfs4_ace_from_string.c index 510ffee35d32..a7a30360d860 100644 --- a/libnfs4acl/nfs4_ace_from_string.c +++ b/libnfs4acl/nfs4_ace_from_string.c @@ -185,16 +185,20 @@ struct nfs4_ace * nfs4_ace_from_string(char *ace_buf, int is_dir) for (buflen = strlen(field); buflen > 0; buflen--) { switch (*field) { case FLAG_FILE_INHERIT: - flags |= NFS4_ACE_FILE_INHERIT_ACE; + if (is_dir) + flags |= NFS4_ACE_FILE_INHERIT_ACE; break; case FLAG_DIR_INHERIT: - flags |= NFS4_ACE_DIRECTORY_INHERIT_ACE; + if (is_dir) + flags |= NFS4_ACE_DIRECTORY_INHERIT_ACE; break; case FLAG_NO_PROPAGATE_INHERIT: - flags |= NFS4_ACE_NO_PROPAGATE_INHERIT_ACE; + if (is_dir) + flags |= NFS4_ACE_NO_PROPAGATE_INHERIT_ACE; break; case FLAG_INHERIT_ONLY: - flags |= NFS4_ACE_INHERIT_ONLY_ACE; + if (is_dir) + flags |= NFS4_ACE_INHERIT_ONLY_ACE; break; case FLAG_SUCCESSFUL_ACCESS: flags |= NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG;