Difference between revisions of "Evolution Header Format"
From Forensics Wiki
(New page: <pre> Subject: header test From: Username <username@sendinghost.com> To: Username <username@receivinghost.com> Content-Type: text/plain Date: Sat, 28 Jul 2007 11:52:35 +0200 Message-Id: <1...) |
|||
| Line 9: | Line 9: | ||
X-Mailer: Evolution 2.10.1 | X-Mailer: Evolution 2.10.1 | ||
Content-Transfer-Encoding: 7bit | Content-Transfer-Encoding: 7bit | ||
| + | </pre> | ||
| + | |||
| + | Code responsible for generating Message-ID: | ||
| + | <pre> | ||
| + | camel_header_msgid_generate (void) | ||
| + | { | ||
| + | static pthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER; | ||
| + | #define COUNT_LOCK() pthread_mutex_lock (&count_lock) | ||
| + | #define COUNT_UNLOCK() pthread_mutex_unlock (&count_lock) | ||
| + | char host[MAXHOSTNAMELEN]; | ||
| + | char *name; | ||
| + | static int count = 0; | ||
| + | char *msgid; | ||
| + | int retval; | ||
| + | struct addrinfo *ai = NULL, hints = { 0 }; | ||
| + | |||
| + | retval = gethostname (host, sizeof (host)); | ||
| + | if (retval == 0 && *host) { | ||
| + | hints.ai_flags = AI_CANONNAME; | ||
| + | ai = camel_getaddrinfo(host, NULL, &hints, NULL); | ||
| + | if (ai && ai->ai_canonname) | ||
| + | name = ai->ai_canonname; | ||
| + | else | ||
| + | name = host; | ||
| + | } else | ||
| + | name = "localhost.localdomain"; | ||
| + | |||
| + | COUNT_LOCK (); | ||
| + | msgid = g_strdup_printf ("%d.%d.%d.camel@%s", (int) time (NULL), getpid (), count++, name); | ||
| + | COUNT_UNLOCK (); | ||
| + | |||
| + | if (ai) | ||
| + | camel_freeaddrinfo(ai); | ||
| + | |||
| + | return msgid; | ||
| + | } | ||
</pre> | </pre> | ||
Revision as of 12:01, 28 July 2007
Subject: header test From: Username <username@sendinghost.com> To: Username <username@receivinghost.com> Content-Type: text/plain Date: Sat, 28 Jul 2007 11:52:35 +0200 Message-Id: <1185616355.19231.0.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit
Code responsible for generating Message-ID:
camel_header_msgid_generate (void)
{
static pthread_mutex_t count_lock = PTHREAD_MUTEX_INITIALIZER;
#define COUNT_LOCK() pthread_mutex_lock (&count_lock)
#define COUNT_UNLOCK() pthread_mutex_unlock (&count_lock)
char host[MAXHOSTNAMELEN];
char *name;
static int count = 0;
char *msgid;
int retval;
struct addrinfo *ai = NULL, hints = { 0 };
retval = gethostname (host, sizeof (host));
if (retval == 0 && *host) {
hints.ai_flags = AI_CANONNAME;
ai = camel_getaddrinfo(host, NULL, &hints, NULL);
if (ai && ai->ai_canonname)
name = ai->ai_canonname;
else
name = host;
} else
name = "localhost.localdomain";
COUNT_LOCK ();
msgid = g_strdup_printf ("%d.%d.%d.camel@%s", (int) time (NULL), getpid (), count++, name);
COUNT_UNLOCK ();
if (ai)
camel_freeaddrinfo(ai);
return msgid;
}