[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[msmtp-users] Bug in msmtpq might cause mail loss
msmtpq contains a test
if [ -f "${FQP}.*" ] ; then # ensure fqp name is unique
that is supposed to ensure that an existing queue file is not overwritten.
However this combination of -f and globbing does not seem to work.
$ cd /tmp
$ touch foo
$ if [ -f "foo" ]; then echo hi; fi
hi
$ if [ -f "foo*" ]; then echo hi; fi
$
This means that whenever a user sends more than one message per second only
the last mail will survive.
I've attached a possible fix but one might want to look into how to combine
tests and globbing correctly.
Regards,
Philipp
--- - 2011-10-19 12:14:27.531364497 +0200
+++ bin/msmtpq 2011-10-19 12:02:30.119359444 +0200
@@ -331,9 +331,9 @@
ID="$(date +%Y-%m-%d-%H.%M.%S)" # make filename id for queue
FQP="${Q}/$ID" # make fully qualified pathname
- if [ -f "${FQP}.*" ] ; then # ensure fqp name is unique
+ if [ -f "${FQP}.mail" -o -f "${FQP}.msmtp" ] ; then # ensure fqp name is unique
INC=1 # initial increment
- while [ -f "${FQP}-${INC}.*" ] ; do # fqp name w/incr exists
+ while [ -f "${FQP}-${INC}.mail" -o -f "${FQP}-${INC}.msmtp" ] ; do # fqp name w/incr exists
(( ++INC )) # bump increment
done
ID="${ID}-${INC}" # unique ; set id