*/
/********************************************************/
/* */
+/* checking if local recipient is acceptable. */
+/* */
+/********************************************************/
+static _Bool is_user_good(CONTYP *contact,RCPTYP *user)
+
+{
+_Bool isok;
+int phase;
+_Bool proceed;
+
+isok=true;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ switch (phase) {
+ case 0 : //is user a local user
+ if (user->code!='L')
+ phase=999; //User is Not local
+ break;
+ case 1 : //is user existing within database
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+return isok;
+}
+/*
+^L
+*/
+/********************************************************/
+/* */
/* Procedure to check if helo or ehlo paratmeter */
/* is a correct one */
/* */
switch (phase) {
case 0 : //do we have a mailfrom
if ((contact->mailfrom==(char *)0)||(strlen(contact->mailfrom)==0)) {
- (void) transmit(contact,true,"%d Bad sequence of commands.",BADSEQ);
+ (void) transmit(contact,true,"%d 5.6.0 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,true,"%d 5.6.0 recipient not specified",BADPAR);
+ (void) transmit(contact,true,"%d 5.6.1 recipient not specified",BADPAR);
phase=999; //no need to go further
}
break;
case 2 : //check rcpt format
if ((rcptto[0]!='<')||(rcptto[strlen(rcptto)-1]!='>')) {
- (void) transmit(contact,true,"%d 5.6.1 '%s' bad Format error",
+ (void) transmit(contact,true,"%d 5.6.2 '%s' bad Format error",
BADPAR,rcptto);
phase=999; //no need to go further
}
case 3 : //checking rcptto format
neu=eml_isemailok(rcptto,&report);
if (neu==(RCPTYP *)0) {
- (void) transmit(contact,true,"%d 5.6.2 %s",NOTEML,report);
+ (void) transmit(contact,true,"%d 5.6.3 %s",NOTEML,report);
report=rou_freestr(report);
phase=999; //no need to go further
}
break;
case 4 : //Do we have a domain MX
if (setlocdom(contact,neu)==false) {
- (void) transmit(contact,true,"%d 5.6.3 %s (domain=%s)",
+ (void) transmit(contact,true,"%d 5.6.4 %s (domain=%s)",
MISSMX,
"No valid MX found for recipient domain name",
neu->domain);
phase=999; //no need to go further
}
break;
- case 5 : //Storing rcpt to
+ case 5 : //if the user is acceptable
+ if (is_user_good(contact,neu)==false) {
+ neu=eml_freerecipient(neu);
+ phase=999;
+ }
+ break;
+ case 6 : //Storing rcpt to
if (eml_addrecipient(&(contact->recipients),neu)==false) {
detail="duplicate recipients will be consolidated";
neu=eml_freerecipient(neu);
}
break;
- case 6 : //everything ok
+ case 7 : //everything ok
(void) transmit(contact,true,"%d 2.6.4 %s <%s>",CMDOK,detail,rcptto);
success=true;
break;