while (proceed==true) {
//(void) rou_alert(0,"JMPDBG %s phase='%d' rcptto=<%s>",OPEP,phase,rcptto);
switch (phase) {
- case 0 : //do we have an originator
+ case 0 : //do we have a mailfrom
+ if ((contact->mailfrom==(char *)0)||(strlen(contact->mailfrom)==0)) {
+ (void) transmit(contact,"%d Bad sequence of commands.",BADSEQ);
+ phase=999; //no need to go further
+ }
+ break;
+ case 1 : //do we have an originator
if ((rcptto==(char *)0)||(strlen(rcptto)==0)) {
- (void) transmit(contact,"%d 5.6.0 <%s> recipient not specified",
- BADPAR,rcptto);
+ (void) transmit(contact,"%d 5.6.0 recipient not specified",BADPAR);
phase=999; //no need to go further
}
break;
- case 1 : //check rcpt format
+ case 2 : //check rcpt format
if ((rcptto[0]!='<')||(rcptto[strlen(rcptto)-1]!='>')) {
(void) transmit(contact,"%d 5.6.1 '%s' bad Format error",
BADPAR,rcptto);
rcptto[strlen(rcptto)-1]='\000';
(void) memmove(rcptto,rcptto+1,strlen(rcptto));
break;
- case 2 : //checking rcptto format
+ case 3 : //checking rcptto format
neu=eml_isemailok(rcptto,&report);
if (neu==(RCPTYP *)0) {
(void) transmit(contact,"%d 5.6.2 %s",NOTEML,report);
phase=999; //no need to go further
}
break;
- case 3 : //Do we have a domain MX
+ case 4 : //Do we have a domain MX
if (setlocdom(contact,neu)==false) {
(void) transmit(contact,"%d 5.6.3 %s (domain=%s)",
MISSMX,
phase=999; //no need to go further
}
break;
- case 4 : //Storing rcpt to
+ case 5 : //Storing rcpt to
if (eml_addrecipient(&(contact->recipients),neu)==false) {
detail="duplicate recipients will be consolidated";
neu=eml_freerecipient(neu);
}
break;
- case 5 : //everything ok
+ case 6 : //everything ok
(void) transmit(contact,"%d 2.6.4 %s",CMDOK,detail);
success=true;
break;
{
if (debug>=dlevel)
{
+ char lvl[10];
char strloc[10000];
+ (void) snprintf(lvl,sizeof(lvl),"(dl=%02d) ",dlevel);
(void) memset(strloc,'\000',sizeof(strloc));
(void) vsnprintf(strloc,sizeof(strloc)-1,fmt,ap);
if (foreground==true)
- (void) fprintf(stderr,"%s\n",strloc);
+ (void) fprintf(stderr,"%s%s\n",lvl,strloc);
else {
char *ptr;
- char lvl[10];
-
ptr=strloc;
- (void) snprintf(lvl,sizeof(lvl),"(dl=%02d) ",dlevel);
while (strlen(ptr)>DEBMAX) {
char locline[DEBMAX+10];