/* mode, return "decoded", NULL if not extracted */
/* */
/********************************************************/
-static char *get_auth_plain(CONTYP *contact,int delay,char *received)
+static char *get_auth_plain(CONTYP *contact,char *received)
{
#define OPEP "lvleml.c:get_auth_plain,"
line=(char *)0;
(void) transmit(contact,true,"%d 5.7.1 Please provide auth sequence",SENDB64);
- got=tcp_getline(contact->socptr,delay,&line);
+ got=tcp_getline(contact->socptr,contact->delay,&line);
if (got>0) {
(void) log_fprintlog(contact->logptr,false,"%s",line);
decoded=cnv_getb64(line);
/* the exchange with the remote sereur */
/* */
/********************************************************/
-static char *get_auth_cram_md5(CONTYP *contact,int delay)
+static char *get_auth_cram_md5(CONTYP *contact)
{
#define OPEP "lvleml.c:get_auth_cram_md5,"
case 2 : { //getting the challenge answer
char *line;
- if (tcp_getline(contact->socptr,delay,&line)>0) {
+ if (tcp_getline(contact->socptr,contact->delay,&line)>0) {
char *res;
res=cnv_getb64(line);
/* */
/* */
/********************************************************/
-static char *get_auth_digest_md5(CONTYP *contact,int delay)
+static char *get_auth_digest_md5(CONTYP *contact)
{
#define OPEP "lvleml.c:get_auth_digest_md5,"
case 2 : { //getting the challenge answer
char *line;
- if (tcp_getline(contact->socptr,delay,&line)>0) {
+ if (tcp_getline(contact->socptr,contact->delay,&line)>0) {
//if a clear text QUIT is received because of deep trouble
if (strcasecmp(line,"QUIT")!=0) {
char *res;
int count;
line=(char *)0;
- count=tcp_getline(contact->socptr,delay,&line);
+ count=tcp_getline(contact->socptr,contact->delay,&line);
if (count<0)
(void) rou_alert(0,"%s delay expired to get remote empty line (network?)",
OPEP);
/* mode, return "decoded", NULL if not extracted */
/* */
/********************************************************/
-static char *get_auth_login(CONTYP *contact,int delay)
+static char *get_auth_login(CONTYP *contact)
{
static char *logdat[]={"VXNlcm5hbWU6", //Username: in B64
(void) strcat(local,IOBNULL);
(void) transmit(contact,true,"%d %s",SENDB64,logdat[i]);
- got=tcp_getline(contact->socptr,delay,&line);
+ got=tcp_getline(contact->socptr,contact->delay,&line);
if (got<=0) {
(void) strcpy(local,"");
(void) transmit(contact,true,"%d 5.7.2 auth sequence missing",UKNUSER);
/* NULL if unable to extract login */
/* */
/********************************************************/
-static _Bool getauth(CONTYP *contact,int delay,char *buffer)
+static _Bool getauth(CONTYP *contact,char *buffer)
{
#define OPEP "lvleml.c:getauth,"
switch (code) {
case 0 : //AUTH PLAIN
if (soc_iscrypted(contact->socptr)==true)
- decoded=get_auth_plain(contact,delay,local);
+ decoded=get_auth_plain(contact,local);
else
(void) transmit(contact,true,"%d 5.7.3 Unsafe PLAIN auth mode",FAILED);
break;
case 1 : //AUTH LOGIN
if (soc_iscrypted(contact->socptr)==true)
- decoded=get_auth_login(contact,delay);
+ decoded=get_auth_login(contact);
else
(void) transmit(contact,true,"%d 5.7.3 Unsafe LOGIN auth mode",FAILED);
break;
case 2 : //AUTH CRAM-MD5
- decoded=get_auth_cram_md5(contact,delay);
+ decoded=get_auth_cram_md5(contact);
break;
case 3 : //AUTH DIGEST-MD5
- decoded=get_auth_digest_md5(contact,delay);
+ decoded=get_auth_digest_md5(contact);
break;
default : //not yet implemented
(void) transmit(contact,true,"%d 5.7.3 Unknown auth mode",FAILED);
int status;
int got;
-int delay;
-int penalty;
+int penalty; //answer time penalty, in case of wrong auth
_Bool proceed;
status=1;
got=0;
-delay=300; //5 minutes standard delay
penalty=1;
-if (debug>1)
- delay/=10; //30 sec in debug mode
proceed=true;
(void) signon(contact);
while (proceed==true) {
CODTYP code;
line=(char *)0;
- got=tcp_getline(contact->socptr,delay,&line);
+ got=tcp_getline(contact->socptr,contact->delay,&line);
if (got<=0) { //timeout or trouble?
char str[100];
switch (got) {
case 0 : //timeout
- (void) snprintf(str,sizeof(str),"No data from remote within %d sec",delay);
+ (void) snprintf(str,sizeof(str),"No data from remote within %d sec",
+ contact->delay);
break;
case -1 : //signal received
(void) snprintf(str,sizeof(str),"Signal Received");
(void) checkfrom(contact,line);
break;
case c_auth : //Auth request
- if (getauth(contact,delay,line)==false)
+ if (getauth(contact,line)==false)
proceed=false; //Authentication failed
break;
case c_rcpt : //Doing rpt scanning
#define OPEP "lvleml.c:eml_getcontact"
#define MXCARIN 200 //maximun number of char
//within carpile
+#define MXDELAY 300 //maximun waiting time 5 minutes standard delay
CONTYP *contact;
int phase;
break;
case 3 : //Preparing contact
contact->mainsesid=eml_getmainsesid();
+ contact->delay=MXDELAY;
+ if (debug>1)
+ contact->delay/=10; //30 sec in debug mode
(void) getsessid(contact);
contact->locname=soc_getaddrinfo(contact->socptr,true,true);
contact->locip=soc_getaddrinfo(contact->socptr,true,false);