I'm trying to trace down the source of my "memory corrupt"'s from mmaloc, and I noticed that most of them were after a post. So I was polking around post.c, and altough I didn't find anything wrong, did fix a few minor nits. There also a local "feature" you might find useful. If the post_cfg linked list was getting free'd someplace, I couldn't find it. I wrote a little sub to do it, and called it in the appropriate place. There is some added code that will prevent certain header from being supplied by the user. This is strictly a local preference, set it as you require. Surpressing things like "Path:" is to be done with care. If no newsgroups were in the message, the message wasn't getting free'd before exiting. These (except for the header supression) aren't well tested, you might just stuff them away for future use. *** ../nntpcache-1.0.7.1-stat2-REF/post.c Fri Aug 29 03:15:16 1997 --- post.c Mon Sep 15 19:18:00 1997 *************** *** 22,27 **** --- 34,51 ---- return s; } + #ifndef ORIG + free_post_cfg(struct server_cfg *post_cfg) { + struct server_cfg *free_cfg; + while (post_cfg) { + free_cfg = post_cfg; + post_cfg = post_cfg->next; + free(free_cfg); + } + } + #endif + + X (bool CMDpost ()) { char messageid[MAX_MSGID] = ""; *************** *** 68,73 **** --- 101,119 ---- sprintf (bfr, "Organization: %.127s\r\n", con.Organization); f_have_organization = TRUE; } + #ifndef ORIG + else if (strnCaseEq (bfr, "Cache-Post-Path:", 16)) + continue; + else if (strnCaseEq (bfr, "Path:", 5)) + continue; + else if (strnCaseEq (bfr, "Date:", 5)) + continue; + else if (strnCaseEq (bfr, "X-trace", 7)) + continue; + else if (strnCaseEq (bfr, "X-Complaints-To", 15)) + continue; + #endif + } msg = strListAdd (msg, bfr); } *************** *** 82,87 **** --- 128,137 ---- { emitf ("%d No newsgroups specified.\r\n", NNTP_POSTFAIL_VAL); Stats->posts_failed++; + #ifndef ORIG + if (msg) + strListFree (msg); + #endif return FALSE; } for (post_cfg = NULL, group = strtok (newsgroups, ","); group; group = strtok (NULL, ",")) *************** *** 174,179 **** --- 235,243 ---- } } strListFree (msg); + #ifndef ORIG + free_post_cfg(post_head); + #endif if (posted) { emitrn (NNTP_POSTEDOK);