[Commits] [SCM] claws branch, gtk3, updated. 3.99.0-89-gf5a3eb418

paul at claws-mail.org paul at claws-mail.org
Wed Apr 21 13:56:53 CEST 2021


The branch, gtk3 has been updated
       via  f5a3eb4181860287167c2f6817a9783134138a12 (commit)
      from  e511bd87cb75138e1dae688530f4bb2c174f3ede (commit)

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


- Log -----------------------------------------------------------------
commit f5a3eb4181860287167c2f6817a9783134138a12
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 887375d06..5643deb54 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -10236,6 +10236,7 @@ gboolean compose_draft (gpointer data, guint action)
 {
 	Compose *compose = (Compose *)data;
 	FolderItem *draft;
+	FolderItemPrefs *prefs;
 	gchar *tmp;
 	gchar *sheaders;
 	gint msgnum;
@@ -10245,6 +10246,7 @@ gboolean compose_draft (gpointer data, guint action)
 	FILE *fp;
 	gboolean target_locked = FALSE;
 	gboolean err = FALSE;
+	gint filemode = 0;
 
 	if (lock) return FALSE;
 
@@ -10272,8 +10274,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