]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Working to improve data-feed set
authorJean-Marc Pigeon <jmp@safe.c>
Mon, 22 Sep 2025 13:43:39 +0000 (09:43 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Mon, 22 Sep 2025 13:43:39 +0000 (09:43 -0400)
17 files changed:
data-feed/feed000.tst
data-feed/feed001.tst
data-feed/feed002.tst
data-feed/feed003.tst
data-feed/feed004.tst
data-feed/feed006.tst
data-feed/feed007.tst
data-feed/feed008.tst
data-feed/feed009.tst
data-feed/feed10.tst
data-feed/feed11.tst
data-feed/feed30.tst
lib/lvleml.c
sql/Makefile
sql/datatest.def
sql/datatest.sql
www/lvlmai.php

index 817337f18bf846037e0df09096c9c31818f02663..5e1bf21f601f9ba4c1f20132e2f08197ddf1bad3 100644 (file)
@@ -34,9 +34,9 @@ R:250 mailleur.example.com, link (cleartext) ready,...
 S:MAIL FROM: <postmaster@example.com>
 R:250 2.1.3 postmaster@example.com sender ok
 S:RCPT TO: <webmaster@example.com>
-R:250 5.6.6 Address will be processed <webmaster@example.com>
+R:250 5.6.7 Address will be processed <webmaster@example.com>
 S:RCPT TO: <postmaster@example.com>
-R:250 5.6.6 Address will be processed <postmaster@example.com>
+R:250 5.6.7 Address will be processed <postmaster@example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index 503b59ed00ab28565975dc5835945cacc428fe2f..50655e729824079b2292497f2b137f262f5e1352 100644 (file)
@@ -21,9 +21,9 @@ R:250 ENHANCEDSTATUSCODES
 S:MAIL FROM: <postmaster@example.com> SIZE=1024
 R:250 2.1.3 postmaster@example.com sender ok
 S:RCPT TO: <user1@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user1@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user1@mailref1.example.com>
 S:RCPT TO: <user2@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user2@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user2@mailref1.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index ebbe7fb0727973d8761bfdfe441baa735f9bd5aa..361f350a747c26e87c4cf397408066ac60364374 100644 (file)
@@ -7,13 +7,13 @@ R:250 mailleur.example.com, link (cleartext) ready,...
 S:MAIL FROM: <trouble@mailref1.example.com>
 R:250 2.1.3 trouble@mailref1.example.com sender ok
 S:RCPT TO: <webmaster@example.com>
-R:250 5.6.6 Address will be processed <webmaster@example.com>
+R:250 5.6.7 Address will be processed <webmaster@example.com>
 S:RCPT TO: <user1@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user1@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user1@mailref1.example.com>
 S:RCPT TO: <user1@posdb.example.com>
-R:250 5.6.6 Address will be processed <user1@posdb.example.com>
+R:250 5.6.7 Address will be processed <user1@posdb.example.com>
 S:RCPT TO: <user1@mardb.example.com>
-R:250 5.6.6 Address will be processed <user1@mardb.example.com>
+R:250 5.6.7 Address will be processed <user1@mardb.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index ed279b93ec31b1bb73b0086797a3761e00ff6705..a15ee68545447fbde654808ab9e05e95f275b501 100644 (file)
@@ -7,9 +7,11 @@ R:250 mailleur.example.com, link (cleartext) ready,...
 S:MAIL FROM: <trouble@mailref1.example.com>
 R:250 2.1.3 trouble@mailref1.example.com sender ok
 S:RCPT TO: <user1@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user1@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user1@mailref1.example.com>
 S:RCPT TO: <user2@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user2@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user2@mailref1.example.com>
+S:RCPT TO: <no-one@example.com>
+R:551 5.6.0 <no-one@example.com> unknown user
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
@@ -35,9 +37,9 @@ R:250 mailleur.example.com, link (cleartext) ready,...
 S:MAIL FROM: <postmaster@mailref1.example.com>
 R:250 2.1.3 postmaster@mailref1.example.com sender ok
 S:RCPT TO: <user2@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user2@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user2@mailref1.example.com>
 S:RCPT TO: <user1@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user1@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user1@mailref1.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index 5ffb43b43a568d6ef581f3896de0f2feaf326bab..71c82e33550399931d86d72fc79cb75af5d9c5c5 100644 (file)
@@ -7,7 +7,7 @@ R:250 mailleur.example.com, link (cleartext) ready,...
 S:MAIL FROM: <postmaster@example.com>
 R:250 2.1.3 postmaster@example.com sender ok
 S:RCPT TO: <utf8-áö_üñ@example.com>
-R:250 5.6.6 Address will be processed <utf8-áö_üñ@example.com>
+R:250 5.6.7 Address will be processed <utf8-áö_üñ@example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index 26ea2281e3679cbfb45cb195ef1123c0f2bd6321..47bd2c838e198a611066685b9002c748fb9c5165 100644 (file)
@@ -20,7 +20,7 @@ R:235 5.7.5 Authentication successful
 S:MAIL FROM: <trouble@mailref1.example.com>
 R:250 2.1.3 trouble@mailref1.example.com sender ok
 S:RCPT TO: <user1@posdb.example.com>
-R:250 5.6.6 Address will be processed <user1@posdb.example.com>
+R:250 5.6.7 Address will be processed <user1@posdb.example.com>
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
 D:Subject: (feed006) A email to a not existing user after authentication
index 9e082e08ebe596b3bc8dba61160d27bc84a4b36b..b907720afea55249111afdd65b362749b17dca66 100644 (file)
@@ -15,7 +15,7 @@ R:250 ENHANCEDSTATUSCODES
 S:MAIL FROM: <trouble@mailref1.example.com>
 R:250 2.1.3 trouble@mailref1.example.com sender ok
 S:RCPT TO: <user1@posdb.example.com>
-R:250 5.6.6 Address will be processed <user1@posdb.example.com>
+R:250 5.6.7 Address will be processed <user1@posdb.example.com>
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
 D:Subject: (feed006) A email to a not existing user after authentication
index e891b0f501aeafeeb498186df274d6deee15c962..18ea76bbad2f5f1d8836b049f586e6f912b95dc4 100644 (file)
@@ -15,11 +15,11 @@ R:250 ENHANCEDSTATUSCODES
 S:MAIL FROM:<supertool@mxtoolboxsmtpdiag.com>
 R:250 2.1.3 supertool@mxtoolboxsmtpdiag.com sender ok
 S:RCPT TO: <webmaster@example.com>
-R:250 5.6.6 Address will be processed <webmaster@example.com>
+R:250 5.6.7 Address will be processed <webmaster@example.com>
 S:RCPT TO:<test@mxtoolboxsmtpdiag.com>
-R:555 2.7.0 No MX nor IP for for domain <mxtoolboxsmtpdiag.com>
+R:555 2.8.0 No MX nor IP for for domain <mxtoolboxsmtpdiag.com>
 S:RCPT TO: <user1@posdb.example.com>
-R:555 2.7.0 No relay accepted for domain <posdb.example.com>
+R:555 2.8.0 No relay accepted for domain <posdb.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index 24d8b7074d280b00e27166c4cffb01a34b24184d..66b591176ce0ce25eedb100301545d7e0cb01f61 100644 (file)
@@ -15,7 +15,7 @@ R:250 ENHANCEDSTATUSCODES
 S:MAIL FROM:<nobody@gmail.com> SIZE=2958
 R:250 2.1.3 nobody@gmail.com sender ok
 S:RCPT TO:<user1@mailleur.example.com>
-R:250 5.6.6 Address will be processed <user1@mailleur.example.com>
+R:250 5.6.7 Address will be processed <user1@mailleur.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index 46f0fed8bf0156644fe7d3c324fff6179b13f4c6..d4ab7a0e87618fc97b91e39c391012826c936a1c 100644 (file)
@@ -10,7 +10,7 @@ R:250 2.1.3 postmaster@example.com sender ok
 S:RCPT TO: <user1@subdom0.example.com>
 R:563 5.6.4 No valid MX found for recipient domain name (domain=subdom0.example.com)
 S:RCPT TO: <user1@mailref1.example.com>
-R:250 5.6.6 Address will be processed <user1@mailref1.example.com>
+R:250 5.6.7 Address will be processed <user1@mailref1.example.com>
 S:QUIT
 R:221 2.0.0 Bye, closing connection...
 #-------------------------------------------------------------------------
index 20b8f4c2cb4405052b4f0ee8cba30c1b81dc84f9..1f41d5a583a110d84ab1aab8c817363de2b5297e 100644 (file)
@@ -23,9 +23,9 @@ R:250 2.1.3 trouble@mailref1.example.com sender ok
 S:RCPT TO: <dom1user3@example.com>
 R:551 5.6.5 <dom1user3@example.com> unknown user
 S:RCPT TO: <dom1user3@mailref1.example.com>
-R:250 5.6.6 Address will be processed <dom1user3@mailref1.example.com>
+R:250 5.6.7 Address will be processed <dom1user3@mailref1.example.com>
 S:RCPT TO: <user1@posdb.example.com>
-R:250 5.6.6 Address will be processed <user1@posdb.example.com>
+R:250 5.6.7 Address will be processed <user1@posdb.example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index cf853edae2ec7e279e9c2842e0efcf1542ee6801..f3e8d32371d98289d9d97b4372ff224819abd3ca 100644 (file)
@@ -9,9 +9,9 @@ R:250 mailleur.example.com, link (cleartext) ready,...
 S:MAIL FROM: <postmaster@example.com>
 R:250 2.1.3 postmaster@example.com sender ok
 S:RCPT TO: <root@example.com>
-R:250 5.6.6 Address will be processed <root@example.com>
+R:250 5.6.7 Address will be processed <root@example.com>
 S:RCPT TO: <jmp@example.com>
-R:250 5.6.6 Address will be processed <jmp@example.com>
+R:250 5.6.7 Address will be processed <jmp@example.com>
 #-------------------------------------------------------------------------
 #-sending data
 C:DATA 354 3.5.0 End data with <CR><LF>.<CR><LF>
index 353abc4b4584699712fd43bfd7bae22ed965db51..cc1234526d0f2f6076ea5573667df837f2f752be 100644 (file)
@@ -883,6 +883,51 @@ rmtpass=rou_freestr(rmtpass);
 return (contact->privilege==rel_authentic);
 
 #undef  DISP
+#undef  OPEP
+}
+/*
+\f
+*/
+/************************************************/
+/*                                             */
+/*     Procedure to report rcpt problem and    */
+/*      store status within the database.       */
+/*                                             */
+/************************************************/
+static void note_rcpt(CONTYP *contact,char *rcpt,int smtpcode,char *fmt,...)
+
+{
+#define OPEP    "lvleml.c:note_rcpt,"
+
+va_list args;
+char **resp;
+char *report;
+char *info;
+ACTTYP action;
+
+va_start(args,fmt);
+resp=(char **)0;
+(void) rou_vasprintf(&report,fmt,args);
+(void) rou_asprintf(&info,"%d %s",smtpcode,report);
+resp=(char **)rou_addlist((void **)resp,(void *)info);
+(void) memset(&action,'\000',sizeof(ACTTYP));
+action.sessid=contact->session->sessid;
+action.code='X';
+action.reverse=contact->peername;
+action.sfrom=contact->mailfrom;
+if (contact->session->hfrom!=(char *)0)
+  action.hfrom=contact->session->hfrom;
+if (contact->session->hsubject!=(char *)0)
+  action.hsubject=contact->session->hsubject;
+action.rcptto=rcpt;
+action.resp=resp;
+if (sql_mngact(contact->sqlptr,&action)==false)
+  (void) rou_alert(0,"%s unable to store report within database (bug?",OPEP);
+(void) eml_transmit(contact,true,"%s",info);
+resp=(char **)rou_freelist((void **)resp,(genfree_t)rou_freestr);
+report=rou_freestr(report);
+va_end(args);
+
 #undef  OPEP
 }
 /*
@@ -909,15 +954,13 @@ while (proceed==true) {
   switch (phase) {
     case 0      :       //is user a local user
       if ((sql_mngusr(contact->sqlptr,sql_select,rcptto,&usr))==false) {
-        (void) eml_transmit(contact,true,"%d 5.6.5 <%s> unknown user",
-                                          UKNUSER,rcptto);
+        (void) note_rcpt(contact,rcptto,UKNUSER,"5.6.0 <%s> unknown user",rcptto);
         phase=999;      //No user found in database
         }
       break;
     case 1      :       //is user lock?
       if (usr->lock==1) {
-        (void) eml_transmit(contact,true,"%d 5.6.6 <%s> account lock",
-                                          EXPIRED,rcptto);
+        (void) note_rcpt(contact,rcptto,EXPIRED,"5.6.1 <%s> account lock",rcptto);
         phase=999;      //No user found in database
         }
       break;
@@ -1003,7 +1046,7 @@ while (proceed==true) {
     default     :       //SAFE Guard
       if (remotegood==false) {
 
-        (void) eml_transmit(contact,true,"%d 2.7.0 %s for domain <%s>",
+        (void) eml_transmit(contact,true,"%d 2.8.0 %s for domain <%s>",
                                          NORELAY,cmt,rmtusr->domain);
         }
       proceed=false;
@@ -1235,54 +1278,6 @@ return status;
 */
 /************************************************/
 /*                                             */
