From patchwork Tue Feb 23 19:02:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gix X-Patchwork-Id: 12100757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 964EDC433E0 for ; Tue, 23 Feb 2021 19:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 602DD64E7A for ; Tue, 23 Feb 2021 19:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233405AbhBWTEU (ORCPT ); Tue, 23 Feb 2021 14:04:20 -0500 Received: from mga05.intel.com ([192.55.52.43]:38104 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbhBWTEP (ORCPT ); Tue, 23 Feb 2021 14:04:15 -0500 IronPort-SDR: n1qRWhm8n4Evx4i+OjVxM0Kg2AJJoYr45Ud1xlJJPMcRTE+zKEZipRZIwbS9A47/t/i7myhtND AHdHPPab9L2w== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="269870524" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="269870524" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:34 -0800 IronPort-SDR: 9TBVLOY/jce5zWereWFkUvr8kB6273dORoVzzN44j7NeUkV2FLmkvHp1tzzUYvHxuaOPlC/KmE YWiiBI/7PGXw== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432831000" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.105.235]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:34 -0800 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, inga.stotland@intel.com, luiz.dentz@gmail.com, tedd.an@linux.intel.com, marcel@holtmann.org Subject: [PATCH BlueZ 1/6] mesh: Cleanup deprecated symbolic file permissions Date: Tue, 23 Feb 2021 11:02:47 -0800 Message-Id: <20210223190252.483784-2-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210223190252.483784-1-brian.gix@intel.com> References: <20210223190252.483784-1-brian.gix@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- mesh/rpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesh/rpl.c b/mesh/rpl.c index 7cea8e346..ac0f6b6f2 100644 --- a/mesh/rpl.c +++ b/mesh/rpl.c @@ -62,7 +62,7 @@ bool rpl_put_entry(struct mesh_node *node, uint16_t src, uint32_t iv_index, snprintf(src_file, PATH_MAX, "%s%s/%8.8x/%4.4x", node_path, rpl_dir, iv_index, src); - fd = open(src_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + fd = open(src_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd >= 0) { snprintf(seq_txt, 7, "%6.6x", seq); if (write(fd, seq_txt, 6) == 6) From patchwork Tue Feb 23 19:02:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gix X-Patchwork-Id: 12100759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3535C433DB for ; Tue, 23 Feb 2021 19:04:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79B8764E7A for ; Tue, 23 Feb 2021 19:04:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233440AbhBWTEW (ORCPT ); Tue, 23 Feb 2021 14:04:22 -0500 Received: from mga06.intel.com ([134.134.136.31]:19052 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbhBWTEV (ORCPT ); Tue, 23 Feb 2021 14:04:21 -0500 IronPort-SDR: 5dyNPeNeiDh+ny1OOEaogwMh1JsUMsk95ajEr4vNcze94TQBB7wDhdc+F6N7fu1XLqekIacnyc 3+t2jkYgBBpQ== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="246335916" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="246335916" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:40 -0800 IronPort-SDR: DuhUuLPg/N8fX5crkXtfXR9VnMQNjuPLLJ72gIKb50Foine9f+XJRcRayh/e4mFwN8Eh3jtRHJ MVB3gJAbqIYw== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432831041" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.105.235]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:39 -0800 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, inga.stotland@intel.com, luiz.dentz@gmail.com, tedd.an@linux.intel.com, marcel@holtmann.org Subject: [PATCH BlueZ 2/6] obexd: Cleanup deprecated symbolic file permissions Date: Tue, 23 Feb 2021 11:02:48 -0800 Message-Id: <20210223190252.483784-3-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210223190252.483784-1-brian.gix@intel.com> References: <20210223190252.483784-1-brian.gix@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- obexd/plugins/filesystem.c | 18 +++++++++--------- obexd/plugins/ftp.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/obexd/plugins/filesystem.c b/obexd/plugins/filesystem.c index 8e53c181c..09bff8ad0 100644 --- a/obexd/plugins/filesystem.c +++ b/obexd/plugins/filesystem.c @@ -116,15 +116,15 @@ static char *file_stat_line(char *filename, struct stat *fstat, snprintf(perm, 50, "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" " "other-perm=\"%s%s%s\"", - (fstat->st_mode & S_IRUSR ? "R" : ""), - (fstat->st_mode & S_IWUSR ? "W" : ""), - (dstat->st_mode & S_IWUSR ? "D" : ""), - (fstat->st_mode & S_IRGRP ? "R" : ""), - (fstat->st_mode & S_IWGRP ? "W" : ""), - (dstat->st_mode & S_IWGRP ? "D" : ""), - (fstat->st_mode & S_IROTH ? "R" : ""), - (fstat->st_mode & S_IWOTH ? "W" : ""), - (dstat->st_mode & S_IWOTH ? "D" : "")); + (fstat->st_mode & 0400 ? "R" : ""), + (fstat->st_mode & 0200 ? "W" : ""), + (dstat->st_mode & 0200 ? "D" : ""), + (fstat->st_mode & 0040 ? "R" : ""), + (fstat->st_mode & 0020 ? "W" : ""), + (dstat->st_mode & 0020 ? "D" : ""), + (fstat->st_mode & 0004 ? "R" : ""), + (fstat->st_mode & 0002 ? "W" : ""), + (dstat->st_mode & 0002 ? "D" : "")); strftime(atime, 17, "%Y%m%dT%H%M%SZ", gmtime(&fstat->st_atime)); strftime(ctime, 17, "%Y%m%dT%H%M%SZ", gmtime(&fstat->st_ctime)); diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c index f60cf143d..259bfcae2 100644 --- a/obexd/plugins/ftp.c +++ b/obexd/plugins/ftp.c @@ -284,8 +284,8 @@ int ftp_setpath(struct obex_session *os, void *user_data) goto done; } - if (S_ISDIR(dstat.st_mode) && (dstat.st_mode & S_IRUSR) && - (dstat.st_mode & S_IXUSR)) { + if (S_ISDIR(dstat.st_mode) && (dstat.st_mode & 0400) && + (dstat.st_mode & 0100)) { set_folder(ftp, fullname); goto done; } From patchwork Tue Feb 23 19:02:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gix X-Patchwork-Id: 12100761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 079B9C433DB for ; Tue, 23 Feb 2021 19:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C108A64E7A for ; Tue, 23 Feb 2021 19:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233952AbhBWTE2 (ORCPT ); Tue, 23 Feb 2021 14:04:28 -0500 Received: from mga06.intel.com ([134.134.136.31]:19070 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233902AbhBWTE1 (ORCPT ); Tue, 23 Feb 2021 14:04:27 -0500 IronPort-SDR: G+zXqgL58ymRB77nmpEz44wxVmgWK/cV9FLOR7/xM7q8nPzIst8OPb+01yQLm5N3rmqinxjY+5 xSAvS7SKDrhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="246335927" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="246335927" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:45 -0800 IronPort-SDR: rFkaxglkSnE0P0GxuM5tb0bmuH4sbeKWiKcsLIP2J1bgNUoVZcQSrXLE7mcdgSiu9VudTaWd7U wrFFhn/GaKgg== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432831075" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.105.235]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:45 -0800 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, inga.stotland@intel.com, luiz.dentz@gmail.com, tedd.an@linux.intel.com, marcel@holtmann.org Subject: [PATCH BlueZ 3/6] peripheral: Cleanup deprecated symbolic file permissions Date: Tue, 23 Feb 2021 11:02:49 -0800 Message-Id: <20210223190252.483784-4-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210223190252.483784-1-brian.gix@intel.com> References: <20210223190252.483784-1-brian.gix@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- peripheral/efivars.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/peripheral/efivars.c b/peripheral/efivars.c index 74fceed3e..987572b63 100644 --- a/peripheral/efivars.c +++ b/peripheral/efivars.c @@ -98,8 +98,7 @@ int efivars_write(const char *name, uint32_t attributes, if (!buf) return -ENOMEM; - fd = open(pathname, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + fd = open(pathname, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0644); if (fd < 0) { free(buf); return -EIO; From patchwork Tue Feb 23 19:02:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gix X-Patchwork-Id: 12100763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FDFEC433E9 for ; Tue, 23 Feb 2021 19:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D0E464E20 for ; Tue, 23 Feb 2021 19:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233991AbhBWTEb (ORCPT ); Tue, 23 Feb 2021 14:04:31 -0500 Received: from mga06.intel.com ([134.134.136.31]:19082 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233977AbhBWTEb (ORCPT ); Tue, 23 Feb 2021 14:04:31 -0500 IronPort-SDR: TdD3oVKoc1g0uIwbJyNWuy62/o8xkiLvIhdkKwWjFv1N+kjTSHmLUyeHV8lAbOFqMkKeZq9fAx tkoNALXfwMnA== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="246335974" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="246335974" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:50 -0800 IronPort-SDR: DFR50DBe2MElo4SgXYGzXDQSItEOa9D3rFFLUdLLWWMGts7jQ+a3gCz/kqAkGm4fwOPungxQFR K/rIZLRpZrTQ== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432831096" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.105.235]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:50 -0800 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, inga.stotland@intel.com, luiz.dentz@gmail.com, tedd.an@linux.intel.com, marcel@holtmann.org Subject: [PATCH BlueZ 4/6] profiles: Cleanup deprecated symbolic file permissions Date: Tue, 23 Feb 2021 11:02:50 -0800 Message-Id: <20210223190252.483784-5-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210223190252.483784-1-brian.gix@intel.com> References: <20210223190252.483784-1-brian.gix@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- profiles/input/suspend-dummy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c index c6527ee88..ea1835e0f 100644 --- a/profiles/input/suspend-dummy.c +++ b/profiles/input/suspend-dummy.c @@ -121,7 +121,7 @@ int suspend_init(suspend_event suspend, resume_event resume) } } - if (mkfifo(HOG_SUSPEND_FIFO, S_IRUSR | S_IWUSR) < 0) { + if (mkfifo(HOG_SUSPEND_FIFO, 0600) < 0) { int err = -errno; error("Can't create FIFO (%s): %s (%d)", HOG_SUSPEND_FIFO, From patchwork Tue Feb 23 19:02:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gix X-Patchwork-Id: 12100765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25599C43381 for ; Tue, 23 Feb 2021 19:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7C7A64E6B for ; Tue, 23 Feb 2021 19:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233995AbhBWTEk (ORCPT ); Tue, 23 Feb 2021 14:04:40 -0500 Received: from mga06.intel.com ([134.134.136.31]:19052 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbhBWTEh (ORCPT ); Tue, 23 Feb 2021 14:04:37 -0500 IronPort-SDR: pxY8K5+07TkbF8P9ltGphQQOQZ7ul7Z7mo16WRq4OR4WIC3xHaoWx03agzF/SGxNxxieGgffN/ 6q403KxBmMqw== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="246335981" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="246335981" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:55 -0800 IronPort-SDR: gf518TuFCDqL34HUvj9GIuMT5wcvE6HXZwHvuUADbaLNK/dFhWmeVSLVHWoUdPP/o8FctDawLD xTEvxTYEOjfg== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432831112" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.105.235]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:54 -0800 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, inga.stotland@intel.com, luiz.dentz@gmail.com, tedd.an@linux.intel.com, marcel@holtmann.org Subject: [PATCH BlueZ 5/6] src: Cleanup deprecated symbolic file permissions Date: Tue, 23 Feb 2021 11:02:51 -0800 Message-Id: <20210223190252.483784-6-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210223190252.483784-1-brian.gix@intel.com> References: <20210223190252.483784-1-brian.gix@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- src/adapter.c | 32 ++++++++++++++++---------------- src/attrib-server.c | 2 +- src/device.c | 16 ++++++++-------- src/sdpd-server.c | 2 +- src/shared/btsnoop.c | 4 ++-- src/textfile.c | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index 0b6321dd5..051c32753 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -502,7 +502,7 @@ static void store_adapter_info(struct btd_adapter *adapter) snprintf(filename, PATH_MAX, STORAGEDIR "/%s/settings", btd_adapter_get_storage_dir(adapter)); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); str = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, str, length, NULL); @@ -5427,7 +5427,7 @@ static void convert_names_entry(char *key, char *value, void *user_data) return; snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", address, str); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); key_file = g_key_file_new(); g_key_file_load_from_file(key_file, filename, 0, NULL); @@ -5663,7 +5663,7 @@ static void convert_entry(char *key, char *value, void *user_data) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -5759,7 +5759,7 @@ static void store_sdp_record(char *local, char *peer, int handle, char *value) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -5833,7 +5833,7 @@ static void convert_sdp_entry(char *key, char *value, void *user_data) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -5898,7 +5898,7 @@ static void convert_primaries_entry(char *key, char *value, void *user_data) if (length == 0) goto end; - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); if (device_type < 0) @@ -5915,7 +5915,7 @@ static void convert_primaries_entry(char *key, char *value, void *user_data) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -5964,7 +5964,7 @@ static void convert_ccc_entry(char *key, char *value, void *user_data) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -6011,7 +6011,7 @@ static void convert_gatt_entry(char *key, char *value, void *user_data) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -6056,7 +6056,7 @@ static void convert_proximity_entry(char *key, char *value, void *user_data) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -6154,7 +6154,7 @@ static void convert_config(struct btd_adapter *adapter, const char *filename, if (read_local_name(&adapter->bdaddr, str) == 0) g_key_file_set_string(key_file, "General", "Alias", str); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); data = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, data, length, NULL); @@ -7962,7 +7962,7 @@ static void store_link_key(struct btd_adapter *adapter, g_key_file_set_integer(key_file, "LinkKey", "Type", type); g_key_file_set_integer(key_file, "LinkKey", "PINLength", pin_length); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); str = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, str, length, NULL); @@ -8059,7 +8059,7 @@ static void store_longtermkey(struct btd_adapter *adapter, const bdaddr_t *peer, g_key_file_set_integer(key_file, group, "EDiv", ediv); g_key_file_set_uint64(key_file, group, "Rand", rand); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); str = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, str, length, NULL); @@ -8183,7 +8183,7 @@ static void store_csrk(struct btd_adapter *adapter, const bdaddr_t *peer, g_key_file_set_integer(key_file, group, "Counter", counter); g_key_file_set_boolean(key_file, group, "Authenticated", auth); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); str = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, str, length, NULL); @@ -8251,7 +8251,7 @@ static void store_irk(struct btd_adapter *adapter, const bdaddr_t *peer, g_key_file_set_string(key_file, "IdentityResolvingKey", "Key", str); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); store_data = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, store_data, length, NULL); @@ -8343,7 +8343,7 @@ static void store_conn_param(struct btd_adapter *adapter, const bdaddr_t *peer, g_key_file_set_integer(key_file, "ConnectionParameters", "Timeout", timeout); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); store_data = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, store_data, length, NULL); diff --git a/src/attrib-server.c b/src/attrib-server.c index 91a10b274..5a178f95e 100644 --- a/src/attrib-server.c +++ b/src/attrib-server.c @@ -919,7 +919,7 @@ static uint16_t write_value(struct gatt_channel *channel, uint16_t handle, data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } diff --git a/src/device.c b/src/device.c index af13badfc..dfba6ee47 100644 --- a/src/device.c +++ b/src/device.c @@ -463,7 +463,7 @@ static gboolean store_device_info_cb(gpointer user_data) if (device->remote_csrk) store_csrk(device->remote_csrk, key_file, "RemoteSignatureKey"); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); str = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, str, length, NULL); @@ -522,7 +522,7 @@ void device_store_cached_name(struct btd_device *dev, const char *name) ba2str(&dev->bdaddr, d_addr); snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", btd_adapter_get_storage_dir(dev->adapter), d_addr); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); key_file = g_key_file_new(); g_key_file_load_from_file(key_file, filename, 0, NULL); @@ -2290,7 +2290,7 @@ static void store_services(struct btd_device *device) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -2478,7 +2478,7 @@ static void store_gatt_db(struct btd_device *device) snprintf(filename, PATH_MAX, STORAGEDIR "/%s/cache/%s", btd_adapter_get_storage_dir(device->adapter), dst_addr); - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); key_file = g_key_file_new(); g_key_file_load_from_file(key_file, filename, 0, NULL); @@ -4439,7 +4439,7 @@ static void device_remove_stored(struct btd_device *device) data = g_key_file_to_data(key_file, &length, NULL); if (length > 0) { - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); g_file_set_contents(filename, data, length, NULL); } @@ -4889,7 +4889,7 @@ next: if (sdp_key_file) { data = g_key_file_to_data(sdp_key_file, &length, NULL); if (length > 0) { - create_file(sdp_file, S_IRUSR | S_IWUSR); + create_file(sdp_file, 0600); g_file_set_contents(sdp_file, data, length, NULL); } @@ -4900,7 +4900,7 @@ next: if (att_key_file) { data = g_key_file_to_data(att_key_file, &length, NULL); if (length > 0) { - create_file(att_file, S_IRUSR | S_IWUSR); + create_file(att_file, 0600); g_file_set_contents(att_file, data, length, NULL); } @@ -5807,7 +5807,7 @@ void device_store_svc_chng_ccc(struct btd_device *device, uint8_t bdaddr_type, value); } - create_file(filename, S_IRUSR | S_IWUSR); + create_file(filename, 0600); str = g_key_file_to_data(key_file, &length, NULL); g_file_set_contents(filename, str, length, NULL); diff --git a/src/sdpd-server.c b/src/sdpd-server.c index dfd8b1f00..306b92a44 100644 --- a/src/sdpd-server.c +++ b/src/sdpd-server.c @@ -130,7 +130,7 @@ static int init_server(uint16_t mtu, int master, int compat) return -1; } - chmod(SDP_UNIX_PATH, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + chmod(SDP_UNIX_PATH, 0660); return 0; } diff --git a/src/shared/btsnoop.c b/src/shared/btsnoop.c index e2b3747e3..a29bc928f 100644 --- a/src/shared/btsnoop.c +++ b/src/shared/btsnoop.c @@ -151,7 +151,7 @@ struct btsnoop *btsnoop_create(const char *path, size_t max_size, } btsnoop->fd = open(real_path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + 0644); if (btsnoop->fd < 0) { free(btsnoop); return NULL; @@ -230,7 +230,7 @@ static bool btsnoop_rotate(struct btsnoop *btsnoop) btsnoop->cur_count++; btsnoop->fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + 0644); if (btsnoop->fd < 0) return false; diff --git a/src/textfile.c b/src/textfile.c index 7dd62392b..8c8d509b4 100644 --- a/src/textfile.c +++ b/src/textfile.c @@ -65,7 +65,7 @@ int create_file(const char *filename, const mode_t mode) { int fd; - create_dirs(filename, S_IRUSR | S_IWUSR | S_IXUSR); + create_dirs(filename, 0700); fd = open(filename, O_RDWR | O_CREAT, mode); if (fd < 0) From patchwork Tue Feb 23 19:02:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Gix X-Patchwork-Id: 12100767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10AEFC433DB for ; Tue, 23 Feb 2021 19:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB46264E7A for ; Tue, 23 Feb 2021 19:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233997AbhBWTEv (ORCPT ); Tue, 23 Feb 2021 14:04:51 -0500 Received: from mga06.intel.com ([134.134.136.31]:19070 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbhBWTEn (ORCPT ); Tue, 23 Feb 2021 14:04:43 -0500 IronPort-SDR: B9FKbQOTczVCKoixq4vDOVPLZFLmgbOhD7DybFB9CJuEYkioS0PdmNB9N+0SiM43UjRKJ/5Iuv /crARGvQ7Gyg== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="246336033" X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="246336033" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:59 -0800 IronPort-SDR: 3blEaChH31oq3jHSBsbCwOFfN2bA7DZEl9V+TAwsXDIwj2Q2MEJ4d9RAoi3Hm6ga+/5z2Pfg/H M6yZQYzlYofQ== X-IronPort-AV: E=Sophos;i="5.81,200,1610438400"; d="scan'208";a="432831128" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.105.235]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 11:03:59 -0800 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, inga.stotland@intel.com, luiz.dentz@gmail.com, tedd.an@linux.intel.com, marcel@holtmann.org Subject: [PATCH BlueZ 6/6] tools: Cleanup deprecated symbolic file permissions Date: Tue, 23 Feb 2021 11:02:52 -0800 Message-Id: <20210223190252.483784-7-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210223190252.483784-1-brian.gix@intel.com> References: <20210223190252.483784-1-brian.gix@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- tools/btsnoop.c | 3 +-- tools/create-image.c | 3 +-- tools/hcidump.c | 2 +- tools/rctest.c | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/btsnoop.c b/tools/btsnoop.c index 41baf6e3d..738027dfc 100644 --- a/tools/btsnoop.c +++ b/tools/btsnoop.c @@ -57,8 +57,7 @@ static int create_btsnoop(const char *path) ssize_t written; int fd; - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644); if (fd < 0) { perror("failed to output file"); return -1; diff --git a/tools/create-image.c b/tools/create-image.c index 3f2cf03d8..aba940da7 100644 --- a/tools/create-image.c +++ b/tools/create-image.c @@ -53,8 +53,7 @@ static unsigned int ino_cnt = 721; -#define REG_EXE S_IFREG | \ - S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH +#define REG_EXE S_IFREG | 0555 static const struct { const char *source; diff --git a/tools/hcidump.c b/tools/hcidump.c index 2b08056ea..011864bc0 100644 --- a/tools/hcidump.c +++ b/tools/hcidump.c @@ -434,7 +434,7 @@ static int open_file(char *file, int mode, unsigned long flags) else open_flags = O_RDONLY; - fd = open(file, open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + fd = open(file, open_flags, 0644); if (fd < 0) { perror("Can't open dump file"); exit(1); diff --git a/tools/rctest.c b/tools/rctest.c index 494359a88..7d688691c 100644 --- a/tools/rctest.c +++ b/tools/rctest.c @@ -631,8 +631,7 @@ static void automated_send_recv() do_listen(recv_mode); } - save_fd = open(savefile, O_CREAT | O_WRONLY, - S_IRUSR | S_IWUSR); + save_fd = open(savefile, O_CREAT | O_WRONLY, 0600); if (save_fd < 0) syslog(LOG_ERR, "Failed to open file to save data");