else
decoded=cnv_getb64(received);
if (decoded!=(char *)0) {
- if (checklogin(contact,rmtpass,decoded)==true)
+ if (checklogin(contact,rmtpass,decoded)==true) {
+ contact->credits+=2;
contact->privilege=rel_authentic;
+ }
decoded=rou_freestr(decoded);
}
line=rou_freestr(line);
}
if (strlen(local)>0) {
- if (checklogin(contact,rmtpass,local)==true)
+ if (checklogin(contact,rmtpass,local)==true) {
+ contact->credits+=2;
contact->privilege=rel_authentic;
+ }
}
}
/*
(void) rou_alert(0,"%s Unable to get the hash response (Bug!)",OPEP);
break;
}
- if (strcmp(HA0,resp->response)==0)
+ if (strcmp(HA0,resp->response)==0) {
+ contact->credits+=3; //very good authentication
contact->privilege=rel_authentic;
+ }
HA0=rou_freestr(HA0);
}
break;
break;
case rel_plain :
cmt="No relay accepted";
+ contact->credits-=2; //Trying to abuse server
phase=999; //not relayable
break;
default :
status=-3;
break;
}
- (void) log_fprintlog(contact->logptr,true,"Contact terminated; "
- "condition=<%s>",str);
+ (void) log_fprintlog(contact->logptr,true,"Contact terminated (credit='%d'); "
+ "condition=<%s>",
+ contact->credits,str);
//(void) rou_alert(0,"%s exit status='%d'",OPEP,status);
break; //no need to go further
case c_quit : //QUIT SMTP protocol
(void) transmit(contact,true,"%d 2.0.0 Bye, closing connection CNT=%s",
QUITOK,contact->mainsesid);
+ contact->credits++; //clean disconnect
status=1; //every thing fine
proceed=false;
break;
}
break;
case c_unknown : //unknown keyword
+ contact->credits-=2; //Trying to confuse server?
(void) rou_alert(0,"SMTP Command <%s> from [%s] is unknown (config?)",
line,contact->peerip);
(void) transmit(contact,true,"%d-5.5.1 Unrecognized command, see RFC 5321",
CMDBAD,contact->mainsesid);
break;
default :
+ contact->credits-=10; //Trying to bug server
(void) rou_alert(0,"%s Unable to find entry for code='%d' (Bug?)",OPEP,code);
(void) transmit(contact,true,"%d-5.5.1 Unrecognized command, see RFC 5321",
CMDBAD);
case 1 : //connecting to database
contact=(CONTYP *)calloc(1,sizeof(CONTYP));
contact->sqlptr=sql_opensql();
+ contact->credits=0;
if (contact->sqlptr==(SQLPTR *)0) {
(void) rou_alert(0,"%s Unable to contact database",OPEP);
(void) sleep(2);//delay to avoid avalanche
}
break;
case 6 : //checking if remote IP is relayable
- if (afn_is_ip_relayable(contact->peerip,contact->relayok)==true)
+ if (afn_is_ip_relayable(contact->peerip,contact->relayok)==true) {
contact->privilege=rel_isrelay; //IP is relayable
+ contact->credits++;
+ }
break;
case 7 : //contact is good, then sending a signon
(void) log_fprintlog(contact->logptr,true,"Start CNT=%s",contact->mainsesid);