-/*     Procedure to report rcpt problem and    */
-/*      store status within the database.       */
-/*                                             */
-/************************************************/
-static void note_rcpt(CONTYP *contact,char *rcpt,int smtpcode,char *fmt,...)
-
-{
-#define OPEP    "lvleml.c:note_rcpt,"
-
-va_list args;
-char **resp;
-char *report;
-char *info;
-ACTTYP action;
-
-va_start(args,fmt);
-resp=(char **)0;
-(void) rou_vasprintf(&report,fmt,args);
-(void) rou_asprintf(&info,"%d %s",smtpcode,report);
-(void) rou_alert(0,"JMPDBG info=<%s>",info);
-resp=(char **)rou_addlist((void **)resp,(void *)info);
-(void) memset(&action,'\000',sizeof(ACTTYP));
-action.sessid=contact->session->sessid;
-action.code='X';
-action.reverse=contact->peername;
-action.sfrom=contact->mailfrom;
-action.hfrom="----";
-action.hsubject="----";
-if (contact->session->hfrom!=(char *)0)
-  action.hfrom=contact->session->hfrom;
-if (contact->session->hsubject!=(char *)0)
-  action.hsubject=contact->session->hsubject;
-action.rcptto=rcpt;
-action.resp=resp;
-if (sql_mngact(contact->sqlptr,&action)==false)
-  (void) rou_alert(0,"%s unable to store report within database (bug?",OPEP);
-(void) eml_transmit(contact,true,"%s",info);
-resp=(char **)rou_freelist((void **)resp,(genfree_t)rou_freestr);
-report=rou_freestr(report);
-va_end(args);
-
-#undef  OPEP
-}
-/*
-\f
-*/
-/************************************************/
-/*                                             */
 /*     Procedure to send a simple SMTP ccommand*/
 /*      (no need to have the response wording)  */
 /*                                             */
