Removed debug logging for checking WWW/FTP downloads

This commit is contained in:
Michiel Broek 2007-08-27 18:18:00 +00:00
parent 4575e09351
commit 8adc6a0897
2 changed files with 7 additions and 13 deletions

View File

@ -36,6 +36,9 @@ v0.91.10 21-Aug-2007
mbdiff: mbdiff:
Fixed a lot of compiler warnings. Fixed a lot of compiler warnings.
mball:
Removed debug logging for checking WWW/FTP downloads.
mbsebbs: mbsebbs:
Fixed a lot of compiler warnings. Fixed a lot of compiler warnings.
Fixed compiling on NetBSD 3.1. Fixed compiling on NetBSD 3.1.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Count WWW and FTP downloads * Purpose ...............: Count WWW and FTP downloads
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -100,13 +100,12 @@ void dlcount(void)
* Parse logline, be aware for lots of garbage created by systems * Parse logline, be aware for lots of garbage created by systems
* that try to compromise the webserver. * that try to compromise the webserver.
*/ */
Syslog('f', "%s", printable(temp, 100)); // Syslog('f', "%s", printable(temp, 100));
p = strchr(temp, '['); p = strchr(temp, '[');
if (p) { if (p) {
q = strchr(p, ']'); q = strchr(p, ']');
if (q && ((q-p) < 40)) { if (q && ((q-p) < 40)) {
strncpy(date, p+1, q - p - 1); strncpy(date, p+1, q - p - 1);
// Syslog('f', "\"%s\"", date);
tm.tm_mday = atoi(strtok(date, "/\0")); tm.tm_mday = atoi(strtok(date, "/\0"));
snprintf(month, 20, "%s", strtok(NULL, "/\0")); snprintf(month, 20, "%s", strtok(NULL, "/\0"));
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
@ -117,9 +116,7 @@ void dlcount(void)
tm.tm_hour = atoi(strtok(NULL, ":\0")); tm.tm_hour = atoi(strtok(NULL, ":\0"));
tm.tm_min = atoi(strtok(NULL, ":\0")); tm.tm_min = atoi(strtok(NULL, ":\0"));
tm.tm_sec = atoi(strtok(NULL, ":\0")); tm.tm_sec = atoi(strtok(NULL, ":\0"));
// Syslog('f', "%d %d %d %d %d %d", tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec);
filedate = mktime(&tm); filedate = mktime(&tm);
// Syslog('f', "%s", rfcdate(filedate));
if (filedate > lastcheck) if (filedate > lastcheck)
date_ok = TRUE; date_ok = TRUE;
} }
@ -128,7 +125,6 @@ void dlcount(void)
q = strchr(p+1, '"'); q = strchr(p+1, '"');
if (q && ((q-p) < 128)) { if (q && ((q-p) < 128)) {
strncpy(file, p+1, q - p - 1); strncpy(file, p+1, q - p - 1);
// Syslog('f', "\"%s\"", file);
if (strncmp(file, "GET ", 4) == 0) { if (strncmp(file, "GET ", 4) == 0) {
if ((p = strstr(file, CFG.www_link2ftp))) { if ((p = strstr(file, CFG.www_link2ftp))) {
snprintf(base, PATH_MAX, "%s%s", CFG.ftp_base, p + strlen(CFG.www_link2ftp)); snprintf(base, PATH_MAX, "%s%s", CFG.ftp_base, p + strlen(CFG.www_link2ftp));
@ -138,7 +134,6 @@ void dlcount(void)
break; break;
} }
} }
// Syslog('f', "%s", base);
file_ok = TRUE; file_ok = TRUE;
} }
} }
@ -164,7 +159,7 @@ void dlcount(void)
if (strlen(CFG.ftp_logfile) && (fp = fopen(CFG.ftp_logfile, "r"))) { if (strlen(CFG.ftp_logfile) && (fp = fopen(CFG.ftp_logfile, "r"))) {
/* /*
* Check apache logfile * Check ftp logfile
*/ */
if (!do_quiet) if (!do_quiet)
printf("Checking FTP downloads\n"); printf("Checking FTP downloads\n");
@ -180,7 +175,7 @@ void dlcount(void)
/* /*
* Parse logline. * Parse logline.
*/ */
Syslog('f', "%s", printable(temp, 100)); // Syslog('f', "%s", printable(temp, 100));
p = strtok(temp, " \0"); /* Day of week */ p = strtok(temp, " \0"); /* Day of week */
p = strtok(NULL, " \0"); /* Month */ p = strtok(NULL, " \0"); /* Month */
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
@ -192,9 +187,7 @@ void dlcount(void)
tm.tm_min = atoi(strtok(NULL, ":\0")); /* Minute */ tm.tm_min = atoi(strtok(NULL, ":\0")); /* Minute */
tm.tm_sec = atoi(strtok(NULL, " \0")); /* Seconds */ tm.tm_sec = atoi(strtok(NULL, " \0")); /* Seconds */
tm.tm_year = atoi(strtok(NULL, " \0")) - 1900; /* Year */ tm.tm_year = atoi(strtok(NULL, " \0")) - 1900; /* Year */
// Syslog('f', "%d %d %d %d %d %d", tm.tm_mday, tm.tm_mon, tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec);
filedate = mktime(&tm); filedate = mktime(&tm);
// Syslog('f', "%s", rfcdate(filedate));
if (filedate > lastcheck) if (filedate > lastcheck)
date_ok = TRUE; date_ok = TRUE;
p = strtok(NULL, " \0"); /* 0 */ p = strtok(NULL, " \0"); /* 0 */
@ -247,14 +240,12 @@ void count_download(char *filename, time_t filedate, off_t filesize, char *dltyp
temp[j] = '\0'; temp[j] = '\0';
break; break;
} }
// Syslog('f', "%s", temp);
i = 0; i = 0;
while (fread(&area, areahdr.recsize, 1, dfp) == 1) { while (fread(&area, areahdr.recsize, 1, dfp) == 1) {
i++; i++;
if (area.Available && (strcmp(temp, area.Path) == 0)) { if (area.Available && (strcmp(temp, area.Path) == 0)) {
snprintf(temp, PATH_MAX, "%s", basename(filename)); snprintf(temp, PATH_MAX, "%s", basename(filename));
// Syslog('f', "Download area %d %s", i, temp);
if ((fdb_area = mbsedb_OpenFDB(i, 30))) { if ((fdb_area = mbsedb_OpenFDB(i, 30))) {
while (fread(&frec, fdbhdr.recsize, 1, fdb_area->fp) == 1) { while (fread(&frec, fdbhdr.recsize, 1, fdb_area->fp) == 1) {