3

We're using ripmime with Procmail to extract email contents into files. When extracting the email body (the text) ripmime correctly uses the configured procmail UMASK (022) for the files, but when there is an attachment it creates the file for the attachement with a 077 umask. Here's an example of files that ripmime created for one email that had a "testTrades2.csv" attachment:

-rw-r--r--  1 fsdevprod   fsdevprod     2341 2012-06-07 06:36 textfile4
-rw-r--r--  1 fsdevprod   fsdevprod       19 2012-06-07 06:36 textfile3
-rw-r--r--  1 fsdevprod   fsdevprod      294 2012-06-07 06:36 textfile2
-rw-r--r--  1 fsdevprod   fsdevprod      573 2012-06-07 06:36 textfile1
-rw-r--r--  1 fsdevprod   fsdevprod        0 2012-06-07 06:36 textfile0
-rw-------  1 fsdevprod   fsdevprod       66 2012-06-07 06:36 testTrades2.csv

Here's how ripmime is being called in the procmail rc file:

| ripmime -i - -d /tmp

Why does the "testTrades2.csv" have different permissions from the textfile* files, and is there any way to have it use the same UMASK?

We're on ripmime v1.4.0.9.

thanks, David

DavidK
  • 162
  • 2
  • 12
  • Was it by any chance an uuencoded blob rather than a proper MIME attachment? `uuencode` has the intended permissions encoded in the `begin` line. – tripleee Jun 11 '12 at 05:34

2 Answers2

4

The ripmime source (mime.c) had a bunch of these:

open(fullpath, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR);

So it was hardcoded. I changed them to be this:

open(fullpath, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);

and recompiled. Now the files are created group and publicly readable. Not an ideal solution as it is also hard-coded, but it works for me.

Ideally it should be command line configurable which shouldn't be hard to do, and then sent to the ripmime maintainer.

Rostyslav Dzinko
  • 36,138
  • 5
  • 44
  • 59
DavidK
  • 162
  • 2
  • 12
0
:0:
* ^From.*xxx@xxx.ru

{

:0 c:
| ripmime -i - --no-nameless -d $MAILDIR/xxx

:0:
| chmod 777 $MAILDIR/xxx/*

}
DaveShaw
  • 48,792
  • 16
  • 106
  • 133
  • -1 for `chmod 777`. With a sane mode value this would be acceptable as a crude workaround, although a single action would be more elegant. – tripleee Jul 05 '12 at 17:52