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
{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}
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");
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>
*/
/************************************************/
/* */
+/* 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. */
/* */
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
{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"},
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