Hello,

he's a small patch for qmail-remote to specify in servers with several IP 
which IP is to be used for sending email. This IP is set in a file in 
control/smtplocalip.

Without this patch, if the local IP used by qmail-remote doesn't correspond to 
the hostname in control/helohost, some mail servers checked this and reject 
the mail.

--- qmail-remote.c	Mon Feb 24 00:56:00 2003
+++ qmail-remote.c.orig	Sat Feb 22 12:17:15 2003
@@ -65,8 +65,6 @@
 stralloc host = {0};
 stralloc sender = {0};
 
-struct sockaddr_in slocal;
-
 saa reciplist = {0};
 
 struct ip_address partner;
@@ -654,9 +652,6 @@
 
 void getcontrols()
 {
-  stralloc iplocalstr={0};
-  struct ip_address iplocal;
-
   if (control_init() == -1) temp_control();
   if (control_readint(&timeout,"control/timeoutremote") == -1) temp_control();
   if (control_readint(&timeoutconnect,"control/timeoutconnect") == -1)
@@ -671,18 +666,6 @@
     case 1:
       if (!constmap_init(&maproutes,routes.s,routes.len,1)) temp_nomem(); break;
   }
-  switch(control_readline(&iplocalstr,"control/smtplocalip")) {
-  case -1:
-    temp_control();
-  case 0:
-    slocal.sin_family = 0; break;
-  case 1:
-    if (!ip_scan(iplocalstr.s, &iplocal)) { slocal.sin_family=0; break; }
-    slocal.sin_family = AF_INET;
-    slocal.sin_port=0;
-    byte_copy(&iplocal,4,&slocal.sin_addr);
-    break;
-  }
 }
 
 void main(argc,argv)
@@ -707,6 +690,7 @@
   if (chdir(auto_qmail) == -1) temp_chdir();
   getcontrols();
  
+ 
   if (!stralloc_copys(&host,argv[1])) temp_nomem();
  
   relayhost = 0;
@@ -775,10 +759,6 @@
  
     smtpfd = socket(AF_INET,SOCK_STREAM,0);
     if (smtpfd == -1) temp_oserr();
-
-    if (slocal.sin_family == AF_INET)
-      if (bind(smtpfd,(struct sockaddr *) &slocal,sizeof(slocal)) == -1) { temp_oserr(); }
-
 
     /* performace hack to send TCP ACK's without delay */
     setsockopt(smtpfd, IPPROTO_TCP, TCP_NODELAY, &tcpnodelay, sizeof(tcpnodelay));

Reply via email to