]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Moved ORGN debug command to feeder command.
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 6 May 2025 22:56:13 +0000 (18:56 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 6 May 2025 22:56:13 +0000 (18:56 -0400)
Makefile
app/feeder.c
data-tst/feed00.tst
data-tst/xxfeed.tst [moved from data-tst/feedxx.tst with 87% similarity]
lib/lvleml.c
lib/unieml.c

index e9ed5439a664deb2d814ef10063deb44f7fb9714..233921ac866582a67a89df3c7e53b01fac6318bc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ onefeed       :  debug
                        -c ./conf/feeder.conf.dvl       \
                        $(TESTIP)                       \
                        $(TESTPORT)                     \
-                       $(DATATST)/feedxx.tst
+                       $(DATATST)/xxfeed.tst
 #                      # -i 127.63.31.15
 
 #direct test
@@ -79,7 +79,7 @@ dbgfeed       :  debug
                          -c ./conf/feeder.conf.dvl     \
                          $(TESTIP)                     \
                          $(TESTPORT)                   \
-                         $(DATATST)/feed00.tst
+                         $(DATATST)/feedxx.tst
 
 valfeed        :  debug                        #valgring of emlrcvr
           @ echo "feed valgrind test"
index 0a42a33f7103d05d6a62edc64b6780a4eb0cc5d0..c125142645d972f7354923e46f95fc87ace29c4e 100644 (file)
@@ -36,10 +36,11 @@ typedef struct  {
         }FEEDTYP;
 
 typedef enum    {               //List of command
+        cmd_comment,            //Test sequence in int/out comment mode
         cmd_gotls,              //going in tls mode
+        cmd_orgn,               //Change peer IP origin
         cmd_restart,            //restart connection with remote server
         cmd_wait,               //delay exchange with remote
-        cmd_comment,            //Test sequence in int/out comment mode
         cmd_unknown
         }CMDTYP;
 /*
@@ -183,6 +184,32 @@ while (proceed==true) {
 return status;
 }
 /*
+^L
+*/
+/************************************************/
+/*                                             */
+/*     procedure to to restart link with a     */
+/*      new source IP.                          */
+/*                                             */
+/************************************************/
+static _Bool dorestart(FEEDTYP *fd,char *newip)
+
+{
+_Bool status;
+
+status=true;
+if ((newip!=(char *)0)&&(strlen(newip)>0)) {
+  fd->srcip=rou_freestr(fd->srcip);
+  fd->srcip=strdup(newip);
+  }
+fd->socptr=soc_closefeedsock(fd->socptr);
+(void) usleep(100000); //wait 10 millisec
+fd->socptr=soc_openfeedsock(pro_smtp,fd->srcip,fd->destip,fd->destport);
+if (fd->socptr==(SOCPTR *)0) 
+  status=false;
+return status;
+}
+/*
 \f
 */
 /********************************************************/
@@ -201,6 +228,7 @@ static struct   {
       }cmdavail[]={
             {cmd_comment,"COMMENT"},
             {cmd_gotls,"GOTLS"},
+            {cmd_orgn,"ORGN"},
             {cmd_restart,"RESTART"},
             {cmd_wait,"WAIT"},
             {cmd_unknown,(const char *)0}
@@ -242,6 +270,16 @@ switch (getcmd(line)) {
     if ((status=gomodetls(fd->socptr))==false)
       (void) report(numline,line,"Unable to set TLS mode");
     break;
+  case cmd_orgn         :       //Changing PEERIP
+    if (param!=(char *)0) {
+      if(( status=dorestart(fd,param))==false)
+        (void) report(numline,line,"Unable to change srcip!");
+      }
+    else {
+      (void) report(numline,line,"Missing new PEER IP value");
+      status=false;
+      }
+    break;
   case cmd_wait         :       //SLEEP mode
     if (param!=(char *)0)
       (void) sleep(atoi(param));
@@ -251,13 +289,8 @@ switch (getcmd(line)) {
       }
     break;
   case cmd_restart      :       //restart link
-     fd->socptr=soc_closefeedsock(fd->socptr);
-     (void) usleep(100000); //wait 10 millisec
-     fd->socptr=soc_openfeedsock(pro_smtp,fd->srcip,fd->destip,fd->destport);
-     if (fd->socptr==(SOCPTR *)0) {
-       (void) report(numline,line,"Unable to restart feed socket!");
-       status=false;
-       }
+    if ((status=dorestart(fd,(char *)0))==false)
+      (void) report(numline,line,"Unable to restart feed socket!");
     break;
   case cmd_comment      :       //restart link
     if (setcomment(fd,param)==false)
index 8bab4948ef330d4f8927736a25dfd6f510b987ad..a6873d8b66dd7d19e99137f32479bf1fcef9a293 100644 (file)
@@ -4,7 +4,7 @@
 # # comment
 # C: command to execute
 #      GOTLS           - Going in TLS mode
-#      SLEEP X         - Stop for X seconds
+#      WAIT X          - Stop for X seconds
 #      RESTART         - Restart connection with remote
 #      COMMENT START   - START commenting mode
 #      COMMENT STOP    - STOP commenting mode
@@ -40,7 +40,6 @@ R:250-STARTTLS
 R:250-8BITMIME
 R:250-ENHANCEDSTATUSCODES
 R:250-AUTH PLAIN LOGIN
-R:250-ORGN
 R:250 HELP
 C:GOTLS
 R:250 Link now encryp...
@@ -51,7 +50,6 @@ R:250-SIZE 52428800
 R:250-8BITMIME
 R:250-ENHANCEDSTATUSCODES
 R:250-AUTH PLAIN LOGIN
-R:250-ORGN
 R:250 HELP
 #send a empty ehlo
 S:EHLO
@@ -64,10 +62,8 @@ C:WAIT 1
 #-restarting link
 C:RESTART
 R:220 mailleur.example.com ESMTP (cleartext) emlrcvr...
-S:ORGN 127.168.0.1
-R:250 2.9.9 New peer [127.168.0.1/No.Reverse] set
-S:ORGN 127.168.10.1
-R:250 2.9.9 New peer [127.168.10.1/foreign1.badserver.tld] set
+C:ORGN 127.168.0.1
+R:220 mailleur.example.com ESMTP (cleartext) emlrcvr...
 S:QUIT
 R:221 2.0.0 Bye, closing connection...
 #-------------------------------------------------------------------------
similarity index 87%
rename from data-tst/feedxx.tst
rename to data-tst/xxfeed.tst
index 7317fb50f27ecef51842f207f7b93256c7ace86d..d4972c4a49163efd31e1edc43ae3c2d873b35666 100644 (file)
@@ -2,14 +2,14 @@
 #====================================================
 T:Simple email sending
 R:220 mailleur.example.com ESMTP (cleartext) emlrcvr...
-S:ORGN 127.127.0.2
-R:250 2.9.9 New peer [127.127.0.2/feed2.example.com] set
+C:ORGN 127.127.0.2
+R:220 mailleur.example.com ESMTP (cleartext) emlrcvr...
 #====================================================
 S:HELO example.com
 R:250-mailleur.example.com, link (cleartext) ready, your IP/FQDN=[127.127.0.2/feed2.example.com]
 S:MAIL FROM: <postmaster@example.com>
 R:250 2.1.3 postmaster@example.com.. sender ok
-S:RCP TO: <postmaster@example.com>
+S:RCPT TO: <postmaster@example.com>
 R:250 Address accepted
 #-------------------------------------------------------------------------
 #-sending data
index 747ab3ee81cffa6d3abe0ed0d06a2a36218e6dcc..73a6225a7fca8738dc5559345589749a72b63a9f 100644 (file)
@@ -292,9 +292,6 @@ static char *ehlostr[]= {
         "-8BITMIME",
         "-ENHANCEDSTATUSCODES",
         "-AUTH PLAIN LOGIN",
-#ifdef  MODEDEBUG
-        "-ORGN",        //specific command to change ORIGIN IP
-#endif
         " HELP",
         (char *)0
         };
index 903e1b0c720997222b75a60acb0af3fcd6f94c53..40d4efd8781a8fd3b438719c202edd8066e99fe2 100644 (file)
@@ -24,9 +24,6 @@ static VOCTYP vocsmtp[]={
                 {c_helo,"HELO"},
                 {c_mail,"MAIL FROM:"},
                 {c_noop,"NOOP"},
-#ifdef  MODEDEBUG
-                {c_orgn,"ORGN"},
-#endif
                 {c_quit,"QUIT"},
                 {c_rcpt,"RCPT TO:"},
                 {c_rset,"RSET"},