fix a couple core dumps in nnrpd
Richard Todd
rmtodd at ichotolot.servalan.com
Tue Feb 22 06:00:52 UTC 2000
This fixes a couple of core dumps from some of the recently introduced
PERMaccessconf code.
1) in main(), there was a call to InitBackoffConstants(), which looks up
the backoff params in the PERMaccessconf struct. However, if the user is
in a readers.conf scheme that requires AUTHINFO authentication, since the
AUTHINFO commands haven't been seen yet, authentication is not complete,
so PERMaccessconf is NULL. I fixed this by moving the init to the code
that handles the POST command, figuring that nothing else cares about the
backoff settings and the user can't get thru POST until he's authenticated.
2) In ExitWithStats, if authentication never happened (e.g. because this
connection was one of the many random losers scanning for open nntp
servers), the code tries to use PERMaccessconf->readertrack to see if
it should do readertrack stuff. But of course since no successfull auth
occured, PERMaccessconf is NULL.
Index: nnrpd/commands.c
===================================================================
RCS file: /home/rmtodd/TempCVS/Temp-CVS-Repository/inn-current/nnrpd/commands.c,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 commands.c
--- commands.c 2000/02/18 05:04:28 1.1.1.11
+++ commands.c 2000/02/19 06:58:31
@@ -722,11 +722,19 @@
char *path;
STRING response;
char idbuff[SMBUF];
+ static int backoff_inited = FALSE;
+
if (!PERMcanpost) {
syslog(L_NOTICE, "%s noperm post without permission", ClientHost);
Reply("%s\r\n", NNTP_CANTPOST);
return;
+ }
+
+ if (!backoff_inited) {
+ /* Exponential posting backoff */
+ (void)InitBackoffConstants();
+ backoff_inited = TRUE;
}
/* Dave's posting limiter - Limit postings to a certain rate
Index: nnrpd/nnrpd.c
===================================================================
RCS file: /home/rmtodd/TempCVS/Temp-CVS-Repository/inn-current/nnrpd/nnrpd.c,v
retrieving revision 1.1.1.18
diff -u -r1.1.1.18 nnrpd.c
--- nnrpd.c 2000/02/18 05:04:30 1.1.1.18
+++ nnrpd.c 2000/02/22 05:51:59
@@ -177,7 +177,7 @@
ClientHost, usertime, systime, STATfinish - STATstart);
/* Tracking code - Make entries in the logfile(s) to show that we have
finished with this session */
- if (!readconf && PERMaccessconf->readertrack) {
+ if (!readconf && PERMaccessconf && PERMaccessconf->readertrack) {
syslog(L_NOTICE, "%s Tracking Disabled (%s)", ClientHost, Username);
if (LLOGenable) {
fprintf(locallog, "%s Tracking Disabled (%s)\n", ClientHost, Username);
@@ -955,9 +955,6 @@
PERMcanpost ? "posting ok" : "no posting");
clienttimeout = innconf->clienttimeout;
}
-
- /* Exponential posting backoff */
- (void)InitBackoffConstants();
/* Main dispatch loop. */
for (timeout = INITIAL_TIMEOUT, av = NULL; ;
More information about the inn-patches
mailing list