]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Starting to implement the debug ORGN: command ("ORGN is back!")
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 15 Jul 2025 03:04:29 +0000 (23:04 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Tue, 15 Jul 2025 03:04:29 +0000 (23:04 -0400)
app/feeder.c
data-feed/feed05.tst
lib/lvleml.c
lib/unieml.c
lib/unieml.h

index e040dfdc6087b59190dc097d2afdeca476e1f249..b080e194d5f14c3fd87dc245b92b8f9768f4e10d 100644 (file)
@@ -44,7 +44,7 @@ typedef enum    {               //List of command
         cmd_connect,            //Start connection with smtp server
         cmd_data,               //start the SMTP data sequence
         cmd_gotls,              //going in tls mode
-        cmd_ipfrom,             //Change peer IP origin
+        cmd_orgn,             //Change peer IP origin
         cmd_restart,            //restart connection with remote server
         cmd_wait,               //delay exchange with remote
         cmd_unknown
@@ -373,7 +373,7 @@ static struct   {
             {cmd_connect,"CONNECT"},
             {cmd_data,"DATA"},
             {cmd_gotls,"GOTLS"},
-            {cmd_ipfrom,"IPFROM"},
+            {cmd_orgn,"ORGN:"},
             {cmd_restart,"RESTART"},
             {cmd_wait,"WAIT"},
             {cmd_unknown,(const char *)0}
@@ -431,10 +431,9 @@ switch (getcmd(line)) {
     if ((status=gomodetls(fd->socptr))==false)
       (void) report(*numline,line,"Unable to set TLS mode");
     break;
-  case cmd_ipfrom       :       //Change/set the client IP
+  case cmd_orgn       :       //send command to override client IP
     if (param!=(char *)0) {
-      fd->srcip=rou_freestr(fd->srcip);
-      fd->srcip=strdup(param);
+      (void) sendout(fd->socptr,line);
       }
     else {
       (void) report(*numline,line,"Missing new PEER IP value");
index 9adf397dc06d2c28021826b7cf62fd55d1ee5f64..5f1ac1f2ef983eb6931f0663472cea5410275ac2 100644 (file)
@@ -1,8 +1,8 @@
 T:(feed05) Email testing remote server
-C:IPFROM 127.127.99.25
-C:CONNECT
 #====================================================
 R:220 mailleur.example.com, ESMTP (cleartext) mailleur...
+C:ORGN: 91.199.160.44
+R:220 xxxmailleur.example.com, ESMTP (cleartext) mailleur...
 S:helo example.com
 R:250 mailleur.example.com, link (cleartext) ready, your IP/FQDN=[127.127.99.25/No.Reverse]
 S:MAIL FROM: <trouble@mailref1.example.com>
index eca101796d2eb121d807853094c5dbcfded4591f..04f3f74afa3d6974895bb384db7c2646c6261a5e 100644 (file)
@@ -1326,6 +1326,30 @@ return done;
 */
 /************************************************/
 /*                                             */
+/*     Procedure to manage a "ORGN:"           */
+/*      command from the SMTP client.           */
+/*      Purpose of this command is to simulate  */
+/*      (or overide) the IP remote client.      */
+/*                                             */
+/*      NOTE:   Only compiled in debug mode.    */
+/*                                             */
+/************************************************/
+#ifdef  MODEDEBUG
+static _Bool setnewrmtip(CONTYP *contact,char *rmtip)
+
+{
+_Bool isok;
+
+isok=true;
+(void) rou_alert(0,"JMPDBG");
+return isok;
+}
+#endif
+/*
+\f
+*/
+/************************************************/
+/*                                             */
 /*     Procedure to manage a "MAIL FROM:"      */
 /*      ommand from the SMTP client.            */
 /*                                             */
@@ -2184,6 +2208,11 @@ while (proceed==true) {
     case c_mail         :       //MAIL FROM: checking originator
       proceed=checkfrom(contact,line);
       break;
+#ifdef  MODEDEBUG
+    case c_orgn         :       //Debug mode to override remote IP
+      proceed=setnewrmtip(contact,line);
+      break;
+#endif
     case c_auth         :       //Auth request
       if (getauth(contact,line)==false)
         proceed=false;          //Authentication failed
index 3134fe932913f07878d885dcd7f1b1e9e6051d4d..f79f8497579d3df8fcdc7b3fb0febf3335195c02 100644 (file)
@@ -35,6 +35,9 @@ static VOCTYP vocsmtp[]={
                 {c_helo,"HELO"},
                 {c_mail,"MAIL FROM:"},
                 {c_noop,"NOOP"},
+#if   MODEDEBUG
+                {c_orgn,"ORGN:"},
+#endif
                 {c_quit,"QUIT"},
                 {c_rcpt,"RCPT TO:"},
                 {c_rset,"RSET"},
index e1bd85a5a3a36afae1adb2151c5be757e73c6674..23c993c35b74749c5775eaf0003df38db5934544 100644 (file)
@@ -63,6 +63,10 @@ typedef enum    {               //list of SMTP protocol keyword
         c_helo,                 //Basic Helo command
         c_mail,                 //'mail from:' sequence detected
         c_noop,                 //No Operation request
+#ifdef  MODEDEBUG
+//command available ONLY if compiled in debug mode
+        c_orgn,                 //to force remote IP to a specific value
+#endif
         c_quit,                 //quit exchange
         c_rcpt,                 //'rcpt to:' sequence detected
         c_rset,                 //resetting session