Re: ipme.c patch

2001-02-09 Thread Scott Gifford

"James" [EMAIL PROTECTED] writes:

 There was recently some talk on this list about about patching ipme.c
 to add 0.0.0.0 to qmail's list of known local addresses.. and the
 original poster supplied a patch. However, the patch was only _part_
 of a bigger patch.. leaving those of us that aren't familiar with
 qmail's code in the dark.
 
 So.. my question is, could someone please post a complete patch to
 work around this issue? Or at least a URL to their patch? Thanks.

I have put a copy of the 0.0.0.0 patch (the same one I posted to this
mailing list a week or three ago) in:

http://www.tir.com/~sgifford/qmail/

at

http://www.tir.com/~sgifford/qmail/qmail-0.0.0.0.patch

That will be its permanent home, so feel free to link to it.

--ScottG.




Re: ipme.c patch

2001-01-29 Thread Scott Gifford

"James" [EMAIL PROTECTED] writes:

 There was recently some talk on this list about about patching ipme.c
 to add 0.0.0.0 to qmail's list of known local addresses.. and the
 original poster supplied a patch. However, the patch was only _part_
 of a bigger patch.. leaving those of us that aren't familiar with
 qmail's code in the dark.
 
 So.. my question is, could someone please post a complete patch to
 work around this issue? Or at least a URL to their patch? Thanks.

Here's a patch that implements my recommendation.  Note that for
reasons discussed in my earlier messages, this isn't the patch that we
actually use in production machines, so I can't guarantee it won't
break anything, but it looks like an obvious fix.  Still, I would test
it on a development machine first.

You can verify that this patch has worked by running "ipmeprint" after
applying it.  0.0.0.0 should be printed out first, followed by all of
your IP addresses, each on their own line.

If anybody can report success or failure with this patch, I'd
appreciate it.

I'll put it up on my Web page and post the URL when I can.

--ScottG.


--- qmail-1.03/ipme.c	Mon Jun 15 06:53:16 1998
+++ qmail-1.03-sg/ipme.c	Mon Jan 29 02:27:38 2001
@@ -46,6 +46,11 @@
   ipme.len = 0;
   ix.pref = 0;
  
+  /* 0.0.0.0 is a special address which always refers to 
+   * "this host, this network", according to RFC 1122, Sec. 3.2.1.3a.
+  */
+  byte_copy(ix.ip,4,"\0\0\0\0");
+  if (!ipalloc_append(ipme,ix)) { return 0; }
   if ((s = socket(AF_INET,SOCK_STREAM,0)) == -1) return -1;
  
   len = 256;



Re: ipme.c patch

2001-01-29 Thread Scott Gifford

Adi's patch is actually not correct.  It adds "0.0.0.0" *instead of*
your other interfaces, instead of *in addition to* your other
interfaces.

ipmeprint shows this.  Here's qmail's normal ipme:

[sgifford@sghome qmail-1.03]$ ./ipmeprint 
127.0.0.1
10.0.0.8

here it is with Adi's patch:

[sgifford@sghome qmail-1.03-adi]$ ./ipmeprint 
0.0.0.0
0.0.0.0

and here it is with the patch I just posted:

[sgifford@sghome qmail-1.03-sg]$ ./ipmeprint 
0.0.0.0
127.0.0.1
10.0.0.8

Thanks for taking a stab at it, though, Adi!  :)

-ScottG.

adi [EMAIL PROTECTED] writes:

 On Mon, Jan 29, 2001 at 06:39:36AM +, James wrote:

  So.. my question is, could someone please post a complete patch to
  work around this issue? Or at least a URL to their patch?
 
 Try this patch. Use with your own risk.
 And don't forget to say thank to Scott Gifford @ tir.com.
 
 Regards,
 
 P.Y. Adi Prasaja
 
 --- ipme.cMon Jun 15 17:53:16 1998
 +++ /usr/local/src/qmail-1.03/ipme.c  Mon Jan 29 13:48:00 2001
 @@ -74,6 +74,7 @@
byte_copy(ix.ip,4,sin-sin_addr);
if (ioctl(s,SIOCGIFFLAGS,x) == 0)
  if (ifr-ifr_flags  IFF_UP)
 +  ip_scan("0.0.0.0", ix.ip);
if (!ipalloc_append(ipme,ix)) { close(s); return 0; }
  }
  #else
 @@ -84,6 +85,7 @@
 if (ifr-ifr_addr.sa_family == AF_INET) {
   sin = (struct sockaddr_in *) ifr-ifr_addr;
   byte_copy(ix.ip,4,sin-sin_addr);
 +ip_scan("0.0.0.0", ix.ip);
   if (!ipalloc_append(ipme,ix)) { close(s); return 0; }
 }
  #endif



