25 messages in net.sourceforge.lists.courier-users[courier-users] Re: Where exactly is ...
FromSent OnAttachments
Lloyd ZusmanFeb 11, 2004 5:26 am 
Mitch (WebCob)Feb 11, 2004 11:23 pm 
Derrick T. WoolworthFeb 12, 2004 12:31 am 
Lloyd ZusmanFeb 12, 2004 4:16 am 
Lloyd ZusmanFeb 12, 2004 4:47 am.patch
Malcolm WeirFeb 12, 2004 7:50 am 
Jon NelsonFeb 12, 2004 7:55 am 
Mitch (WebCob)Feb 12, 2004 8:30 am 
Lloyd ZusmanFeb 12, 2004 9:07 am 
Mitch (WebCob)Feb 12, 2004 9:41 am 
Lloyd ZusmanFeb 12, 2004 9:49 am 
Sam VarshavchikFeb 12, 2004 4:05 pm 
Sam VarshavchikFeb 12, 2004 4:06 pm 
Sam VarshavchikFeb 12, 2004 4:08 pm 
Matt PavlovichFeb 13, 2004 7:11 am 
Lloyd ZusmanFeb 13, 2004 7:27 am.patch
Lloyd ZusmanFeb 15, 2004 9:43 am 
Sam VarshavchikFeb 15, 2004 2:07 pm 
Lloyd ZusmanFeb 15, 2004 5:38 pm 
Sam VarshavchikFeb 15, 2004 6:10 pm 
Lloyd ZusmanFeb 15, 2004 7:49 pm.patch
Mitch (WebCob)Feb 15, 2004 8:06 pm 
Sam VarshavchikFeb 15, 2004 8:14 pm 
Lloyd ZusmanFeb 15, 2004 8:34 pm 
Sam VarshavchikFeb 16, 2004 5:19 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] Re: Where exactly is the queue ID generated?Actions...
From:Lloyd Zusman (lj@asfast.com)
Date:Feb 15, 2004 7:49:38 pm
List:net.sourceforge.lists.courier-users
Attachments:

Sam Varshavchik <mrs@courier-mta.com> writes:

[ ... ]

This is the code in submit2.C that generates the queue ID:

… << COMCTLFILE_MSGID << ino_buf << '.' << basemsgid << endl; …

ino_buf is the control file's inode number. basemsgid is generated a few lines earlier, like this:

[ ... etc. ... ]

Thanks again, Sam.

OK. Now I have changed my unique ID patch so that the id that gets put into the "Received" header is the queue ID, as in the 3rd line of this example:

Received: from bsd4.nyct.net (mail-out.nyct.net [::ffff:216.139.141.2]) (IDENT: root, TLS: TLSv1/SSLv3,256bits,AES256-SHA) id 0021CB0D.40303AA5.00008701 by asfast.net with esmtp; Sun, 15 Feb 2004 22:36:05 -0500

I've attached the patch, below.

I'd like to request that this patch be put into an upcoming Courier release (after you're convinced that it actually works, of course). I believe that this would be a beneficial thing to do for the following reasons:

1. This "id" field is specified as being valid for the "Received" header in one or more RFC's, so we are not deviating from any standards.

2. One or more other MTA's also make use of this "id" field in the "Received" header. For example, in exim, this field appears, and it also represents the mail queue ID. Therefore, its use is consistent with that of other existing email software.

3. It's a minor change: only one extra line in the "Received" header, an infinitessimal impact on execution speed, and no change whatsoever in the message processing flow.

4. With this unique ID in the "Received" header, it is now possible to keep state information for the life of each message. By means of this, it's possible for events that occur during global filtering to trigger changes to the message during subsequent local filtering. One version of this procedure is described in the "Modest Proposal" that I posted several days ago.

5. Nothing about this minor change will prevent other, more ambitious changes in message processing to be implemented in the future, if desired.

So Sam ... do you consider this to be a worthwhile change to put into an upcoming release?

*** courier/submit.h.orig Sun Feb 15 21:03:57 2004 --- courier/submit.h Sun Feb 15 21:39:00 2004 *************** *** 117,122 **** --- 117,123 ---- SubmitFile(); ~SubmitFile();

+ char* QueueID(); void SendingModule(const char *p) {sending_module=p;} void Sender(const char *, const char *, const char *, char); int ChkRecipient(const char *); *** courier/submit.C.orig Mon Dec 15 20:51:29 2003 --- courier/submit.C Sun Feb 15 22:17:45 2004 *************** *** 1088,1093 **** --- 1088,1097 ---- line += ')'; }

+ // Add unique id here. + line += "\n id "; + line += my_rcptinfo.submitfile.QueueID(); + line += "\n by "; line += config_me();

*** courier/submit2.C.orig Sun Feb 15 21:26:35 2004 --- courier/submit2.C Sun Feb 15 22:33:25 2004 *************** *** 434,439 **** --- 434,500 ---- ) ; }

+ char *SubmitFile::QueueID() + { + struct stat stat_buf; + char ino_buf[sizeof(ino_t)*2+1]; + char time_buf[sizeof(time_t)*2+1]; + char pid_buf[sizeof(time_t)*2+1]; + static char result[sizeof(ino_buf)+sizeof(time_buf)+sizeof(pid_buf)]; + + char* f = strdup(name1stctlfile()); + if (f == NULL) + { + clog_msg_errno(); + } + int rc = stat(f, &stat_buf); + if (rc != 0) + { + free(f); + clog_msg_errno(); + } + // This code assumes that the result of name1stcltfile() is + // of the form SOMETHING/tttttt.ppppp.hhhhhh, where + // SOMETHING is arbitrary (as far as this routine is concerned), + // where tttttt is the modification time of the control file, + // where pppppp is the pid of the process which created + // the control file, and where hhhhhh can contain zero or + // more dots. + char* cp = f; + char* slash = f; + for (; *cp != '\0'; cp++) { + if (*cp == '/') + { + slash = cp; + } + } + cp = slash + 1; + char* dot = cp; + for (; *dot != '.'; dot++) { /* do nothing */ } + *dot++ = '\0'; + time_t tm = (time_t) atoi(cp); + cp = dot; + for (; *dot != '.'; dot++) { /* do nothing */ } + *dot++ = '\0'; + int pid = atoi(cp); + free(f); + libmail_strh_ino_t(stat_buf.st_ino, ino_buf); + libmail_strh_time_t(tm, time_buf); + libmail_strh_pid_t(pid, pid_buf); + + strcat( + strcat( + strcat( + strcat( + strcpy(result, ino_buf) + , ".") + , time_buf) + , ".") + , pid_buf) ; + + return (result); + } + char *SubmitFile::namefile(const char *pfix, unsigned n) { char buf[MAXLONGSIZE], *p;