From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 4B47A6DE0207 for ; Tue, 6 Feb 2018 11:44:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.021 X-Spam-Level: X-Spam-Status: No, score=-0.021 tagged_above=-999 required=5 tests=[AWL=-0.021] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bdu8jT4Qornb for ; Tue, 6 Feb 2018 11:44:00 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id B46C16DE0205 for ; Tue, 6 Feb 2018 11:44:00 -0800 (PST) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id E0096F99A for ; Tue, 6 Feb 2018 14:43:59 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id 8005320207; Tue, 6 Feb 2018 14:43:56 -0500 (EST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2] cli/insert: new message file can be world-readable (rely on umask) Date: Tue, 6 Feb 2018 14:43:56 -0500 Message-Id: <20180206194356.28438-1-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180205225920.GL1824@hili.localdomain> References: <20180205225920.GL1824@hili.localdomain> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2018 19:44:01 -0000 There are legitimate cases (public archives) where a user might actually want their archive to be readable to the world. "notmuch insert" historically used mode 0600 (unreadable by group or other), but that choice doesn't appear to have been specifically justified (perhaps an abundance of caution?). This patch also adjusts the default mode used for --create-folder, to be mode 0755 before the application of the umask. If the user wants "notmuch insert" to create files or folders that are not readable by group or other, they can set their umask more restrictively. --- notmuch-insert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notmuch-insert.c b/notmuch-insert.c index 48490b51..4f1116ed 100644 --- a/notmuch-insert.c +++ b/notmuch-insert.c @@ -162,7 +162,7 @@ static bool maildir_create_folder (const void *ctx, const char *maildir) { const char *subdirs[] = { "cur", "new", "tmp" }; - const int mode = 0700; + const int mode = 0755; char *subdir; unsigned int i; @@ -227,7 +227,7 @@ maildir_mktemp (const void *ctx, const char *maildir, char **path_out) return -1; } - fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600); + fd = open (path, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644); } while (fd == -1 && errno == EEXIST); if (fd == -1) { -- 2.15.1