User Tools

Site Tools


user:sachy:lakatux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
user:sachy:lakatux [2023/03/23 17:03] sachyuser:sachy:lakatux [2023/09/10 09:16] (current) – novy patch sachy
Line 209: Line 209:
  
 <code diff mutt_save_file_perm.patch> <code diff mutt_save_file_perm.patch>
---- PATCHES~    Mon Jul 27 21:36:10 CEST 2020 +diff -Naru /s/mutt-2.2.12/globals.h ./globals.h 
-+++ PATCHES     Mon Jul 27 21:36:10 CEST 2020 +--- /s/mutt-2.2.12/globals.h 2023-09-01 08:32:23.000000000 +0200 
-@@ -1,+@@ ++++ ./globals.h 2023-09-10 10:13:54.320014522 +0200 
-+patch.1.14.6.ms.sfp.1 +@@ -250,+250,8 @@ 
-diff /s/mutt-1.14.6/globals.h ./globals.h + WHERE short ScoreThresholdRead; 
-234a235 + WHERE short ScoreThresholdFlag; 
-> WHERE short SaveFilePerm; +  
-diff /s/mutt-1.14.6/init.h ./init.h ++WHERE short SaveFilePerm; 
-3138a3139,3143 +
-  { "save_file_perm", DT_NUM, R_NONE, {.p=&SaveFilePerm}, {.l=0600} }, + #ifdef USE_SIDEBAR 
->   /* + WHERE short SidebarWidth; 
->   ** This variable controls the permissions of saved attachments. + WHERE LIST *SidebarWhitelist; 
->   ** Use standard POSIX permissions in octal notation, i.e. 0644. +diff -Naru /s/mutt-2.2.12/init.h ./init.h 
->   */ +--- /s/mutt-2.2.12/init.h 2023-09-01 08:32:23.000000000 +0200 
-diff /s/mutt-1.14.6/main.c ./main.c ++++ ./init.h 2023-09-10 10:18:22.900015368 +0200 
-669c669,672 +@@ -3460,6 +3460,11 @@ 
-  umask (077); +   ** \fBNote:\fP This only applies to mbox and MMDF folders, Mutt does not 
---- +   ** delete MH and Maildir directories. 
->   if(SaveFilePerm==600) +   */ 
->     umask (077); ++  { "save_file_perm", DT_NUM, R_NONE, {.p=&SaveFilePerm}, {.l=0600} }, 
->   else ++  /* 
->     umask (000); ++  ** This variable controls the permissions of saved attachments. 
-diff /s/mutt-1.14.6/muttlib.c ./muttlib.c ++  ** Use standard POSIX permissions in octal notation, i.e. 0644. 
-2498a2499,2514 ++  */ 
-  /* Convert file permission from decadic to octal */ +   { "save_history",     DT_NUM,  R_NONE, {.p=&SaveHist}, {.l=0} }, 
->   unsigned short own=0; +   /* 
->   unsigned short grp=0; +   ** .pp 
->   unsigned short oth=0; +diff -Naru /s/mutt-2.2.12/main.c ./main.c 
->   unsigned short SFPoct=0; +--- /s/mutt-2.2.12/main.c 2023-09-01 08:32:23.000000000 +0200 
->   own=SaveFilePerm/100; ++++ ./main.c 2023-09-10 10:15:20.128014792 +0200 
->   grp=(SaveFilePerm-own*100)/10; +@@ -690,7 +690,10 @@ 
->   oth=SaveFilePerm-(own*100)-(grp*10); +   mutt_error = mutt_nocurses_error; 
->   if(own>7||grp>7||oth>7) +   mutt_message = mutt_nocurses_error; 
->   +   SRAND (time (NULL)); 
->     SFPoct=0600; +-  umask (077); 
->     dprint(1,(debugfile,"safe_open: Value %d is not valid octal permission mask.\n",SaveFilePerm)); ++  if(SaveFilePerm==600) 
->   ++    umask (077); 
->   else ++  else 
->     SFPoct=own<<6|grp<<3|oth; ++    umask (000); 
- +  
-2510c2526 +   memset (Options, 0, sizeof (Options)); 
-    if ((fd = open (mutt_b2s (safe_file), flags, 0600)) < 0) +   memset (QuadOptions, 0, sizeof (QuadOptions)); 
---- +diff -Naru /s/mutt-2.2.12/muttlib.c ./muttlib.c 
->     if ((fd = open (mutt_b2s (safe_file), flags, SFPoct)) < 0) +--- /s/mutt-2.2.12/muttlib.c 2023-08-18 05:03:18.000000000 +0200 
-2525c2541 ++++ ./muttlib.c 2023-09-10 10:36:18.872018760 +0200 
-  if ((fd = open (path, flags & ~O_EXCL, 0600)) < 0) +@@ -2562,6 +2562,22 @@ 
---- +   BUFFER *safe_file = NULL; 
->   if ((fd = open (path, flags & ~O_EXCL, SFPoct)) < 0)+   BUFFER *safe_dir = NULL; 
 +  
 ++  /* Convert file permission from decadic to octal */ 
 ++  unsigned short own=0; 
 ++  unsigned short grp=0; 
 ++  unsigned short oth=0; 
 ++  unsigned short SFPoct=0; 
 ++  own=SaveFilePerm/100; 
 ++  grp=(SaveFilePerm-own*100)/10; 
 ++  oth=SaveFilePerm-(own*100)-(grp*10); 
 ++  if(own>7||grp>7||oth>7) 
 ++  
 ++    SFPoct=0600; 
 ++    dprint(1,(debugfile,"safe_open: Value %d is not valid octal permission mask.\n",SaveFilePerm)); 
 ++  
 ++  else 
 ++    SFPoct=own<<6|grp<<3|oth; 
 ++ 
 +   if (flags & O_EXCL) 
 +   { 
 +     safe_file = mutt_buffer_pool_get (); 
 +@@ -2573,7 +2589,7 @@ 
 +       goto cleanup; 
 +     } 
 +  
 +-    if ((fd = open (mutt_b2s (safe_file), flags, 0600)) < 0) 
 ++    if ((fd = open (mutt_b2s (safe_file), flags, SFPoct)) < 0) 
 +     { 
 +       rmdir (mutt_b2s (safe_dir)); 
 +       goto cleanup; 
 +@@ -2588,7 +2604,7 @@ 
 +     } 
 +   
 +  
 +-  if ((fd = open (path, flags & ~O_EXCL, 0600)) < 0) 
 ++  if ((fd = open (path, flags & ~O_EXCL, SFPoct)) < 0) 
 +     goto cleanup; 
 +  
 +   /* make sure the file is not symlink */
 </code> </code>
  
user/sachy/lakatux.txt · Last modified: 2023/09/10 09:16 by sachy