A Message-ID should be globally unique. Currently mutt generates this ID
based on the current date and time, followed by ".G", followed by a letter
A to Z (A for the 1st and 27th email sent, Z for the 26th, etc.), followed
by the pid of the active mutt process, followed by "@" and the configured
fqdn.
This can lead to information being leaked as to an users email habits and
activities, which might be undesirable.
By replacing everything left of the "@" and to the right of the "." in the
Message-ID with 96 bits of Base64 encoded randomness, we no longer include
this information.
---
sendlib.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sendlib.c b/sendlib.c
index 77c14e8f..e1dc3ea3 100644
--- a/sendlib.c
+++ b/sendlib.c
@@ -80,8 +80,6 @@ const char B64Chars[64] = {
'8', '9', '+', '/'
};
-static char MsgIdPfx = 'A';
-
static void transform_to_7bit (BODY *a, FILE *fpin);
static void encode_quoted (FGETCONV * fc, FILE *fout, int istext)
@@ -2399,17 +2397,18 @@ char *mutt_gen_msgid (void)
char buf[SHORT_STRING];
time_t now;
struct tm *tm;
+ char randomness[17];
const char *fqdn;
now = time (NULL);
tm = gmtime (&now);
+ mutt_base64_random96(randomness);
if (!(fqdn = mutt_fqdn(0)))
fqdn = NONULL(Hostname);
- snprintf (buf, sizeof (buf), "<%d%02d%02d%02d%02d%02d.G%c%u@%s>",
+ snprintf (buf, sizeof (buf), "<%d%02d%02d%02d%02d%02d.%s@%s>",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
- tm->tm_min, tm->tm_sec, MsgIdPfx, (unsigned int)getpid (), fqdn);
- MsgIdPfx = (MsgIdPfx == 'Z') ? 'A' : MsgIdPfx + 1;
+ tm->tm_min, tm->tm_sec, randomness, fqdn);
return (safe_strdup (buf));
}
--
2.26.2