#include "geseml.h"
#include "lvleml.h"
+#define RELAYS "RELAYABLE"
/*
^L
*/
contact->peername,contact->peerip,contact->mailfrom);
break;
case 1 : //Inserting the Receive information
- if (contact->authenticated==true)
+ if (contact->privilege==rel_authentic)
esmtp="ESMTPA";
(void) fprintf(data,"\tby %s ([%s:%s]/%s-%s) with %s\n",
contact->locname,
else
decoded=cnv_getb64(received);
if (decoded!=(char *)0) {
- contact->authenticated=checklogin(contact,rmtpass,decoded);
+ if (checklogin(contact,rmtpass,decoded)==true)
+ contact->privilege=rel_authentic;
decoded=rou_freestr(decoded);
}
}
line=rou_freestr(line);
}
-if (strlen(local)>0)
- contact->authenticated=checklogin(contact,rmtpass,local);
+if (strlen(local)>0) {
+ if (checklogin(contact,rmtpass,local)==true)
+ contact->privilege=rel_authentic;
+ }
}
/*
^L
(void) rou_alert(0,"%s Unable to get the hash response (Bug!)",OPEP);
break;
}
- contact->authenticated=(strcmp(HA0,resp->response)==0);
+ if (strcmp(HA0,resp->response)==0)
+ contact->privilege=rel_authentic;
HA0=rou_freestr(HA0);
}
break;
fmt=" Auth accepted for user=<%s>";
auth=contact->authname;
- if (contact->authenticated==false) {
+ if (contact->privilege!=rel_authentic) {
fmt=" Auth Rejected status='%d' for user=<%s> pass=<%s>";
(void) log_fprintlog(contact->logptr,true,fmt,BADAUTH,auth,rmtpass);
(void) sleep(2);
phase++;
}
rmtpass=rou_freestr(rmtpass);
-return contact->authenticated;
+return (contact->privilege==rel_authentic);
#undef OPEP
}
/*
static _Bool checkfrom(CONTYP *contact,char *mailfrom)
{
+#define OPEP "lvleml.c:checkfrom,"
+
_Bool success;
_Bool proceed;
int status;
(void) memmove(mailfrom,mailfrom+1,strlen(mailfrom));
break;
case 3 : //check if contact authenticated
- if (contact->authenticated==true)
- phase++; //No need to check remote "credits
- break;
- case 4 : //check remote credit
- if ((status=checkcredit(contact))!=CMDOK) {
- (void) transmit(contact,true,"%d 5.5.3 Closing connection",status);
- phase=999; //bad credit not need to go further
+ switch (contact->privilege) {
+ case rel_authentic : //User was authenticated
+ break;
+ case rel_isrelay : //Remote IP is relay
+ break;
+ case rel_plain :
+ if ((status=checkcredit(contact))!=CMDOK) {
+ (void) transmit(contact,true,"%d 5.5.3 Closing connection",status);
+ phase=999; //bad credit not need to go further
+ }
+ break;
+ default :
+ (void) rou_alert(0,"%s unexpected priviliged='%d' (Bug?)",
+ OPEP,contact->privilege);
+ (void) transmit(contact,true,"%d 5.5.3 Closing connection",FAILED);
+ phase=999; //bad credit not need to go further
+ break;
}
break;
- case 5 : //everything ok
+ case 4 : //everything ok
contact->mailfrom=strdup(mailfrom);
(void) transmit(contact,true,"%d 2.1.3 %s.. sender ok",
CMDOK,contact->mailfrom);
phase++;
}
return success;
+
+#undef OPEP
}
/*
\f
}
break;
case 2 : //loading the relayable IP list
- contact->relayok=eml_load_relayed(getenv("RELAYABLE"));
+ contact->relayok=eml_load_relayed(getenv(RELAYS));
break;
case 3 : //waiting from contact
if ((contact->socptr=soc_accept(socptr,pos))==(SOCPTR *)0) {
case 4 : //Preparing contact
contact->mainsesid=eml_getmainsesid();
contact->delay=MXDELAY;
+ contact->privilege=rel_plain; //Standard connection
if (debug>1)
contact->delay/=10; //30 sec in debug mode
(void) getsessid(contact);