--- inn-1.7.2.orig/nnrpd/post.c +++ inn-1.7.2/nnrpd/post.c @@ -72,6 +72,9 @@ #define _contenttype 19 { "Content-Transfer-Encoding", TRUE, HTstd }, #define _contenttransferencoding 20 + { "X-Trace", FALSE, HTstd }, +#define _xtrace 21 + { "NNTP-Posting-Date", FALSE, HTstd }, { "Xref", FALSE, HTstd }, { "Summary", TRUE, HTstd }, { "Keywords", TRUE, HTstd }, @@ -357,12 +360,12 @@ return Error; } + if ((gmt = gmtime(&Now.time)) == NULL) + return "Can't get the time"; + (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT", + gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year, + gmt->tm_hour, gmt->tm_min, gmt->tm_sec); if (HDR(_date) == NULL) { - if ((gmt = gmtime(&Now.time)) == NULL) - return "Can't get the time"; - (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT", - gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year, - gmt->tm_hour, gmt->tm_min, gmt->tm_sec); HDR(_date) = datebuff; } else { @@ -480,6 +483,17 @@ /* NNTP-Posting host; set. */ HDR(_nntpposthost) = ClientHost; + { + static char xtracebuff[SMBUF]; + + /* X-Trace; set. */ + if ((p = GetFQDN()) == NULL ) + p = "unknown"; + sprintf(xtracebuff, "%s %ld %ld %s (%s)", + p, (long) time((time_t *)NULL), (long) getpid(), ClientIp, datebuff); + HDR(_xtrace) = xtracebuff; + } + /* Now make sure everything is there. */ for (hp = Table; hp < ENDOF(Table); hp++) if (hp->Type == HTreq && hp->Value == NULL) { --- inn-1.7.2.orig/nnrpd/nnrpd.c +++ inn-1.7.2/nnrpd/nnrpd.c @@ -436,6 +436,7 @@ #else (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr)); #endif /* defined(DO_NNRP_GETHOSTBYADDR) */ + (void)strncpy(ClientIp, inet_ntoa(sin.sin_addr), sizeof(ClientIp)); } strncpy (LogName,ClientHost,sizeof(LogName) - 1) ; --- inn-1.7.2.orig/nnrpd/nnrpd.h +++ inn-1.7.2/nnrpd/nnrpd.h @@ -94,6 +94,7 @@ EXTERN STRING MyHostName; extern char ACTIVE[]; EXTERN char ClientHost[SMBUF]; +EXTERN char ClientIp[40]; EXTERN char LogName[256] ; extern char ACTIVETIMES[]; extern char HISTORY[];