@@ -1839,7 +1834,7 @@ while (proceed==true) {
         }
       break;
     case 7      :       //everything ok
-      (void) note_rcpt(contact,rcptto,CMDOK,"5.6.6 %s <%s>",detail,rcptto);
+      (void) note_rcpt(contact,rcptto,CMDOK,"5.6.7 %s <%s>",detail,rcptto);
       success=true;
       break;
     default     :       //SAFE guard
index 6e9140205293353069089c17e818625642fbfd2f..ed1208fd4b086d1068d2990e7053d8984152a25d 100644 (file)
@@ -36,8 +36,10 @@ dbmysql      :  mailleur.mysql
                         CHARACTER SET utf8;";          \
             ) | sudo mariadb -q
           @ cat mailleur.mysql | mariadb -q mailleur;
-          @ cpp -P -DMYSQL datatest.sql        | mariadb -q mailleur;
-          @ cpp -P -DMYSQL popul.sql           | mariadb -q mailleur;
+          @ cpp -P -DMYSQL                             \
+               datatest.sql    | mariadb -q mailleur;
+            cpp -P -traditional -DMYSQL                \
+               popul.sql       | mariadb -q mailleur;
           @ echo "MYSQL database ready"
 
 
@@ -58,8 +60,18 @@ dbpostg      :  mailleur.postg
             echo "              ENCODING='UTF8';";     \
             ) | psql -q -U postgres template1
           @ cat mailleur.postg | psql -q mailleur;
