]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Staring to implement local user existing implementation
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 25 Jun 2025 09:54:36 +0000 (05:54 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Wed, 25 Jun 2025 09:54:36 +0000 (05:54 -0400)
lib/lvleml.c

index 43bbbb4370c50515b237d390d6aecdf879b03884..80a1e348b079743ddd356643b2b8b18190f61c0b 100644 (file)
@@ -261,6 +261,40 @@ return status;
 */
 /********************************************************/
 /*                                                      */
+/*     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                                */
 /*                                                      */
@@ -744,19 +778,19 @@ while (proceed==true) {
   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
         }
@@ -766,14 +800,14 @@ while (proceed==true) {
     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);
@@ -781,13 +815,19 @@ while (proceed==true) {
         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;