Hi all,

I'm new to the Mutt development, so please bear with me.

In my environment, I'm running Mutt and other software (i.e. LibreOffice) under 
separate user IDs. Since mutt is storing all attachments with permissions of 
0600, I got bored with the intermediate storage manipulation...

In this patch, I'm adding support for a new option "save_file_perm" which will 
allow the user to set the permissions of stored/opened attachments. The default 
stays 0600. Usage in muttrc is simple:
        set save_file_perm = 0660

Is there any chance to get the patch accepted?

Thanks and regards,
Martin Sacha
--- PATCHES~    Mon Jul 27 21:36:10 CEST 2020
+++ PATCHES     Mon Jul 27 21:36:10 CEST 2020
@@ -1,0 +1 @@
+patch.1.14.6.ms.sfp.1
diff /s/mutt-1.14.6/globals.h ./globals.h
234a235
> WHERE short SaveFilePerm;
diff /s/mutt-1.14.6/init.h ./init.h
3138a3139,3143
>   { "save_file_perm", DT_NUM, R_NONE, {.p=&SaveFilePerm}, {.l=0600} },
>   /*
>   ** This variable controls the permissions of saved attachments.
>   ** Use standard POSIX permissions in octal notation, i.e. 0644.
>   */
diff /s/mutt-1.14.6/main.c ./main.c
669c669,672
<   umask (077);
---
>   if(SaveFilePerm==600)
>     umask (077);
>   else
>     umask (000);
diff /s/mutt-1.14.6/muttlib.c ./muttlib.c
2498a2499,2514
>   /* 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;
> 
2510c2526
<     if ((fd = open (mutt_b2s (safe_file), flags, 0600)) < 0)
---
>     if ((fd = open (mutt_b2s (safe_file), flags, SFPoct)) < 0)
2525c2541
<   if ((fd = open (path, flags & ~O_EXCL, 0600)) < 0)
---
>   if ((fd = open (path, flags & ~O_EXCL, SFPoct)) < 0)

Attachment: signature.asc
Description: PGP signature

Reply via email to