-          @ cpp -P -DPOSTGRESQL datatest.sql   | psql -q mailleur;
-          @ cpp -P -DPOSTGRESQL popul.sql      | psql -q mailleur;
+          @ cpp -DPOSTGRESQL                           \
+               -P                                      \
+               -traditional                            \
+               datatest.sql                    |       \
+                       sed -e"/^\/\//d"        |       \
+                       psql -q mailleur;
+          @ cpp -DPOSTGRESQL                           \
+               -P                                      \
+               -traditional                            \
+               popul.sql                       |       \
+                       sed -e"/^\/\//d"        |       \
+                       psql -q mailleur;
           @ echo "POSGRESQL database ready"
 
 ndbpostg:
index c2f751cfbb981d4f8a1a62756440329ae04883d5..c09079fab2b17414b39f8f04d92e24bdf3a48dc0 100644 (file)
@@ -1,6 +1,7 @@
-//------------------------------------------------------------------
+
+//X------------------------------------------------------------------
 //include file to ajuste result according database
-//------------------------------------------------------------------
+//Y------------------------------------------------------------------
 #ifdef POSTGRESQL
 #define ADDTIME(adding) 'adding'
 #define CONCAT(A,B)     A||B
index 4df35a76470d1ebfd0205515aa08621cdcaa81f1..6fc23a919207ee67cfee168daecd992bf10d876c 100644 (file)
@@ -23,7 +23,7 @@ INSERT INTO emails (email,password)                           \
 INSERT INTO emails (email,password)                            \
         values ('user1@mailleur.example.com','user1');
 
