]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Adjusted spec file
authorJean-Marc Pigeon <jmp@safe.c>
Thu, 13 Nov 2025 14:52:00 +0000 (09:52 -0500)
committerJean-Marc Pigeon <jmp@safe.c>
Thu, 13 Nov 2025 14:52:00 +0000 (09:52 -0500)
lib/lvleml.c
lib/lvleml.h
mailleur.spec.in

index 3a29fb72f58c2ccb6ae5a9af30c9ddf373d1c8f7..a5296eef43f015553f99452ae0ab676f5965b6c7 100644 (file)
@@ -1067,7 +1067,7 @@ return remotegood;
 */
 /********************************************************/
 /*                                                      */
-/*     Procedure to check if helo or ehlo paratmeter   */
+/*     Procedure to check if helo or ehlo parameter    */
 /*      is a correct one                                */
 /*                                                      */
 /********************************************************/
@@ -1086,62 +1086,102 @@ proceed=true;
 while (proceed==true) {
   //(void) rou_alert(0,"JMPDBG %s phase='%d' parm=<%s>",OPEP,phase,parameter);
   switch (phase) {
-    case 0      :       //checking if we have a parameter
-      if ((parameter==(char *)0)||(strlen(parameter)==0)) {
-        (void) rou_alert(0,"%s sesid=<%s> fqdn is missing!",
-                            OPEP,contact->mainsesid);
-        phase=999;      //no parameter
-        }
-      break;
-    case 1      :       //do we have only good character
-      if (strpbrk(parameter,"@(&$")!=(char *)0) {
-        (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> wrong contents",
-                           OPEP,contact->mainsesid,parameter);
-        phase=999;      //bad parameter
-        }
-      break;
-    case 2      :       //do we start with a dot or 2 dot
+    case 0      :       //do we start with a dot or 2 dot
       if ((parameter[0]=='.')||(strstr(parameter,"..")!=(char *)0)) {
         (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> not a good domain",
                            OPEP,contact->mainsesid,parameter);
         phase=999;      //bad parameter
         }
       break;
-    case 3      :       //could it be localhost or localdomain
+    case 1      :       //could it be localhost or localdomain
       if (strcasecmp(parameter,"localhost.localdomain")==0) {
         (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> local!",
                            OPEP,contact->mainsesid,parameter);
         phase=999;
         }
       break;
-    case 4      :       //check if it only a hostname
+    case 2      :       //check if it only a hostname
       if (strstr(parameter,".")==(char *)0) {
         (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> is an host name!",
                            OPEP,contact->mainsesid,parameter);
         phase=999;
         }
       break;
-    case 5      :       //could it be an IP
+    case 3      :       //could it be an IP
       if (parameter[0]=='[') {
         (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> could be an ip",
                            OPEP,contact->mainsesid,parameter);
         phase=999;      //bad parameter
         }
       break;
-    case 6      :       //is is an ip
+    case 4      :       //is is an ip
       if (strlen(parameter)==strspn(parameter,".0123456789")) {
         (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> is an ip",
                            OPEP,contact->mainsesid,parameter);
         phase=999;      //bad parameter
         }
       break;
-    case 7      :       //seems to be a good fqdn
+    case 5      :       //seems to be a good fqdn
       char *ptr;
 
       ptr=contact->fqdn;        //parameter could be the SAME!
       contact->fqdn=strdup(parameter);
       ptr=rou_freestr(ptr);
-      done=true; 
+      break;
+    case 6      :       //check if we can resolve fqdn
+      break;
+    case 7      :       //is resolved IP is the same as remote
+      break;
+    default     :       //SAFE guard
+      proceed=false;
+      break;
+    }
+  phase++;
+  }
+return done;
+#undef  OPEP
+}
+/*
+^L
+*/
+/********************************************************/
+/*                                                      */
+/*     Procedure to check if helo or ehlo paatmeter    */
+/*      is an acceptable one                            */
+/*                                                      */
+/********************************************************/
+static _Bool isgoodhelo(CONTYP *contact,char *parameter)
+
+{
+#define        OPEP    "lvleml.c:isgoodhelo"
+
+_Bool done;
+int phase;
+_Bool proceed;
+
+done=false;
+phase=0;
+proceed=true;
+while (proceed==true) {
+  //(void) rou_alert(0,"JMPDBG %s phase='%d' parm=<%s>",OPEP,phase,parameter);
+  switch (phase) {
+    case 0      :       //checking if we have a parameter
+      if ((parameter==(char *)0)||(strlen(parameter)==0)) {
+        (void) rou_alert(0,"%s sesid=<%s> fqdn is missing!",
+                            OPEP,contact->mainsesid);
+        phase=999;      //no parameter
+        }
+      break;
+    case 1      :       //do we have only good character
+      if (strpbrk(parameter,"@(&$")!=(char *)0) {
+        (void) rou_alert(0,"%s sesid=<%s> fqdn <%s> wrong contents",
+                           OPEP,contact->mainsesid,parameter);
+        phase=999;      //bad parameter
+        }
+      break;
+    case 2      :       //ehlo is acceptable, lets check if fqdn
+      done=true;
+      contact->isgoodfqdn=isgoodfqdn(contact,parameter);
       break;
     default     :       //SAFE guard
       proceed=false;
@@ -1448,7 +1488,7 @@ static _Bool dohelo(CONTYP *contact,char *parameter)
 
 _Bool done;
 
-if ((done=isgoodfqdn(contact,parameter))==false) {
+if ((done=isgoodhelo(contact,parameter))==false) {
   (void) eml_transmit(contact,true,"%d 5.5.4 %s.",BADPAR,DETAIL);
   (void) setterminator(contact,"HELO parameter missing");
   contact->credit-=2;
@@ -1500,7 +1540,7 @@ while (proceed==true) {
   //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase);
   switch (phase) {
     case 0      :       //Do we have a parameter
-      if ((done=isgoodfqdn(contact,parameter))==false) {
+      if ((done=isgoodhelo(contact,parameter))==false) {
         (void) eml_transmit(contact,true,"%d 5.5.4 %s.",BADPAR,DETAIL);
         (void) setterminator(contact,"EHLO parameter missing");
         contact->credit-=2;     //penalty
index 289e3f504cce0d68e10664a938472e19327a00c9..9e0f5f167dba3a397ee3bb93f5247a486c79bad8 100644 (file)
@@ -19,6 +19,7 @@ typedef struct  {
         SOCPTR *socptr;         //established contact socket context
         SQLPTR *sqlptr;         //established contact database access
         int delay;              //communication max delay
+        _Bool isgoodfqdn;       //Remoted presented a valid fqdn
         char *fqdn;             //fully qualified domain from peer
         int credit;             //Credits to be added or removed from contact
         RELTYP privilege;       //onnection privilege
index 33664b02967ed579aa588dd3081132fcddaad039..f8b2265674d9a267616c5a751d0272c5e107927c 100644 (file)
@@ -77,16 +77,17 @@ search about email exchange within time and transaction context.
 %attr(0750,%{name},mail) %dir %{spooldir}/%{name}/mails
 %attr(0750,%{name},apache) %dir %{wwwdir}/%{name}/
 %{wwwdir}/%{name}/index.php
-%attr(0750,%{name},apache) %{wwwdir}/%{name}/lvlmai.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/devsql.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/gesdis.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/gessql.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/lvllog.php
+%attr(0750,%{name},apache) %{wwwdir}/%{name}/lvlmai.php
+%attr(0750,%{name},apache) %{wwwdir}/%{name}/lvlrmt.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/lvlusr.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/release.php
+%attr(0750,%{name},apache) %{wwwdir}/%{name}/subrou.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/unienv.php
 %attr(0750,%{name},apache) %{wwwdir}/%{name}/unilng.php
-%attr(0750,%{name},apache) %{wwwdir}/%{name}/subrou.php
 %attr(0640,%{name},apache) %{wwwdir}/%{name}/reg-icons/*.gif
 %attr(0640,%{name},apache) %{wwwdir}/%{name}/reg-icons/*.png
 %attr(0644,root,root) %{_datadir}/%{name}/sql/%{name}.sql