From patchwork Wed Aug 29 17:24:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Burri X-Patchwork-Id: 10580709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AAB5180E for ; Wed, 29 Aug 2018 17:31:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0188C2B918 for ; Wed, 29 Aug 2018 17:31:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F287F2B85F; Wed, 29 Aug 2018 17:31:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CC6E2B8AC for ; Wed, 29 Aug 2018 17:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbeH2V3k (ORCPT ); Wed, 29 Aug 2018 17:29:40 -0400 Received: from tty0.vserver.softronics.ch ([91.214.169.36]:53530 "EHLO fe1.digint.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727477AbeH2V3j (ORCPT ); Wed, 29 Aug 2018 17:29:39 -0400 Received: by fe1.digint.ch (Postfix, from userid 1000) id A16A9307E9; Wed, 29 Aug 2018 19:23:13 +0200 (CEST) Received: from mail.tty0.ch (hermes.tty0.ch [172.21.1.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by fe1.digint.ch (Postfix) with ESMTPS id 53415307DF for ; Wed, 29 Aug 2018 19:23:13 +0200 (CEST) Received: from ares.tty0.ch (ares.tty0.ch [10.0.1.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.tty0.ch (Postfix) with ESMTPS id 3DEA51DA0F2; Wed, 29 Aug 2018 19:22:42 +0200 (CEST) Received: by ares.tty0.ch (sSMTP sendmail emulation); Wed, 29 Aug 2018 19:24:47 +0200 From: Axel Burri To: linux-btrfs@vger.kernel.org Cc: Axel Burri Subject: [RFC PATCH 4/6] btrfs-progs: Makefile: include Makefile.install_setcap generated by splitcmd-gen.sh Date: Wed, 29 Aug 2018 19:24:07 +0200 Message-Id: <20180829172409.18064-5-axel@tty0.ch> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180829172409.18064-1-axel@tty0.ch> References: <20180829172409.18064-1-axel@tty0.ch> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Axel Burri --- Makefile | 11 ++--------- Makefile.install_setcap | 10 ++++++++++ splitcmd-gen.sh | 5 +++++ 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 Makefile.install_setcap diff --git a/Makefile b/Makefile index 5a1e2747..acf5a677 100644 --- a/Makefile +++ b/Makefile @@ -246,15 +246,8 @@ progs_install_splitcmd = $(progs_splitcmd) INSTALL_SETCAP_FLAGS = -m710 -gbtrfs -# linux capabilities(7) needed; used by "install-splitcmd-setcap-%" below -btrfs_subvolume_show_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" -btrfs_subvolume_list_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" -btrfs_subvolume_snapshot_fcaps = "cap_sys_admin,cap_fowner,cap_dac_override,cap_dac_read_search" -btrfs_subvolume_delete_fcaps = "cap_sys_admin,cap_dac_override" -btrfs_send_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" -btrfs_receive_fcaps = "cap_sys_admin,cap_fowner,cap_chown,cap_mknod,cap_setfcap,cap_dac_override,cap_dac_read_search" -btrfs_filesystem_usage_fcaps = "cap_sys_admin" -btrfs_qgroup_destroy_fcaps = "cap_sys_admin,cap_dac_override" +# defines btrfs_*_caps; used by "install-splitcmd-setcap-%" below +include Makefile.install_setcap # external libs required by various binaries; for btrfs-foo, # specify btrfs_foo_libs = ; see $($(subst...)) rules below diff --git a/Makefile.install_setcap b/Makefile.install_setcap new file mode 100644 index 00000000..7705db74 --- /dev/null +++ b/Makefile.install_setcap @@ -0,0 +1,10 @@ +# capabilities(7) for splitcmd executables + +btrfs_subvolume_show_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" +btrfs_subvolume_list_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" +btrfs_subvolume_snapshot_fcaps = "cap_sys_admin,cap_fowner,cap_dac_override,cap_dac_read_search" +btrfs_subvolume_delete_fcaps = "cap_sys_admin,cap_dac_override" +btrfs_send_fcaps = "cap_sys_admin,cap_fowner,cap_dac_read_search" +btrfs_receive_fcaps = "cap_sys_admin,cap_fowner,cap_chown,cap_mknod,cap_setfcap,cap_dac_override,cap_dac_read_search" +btrfs_filesystem_usage_fcaps = "cap_sys_admin" +btrfs_qgroup_destroy_fcaps = "cap_sys_admin,cap_dac_override" diff --git a/splitcmd-gen.sh b/splitcmd-gen.sh index 4d2e0509..d34c5cbd 100755 --- a/splitcmd-gen.sh +++ b/splitcmd-gen.sh @@ -35,8 +35,13 @@ function gen_splitcmd { sed -e "s|@BTRFS_SPLITCMD_CFILE_INCLUDE@|${cfile}|g" \ -e "s|@BTRFS_SPLITCMD_ENTRY@|${entry}|g" \ splitcmd.c.in >> $dest + + echo "${name//-/_}_fcaps = \"${caps}\"" >> $makefile_out } +echo "generating: ${makefile_out}" +echo -e "# capabilities(7) for splitcmd executables\n" > $makefile_out + gen_splitcmd "btrfs-subvolume-show" \ "cmds-subvolume.c" "cmd_subvol_show" \ "cap_sys_admin,cap_fowner,cap_dac_read_search"