Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit b4738826 authored by rswindell's avatar rswindell

Get rid of sbbs_t::syslog(). Stuff that isn't part of a terminal server session

(a bbs "call") shouldn't be going in those log files (data/logs/<date>.log)
anyway.
Also, truncate the node.log if there was no successful login. We don't
want all those failed login attempts and filtered IPs to clog up these
log files. All those same messages go to (the normal) syslog() output anyway.
parent 740e323f
......@@ -170,36 +170,6 @@ void sbbs_t::log(char *str)
logcol+=strlen(str);
}
bool sbbs_t::syslog(const char* code, const char *entry)
{
char fname[MAX_PATH+1];
char tmp[64];
FILE* fp;
struct tm tm;
now=time(NULL);
if(localtime_r(&now,&tm)==NULL)
return false;
safe_snprintf(fname, sizeof(fname), "%slogs/%2.2d%2.2d%2.2d.log"
,cfg.logs_dir
,tm.tm_mon+1
,tm.tm_mday
,TM_YEAR(tm.tm_year));
if((fp = fnopen(NULL, fname,O_WRONLY|O_APPEND|O_CREAT)) == NULL) {
lprintf(LOG_ERR,"!ERRROR %d opening/creating %s",errno,fname);
return false;
}
fprintf(fp, "%-2.2s %s %s%s%s"
,code
,hhmmtostr(&cfg,&tm,tmp)
,entry
,log_line_ending
,log_line_ending);
fclose(fp);
return true;
}
/****************************************************************************/
/* Writes 'str' on it's own line in node.log (using LOG_INFO level) */
/****************************************************************************/
......
......@@ -3574,7 +3574,7 @@ bool sbbs_t::init()
,mon[tm.tm_mon],tm.tm_mday,tm.tm_year+1900);
logline(LOG_NOTICE,"L!",str);
log(crlf);
catsyslog(1);
catsyslog(TRUE);
}
getnodedat(cfg.node_num,&thisnode,1);
......@@ -4435,8 +4435,10 @@ void node_thread(void* arg)
mswait(login_attempts*startup->login_attempt.throttle);
}
bool login_success = false;
if(sbbs->answer()) {
login_success = true;
listAddNodeData(&current_logins, sbbs->client.addr, strlen(sbbs->client.addr)+1, sbbs->cfg.node_num, LAST_NODE);
if(sbbs->qwklogon) {
sbbs->getsmsg(sbbs->useron.number);
......@@ -4556,7 +4558,12 @@ void node_thread(void* arg)
}
}
sbbs->catsyslog(0);
if(login_success)
sbbs->catsyslog(/* Crash: */FALSE);
else {
rewind(sbbs->logfile_fp);
chsize(fileno(sbbs->logfile_fp), 0);
}
status(STATUS_WFC);
......@@ -5464,8 +5471,6 @@ NO_SSH:
lprintf(LOG_NOTICE, "%04d %s !Maximum concurrent connections without login (%u) reached from host: %s"
,client_socket, client.protocol, startup->max_concurrent_connections, host_ip);
close_socket(client_socket);
SAFEPRINTF(logstr, "Too many concurrent connections without login from host: %s",host_ip);
sbbs->syslog("@!",logstr);
continue;
}
}
......@@ -5485,8 +5490,6 @@ NO_SSH:
} else
lprintf(LOG_NOTICE,"%04d %s !CLIENT BLOCKED in ip.can: %s", client_socket, client.protocol, host_ip);
close_socket(client_socket);
SAFEPRINTF(logstr, "Blocked IP: %s",host_ip);
sbbs->syslog("@!",logstr);
continue;
}
......@@ -5636,8 +5639,6 @@ NO_SSH:
close_socket(client_socket);
lprintf(LOG_NOTICE,"%04d %s !CLIENT BLOCKED in host.can: %s"
,client_socket, client.protocol, host_name);
SAFEPRINTF(logstr, "Blocked Hostname: %s",host_name);
sbbs->syslog("@!",logstr);
continue;
}
......
......@@ -928,7 +928,6 @@ public:
void logline(const char *code,const char *str); /* Writes 'str' on it's own line in log (LOG_INFO level) */
void logline(int level, const char *code,const char *str);
void logofflist(void); /* List of users logon activity */
bool syslog(const char* code, const char *entry);
bool errormsg_inside;
void errormsg(int line, const char* function, const char *source, const char* action, const char *object
,long access, const char *extinfo=NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment