Purpose: Make the server tell the client a recommended Message-ID before POST. Reasoning: Many clients need to know the Message-IDs of their own postings for bookkeeping or other purposes, so they generate them themselves. But the better place for devising Message-IDs is the server to guarantee unambiguity. This is a simple NNTP protocol extension: in the 340 response to POST, the server gives a recommended Message-ID. It can be recognized by the <...@...> syntax. To utilize this feature, we need better clients, of course. Patch against: snapshot 19981013 --- inn-1.7.2.orig/nnrpd/post.c +++ inn-1.7.2/nnrpd/post.c @@ -306,8 +309,9 @@ ** Return NULL if okay, or an error message. */ STATIC STRING -ProcessHeaders(linecount) +ProcessHeaders(linecount, idbuff) int linecount; + char *idbuff; { static char MONTHS[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; static char datebuff[40]; @@ -394,12 +399,7 @@ /* Set Message-ID */ if (HDR(_messageid) == NULL) { - if ((p = GenerateMessageID()) == NULL) { - (void)sprintf(Error, "Can't generate Message-ID, %s", - strerror(errno)); - return Error; - } - HDR(_messageid) = p; + HDR(_messageid) = COPY(idbuff); /* XXX leak? valgrind says no */ } /* Set Path */ @@ -846,7 +853,7 @@ if ((error = CheckIncludedText(article, i)) != NULL) return error; #endif /* defined(DO_CHECK_INCLUDED_TEXT) */ - if ((error = ProcessHeaders(i)) != NULL) + if ((error = ProcessHeaders(i, idbuff)) != NULL) return error; if (i == 0 && HDR(_control) == NULL) return "Article is empty"; --- inn-1.7.2.orig/nnrpd/commands.c +++ inn-1.7.2/nnrpd/commands.c @@ -567,12 +567,15 @@ size = 4096; article = NEW(char, size); } + idbuff[0] = 0; + if ((p = GenerateMessageID()) != NULL) + strcpy(idbuff, p); + Reply("%d Ok, recommended ID %s\r\n", NNTP_START_POST_VAL, idbuff); + (void)fflush(stdout); + p = article; end = &article[size]; - Reply("%d Ok\r\n", NNTP_START_POST_VAL); - (void)fflush(stdout); - for (l = 0, longline = 0; ; l++) { /* Need more room? */ if (end - p < ART_LINE_MALLOC) { @@ -638,7 +641,7 @@ response = ARTpost(article, idbuff); if (response == NULL) { syslog(L_NOTICE, "%s post ok %s", ClientHost, idbuff); - Reply("%s\r\n", NNTP_POSTEDOK); + Reply("%s %s\r\n", NNTP_POSTEDOK, idbuff); POSTreceived++; } else {