Re: ipme.c patch

2001-01-29 Thread adi

On Mon, Jan 29, 2001 at 02:54:10AM -0500, Scott Gifford wrote:
 ipmeprint shows this.  Here's qmail's normal ipme:
 
 [sgifford@sghome qmail-1.03]$ ./ipmeprint 
 127.0.0.1
 10.0.0.8
 
 here it is with Adi's patch:
 
 [sgifford@sghome qmail-1.03-adi]$ ./ipmeprint 
 0.0.0.0
 0.0.0.0

Arggh.. thanks again!

Our mailserver currently being attack by navidad.exe ;-(
I didn't received your patch, yet. Anyway, I think this patch would
be more correct than previous one :-)

% ./ipmeprint
127.0.0.1
10.0.7.21
10.0.7.20
10.0.100.1
10.0.100.2
10.0.100.3
10.0.100.4
10.0.100.5
0.0.0.0

Regards,

P.Y. Adi Prasaja


--- ipme.c  Mon Jun 15 17:53:16 1998
+++ /usr/local/src/qmail-1.03/ipme.cMon Jan 29 16:09:15 2001
@@ -89,6 +89,8 @@
 #endif
 x += len;
   }
+  ip_scan("0.0.0.0", ix.ip);
+  if (!ipalloc_append(ipme,ix)) { close(s); return 0; }
   close(s);
   ipmeok = 1;
   return 1;



Re: ipme.c patch

2001-01-29 Thread Scott Gifford

adi [EMAIL PROTECTED] writes:

[ ... ]

 Arggh.. thanks again!
 
 Our mailserver currently being attack by navidad.exe ;-(
 I didn't received your patch, yet. Anyway, I think this patch would
 be more correct than previous one :-)

Yep, that patch looks fine; mine's pretty much the same, but puts the
IP address first instead of last, and uses byte_copy instead of
ip_scan to fill in the ix structure.

-ScottG.

 
 % ./ipmeprint
 127.0.0.1
 10.0.7.21
 10.0.7.20
 10.0.100.1
 10.0.100.2
 10.0.100.3
 10.0.100.4
 10.0.100.5
 0.0.0.0
 
 Regards,
 
 P.Y. Adi Prasaja
 
 --- ipme.cMon Jun 15 17:53:16 1998
 +++ /usr/local/src/qmail-1.03/ipme.c  Mon Jan 29 16:09:15 2001
 @@ -89,6 +89,8 @@
  #endif
  x += len;
}
 +  ip_scan("0.0.0.0", ix.ip);
 +  if (!ipalloc_append(ipme,ix)) { close(s); return 0; }
close(s);
ipmeok = 1;
return 1;



ipme.c patch

2001-01-28 Thread James

There was recently some talk on this list about about patching ipme.c to add 
0.0.0.0 to qmail's list of known local addresses.. and the original poster 
supplied a patch. However, the patch was only _part_ of a bigger patch.. 
leaving those of us that aren't familiar with qmail's code in the dark.

So.. my question is, could someone please post a complete patch to work 
around this issue? Or at least a URL to their patch? 


Thanks. 



Re: ipme.c patch

2001-01-28 Thread adi

On Mon, Jan 29, 2001 at 06:39:36AM +, James wrote:
 So.. my question is, could someone please post a complete patch to work 
 around this issue? Or at least a URL to their patch? 

Try this patch. Use with your own risk.
And don't forget to say thank to Scott Gifford @ tir.com.

Regards,

P.Y. Adi Prasaja


--- ipme.c  Mon Jun 15 17:53:16 1998
+++ /usr/local/src/qmail-1.03/ipme.cMon Jan 29 13:48:00 2001
@@ -74,6 +74,7 @@
   byte_copy(ix.ip,4,sin-sin_addr);
   if (ioctl(s,SIOCGIFFLAGS,x) == 0)
 if (ifr-ifr_flags  IFF_UP)
+  ip_scan("0.0.0.0", ix.ip);
   if (!ipalloc_append(ipme,ix)) { close(s); return 0; }
 }
 #else
@@ -84,6 +85,7 @@
  if (ifr-ifr_addr.sa_family == AF_INET) {
sin = (struct sockaddr_in *) ifr-ifr_addr;
byte_copy(ix.ip,4,sin-sin_addr);
+ip_scan("0.0.0.0", ix.ip);
if (!ipalloc_append(ipme,ix)) { close(s); return 0; }
  }
 #endif