mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 17:30:12 +01:00
Fixed using the lasttime smtp session variable
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
380fef7489
commit
936f27c7a5
@ -86,12 +86,14 @@ void check_for_client_timeout(){
|
|||||||
time_t now;
|
time_t now;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(num_connections > 0){
|
|
||||||
time(&now);
|
time(&now);
|
||||||
|
|
||||||
|
if(cfg.verbosity >= LOG_DEBUG) syslog(LOG_PRIORITY, "%s @%ld", __func__, now);
|
||||||
|
|
||||||
|
if(num_connections > 0){
|
||||||
for(i=0; i<cfg.max_connections; i++){
|
for(i=0; i<cfg.max_connections; i++){
|
||||||
if(sessions[i] && now - sessions[i]->lasttime >= cfg.smtp_timeout){
|
if(sessions[i] && now - sessions[i]->lasttime >= cfg.smtp_timeout){
|
||||||
syslog(LOG_PRIORITY, "client %s timeout", sessions[i]->remote_host);
|
syslog(LOG_PRIORITY, "client %s timeout, lasttime: %ld", sessions[i]->remote_host, sessions[i]->lasttime);
|
||||||
tear_down_session(sessions, sessions[i]->slot, &num_connections);
|
tear_down_session(sessions, sessions[i]->slot, &num_connections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,9 @@ void handle_data(struct smtp_session *session, char *readbuf, int readlen, struc
|
|||||||
p += puflen;
|
p += puflen;
|
||||||
|
|
||||||
if(puflen > 0){
|
if(puflen > 0){
|
||||||
|
// Update lasttime if we have a line to process
|
||||||
|
time(&(session->lasttime));
|
||||||
|
|
||||||
// pass the puffer to process_data() only if there was an '\n'
|
// pass the puffer to process_data() only if there was an '\n'
|
||||||
// on the line or the puffer does not start with a period
|
// on the line or the puffer does not start with a period
|
||||||
if(session->protocol_state == SMTP_STATE_DATA && (rc == OK || puf[0] != '.')){
|
if(session->protocol_state == SMTP_STATE_DATA && (rc == OK || puf[0] != '.')){
|
||||||
|
Loading…
Reference in New Issue
Block a user