}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;
/*
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
*/
/********************************************************/
}cmdavail[]={
{cmd_comment,"COMMENT"},
{cmd_gotls,"GOTLS"},
+ {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_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));
}
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)
# # 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
R:250-8BITMIME
R:250-ENHANCEDSTATUSCODES
R:250-AUTH PLAIN LOGIN
-R:250-ORGN
R:250 HELP
C:GOTLS
R:250 Link now encryp...
R:250-8BITMIME
R:250-ENHANCEDSTATUSCODES
R:250-AUTH PLAIN LOGIN
-R:250-ORGN
R:250 HELP
#send a empty ehlo
S:EHLO
#-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...
#-------------------------------------------------------------------------
#====================================================
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