[Commits] [SCM] claws branch, master, updated. 3.17.8-75-g5ec726e90

paul at claws-mail.org paul at claws-mail.org
Wed Apr 21 13:58:27 CEST 2021


The branch, master has been updated
       via  5ec726e9094b2265bd4b55c82f5bc201b8b745c5 (commit)
      from  b945f98b3a634fbda28df624be03b45568f43ab7 (commit)

Summary of changes:
 src/compose.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 5ec726e9094b2265bd4b55c82f5bc201b8b745c5
Author: paul <paul at claws-mail.org>
Date:   Wed Apr 21 12:56:49 2021 +0100

    fix bug 4445, 'Draft folder on shared storage does not honour chmod settings'

diff --git a/src/compose.c b/src/compose.c
index 0fba4f478..4af911ec5 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -10272,6 +10272,7 @@ gboolean compose_draft (gpointer data, guint action)
 {
 	Compose *compose = (Compose *)data;
 	FolderItem *draft;
+	FolderItemPrefs *prefs;
 	gchar *tmp;
 	gchar *sheaders;
 	gint msgnum;
@@ -10281,6 +10282,7 @@ gboolean compose_draft (gpointer data, guint action)
 	FILE *fp;
 	gboolean target_locked = FALSE;
 	gboolean err = FALSE;
+	gint filemode = 0;
 
 	if (lock) return FALSE;
 
@@ -10308,8 +10310,15 @@ gboolean compose_draft (gpointer data, guint action)
 		goto warn_err;
 	}
 
-	/* chmod for security */
-	if (change_file_mode_rw(fp, tmp) < 0) {
+	/* chmod for security unless folder chmod is set */
+	prefs = draft->prefs;
+	if (prefs && prefs->enable_folder_chmod && prefs->folder_chmod) {
+			filemode = prefs->folder_chmod;
+			if (filemode & S_IRGRP) filemode |= S_IWGRP;
+			if (filemode & S_IROTH) filemode |= S_IWOTH;
+			if (chmod(tmp, filemode) < 0)
+				FILE_OP_ERROR(tmp, "chmod");
+	} else if (change_file_mode_rw(fp, tmp) < 0) {
 		FILE_OP_ERROR(tmp, "chmod");
 		g_warning("can't change file mode");
 	}

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list