Debian Codegraph @

debian/patches/x-trace

raw
1 --- inn-1.7.2.orig/nnrpd/post.c
2 +++ inn-1.7.2/nnrpd/post.c
3 @@ -72,6 +72,9 @@
4 #define _contenttype 19
5 { "Content-Transfer-Encoding", TRUE, HTstd },
6 #define _contenttransferencoding 20
7 + { "X-Trace", FALSE, HTstd },
8 +#define _xtrace 21
9 + { "NNTP-Posting-Date", FALSE, HTstd },
10 { "Xref", FALSE, HTstd },
11 { "Summary", TRUE, HTstd },
12 { "Keywords", TRUE, HTstd },
13 @@ -357,12 +360,12 @@
14 return Error;
15 }
16
17 + if ((gmt = gmtime(&Now.time)) == NULL)
18 + return "Can't get the time";
19 + (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT",
20 + gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year,
21 + gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
22 if (HDR(_date) == NULL) {
23 - if ((gmt = gmtime(&Now.time)) == NULL)
24 - return "Can't get the time";
25 - (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT",
26 - gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year,
27 - gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
28 HDR(_date) = datebuff;
29 }
30 else {
31 @@ -480,6 +483,17 @@
32 /* NNTP-Posting host; set. */
33 HDR(_nntpposthost) = ClientHost;
34
35 + {
36 + static char xtracebuff[SMBUF];
37 +
38 + /* X-Trace; set. */
39 + if ((p = GetFQDN()) == NULL )
40 + p = "unknown";
41 + sprintf(xtracebuff, "%s %ld %ld %s (%s)",
42 + p, (long) time((time_t *)NULL), (long) getpid(), ClientIp, datebuff);
43 + HDR(_xtrace) = xtracebuff;
44 + }
45 +
46 /* Now make sure everything is there. */
47 for (hp = Table; hp < ENDOF(Table); hp++)
48 if (hp->Type == HTreq && hp->Value == NULL) {
49 --- inn-1.7.2.orig/nnrpd/nnrpd.c
50 +++ inn-1.7.2/nnrpd/nnrpd.c
51 @@ -436,6 +436,7 @@
52 #else
53 (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr));
54 #endif /* defined(DO_NNRP_GETHOSTBYADDR) */
55 + (void)strncpy(ClientIp, inet_ntoa(sin.sin_addr), sizeof(ClientIp));
56 }
57
58 strncpy (LogName,ClientHost,sizeof(LogName) - 1) ;
59 --- inn-1.7.2.orig/nnrpd/nnrpd.h
60 +++ inn-1.7.2/nnrpd/nnrpd.h
61 @@ -94,6 +94,7 @@
62 EXTERN STRING MyHostName;
63 extern char ACTIVE[];
64 EXTERN char ClientHost[SMBUF];
65 +EXTERN char ClientIp[40];
66 EXTERN char LogName[256] ;
67 extern char ACTIVETIMES[];
68 extern char HISTORY[];