-//Set for system iwith Postgresql database 
+//Set for system with Postgresql database 
 INSERT INTO emails (email,password)                            \
          values ('user1@posdb.example.com','user1');
 INSERT INTO emails (email,password)                            \
@@ -47,7 +47,7 @@ INSERT INTO remotes (remoteip,credit,lastscan)                        \
 INSERT INTO remotes (remoteip,credit,lastscan)                 \
          values ('45.197.14.139',-5,now());
 INSERT INTO remotes (remoteip,credit,lastscan)                 \
-         values ('213.209.157.107',-5,now());
+         values ('213.209.157.107',-5,now()+ADDTIME(200 day));
 INSERT INTO remotes (remoteip,credit,lastscan)                 \
          values ('122.175.193.134',-5,now());
 INSERT INTO remotes (remoteip,credit,lastscan)                 \
index fdce6a0e0c4be25a511e2777547afe7f237c91e8..4205f2b44cb91c0255dcc51bc35b87a5fcbf6d68 100644 (file)
@@ -47,21 +47,24 @@ foreach($actions as $action) {
   $date=$action['creation'];
   $reverse=$action['reverse'];
   $smtpfrom=$action['smtpfrom'];
-  $emailfrom=$action['emailfrom'];
-  $emailfrom=htmlspecialchars($emailfrom,ENT_QUOTES);
   $recipient=$action['rcptto'];
+  $emailfrom=htmlspecialchars($action['emailfrom'],ENT_QUOTES);
   $subject=$action['subject'];
+  if (($subject==NULL) || (strlen($subject)==0)) 
+    $subject=$action['info'];
+  //generating the table contents
   $line=$line."<TR>\r\n";
   $line=$line."<TD align=left>$count $status</TD>\r\n";
   $line=$line."<TD align=left>$date</TD>\r\n";
   $line=$line."<TD align=left>$reverse</TD>\r\n";
   $line=$line."<TD align=left>";
-  $line=$line."$emailfrom<BR>";
-  $line=$line."<FONT SIZE=-1>$smtpfrom</FONT>";
+  $line=$line."$smtpfrom<BR>";
+  $line=$line."<FONT SIZE=-1>$emailfrom</FONT>";
   $line=$line."</TD>\r\n";
   $line=$line."<TD align=left>$recipient</TD>\r\n";
   $line=$line."<TD align=left>$subject</TD>\r\n";
   $line=$line."</TR>";
+  //end of generation
   $count++;
   }
 sql_close($dbsql);