Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Thread

milter-greylist 1.6rc1 and Solaris 9 (sparc)

milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-14 by fredrik.pettai@vattenfall.com

Hello list!

I've compiled and installed milter-greylist-1.6rc1 on Solaris 9 (sparc).
It works fine to compile if you install the following:
- gcc
- flex
- bison
(and add the option CFLAGS=-D__EXTENSIONS__ to the Makefile)

(This, because of that Solaris lex and yacc is missing to many important feature)

Everything works fine, except for "peer" option (replication of greylist/whitelist data between MX-peers). I've tried to truss and "debug" as much as i can with the help from Emmanuel Dreyfus, but i'm stuck...

The message i get in the syslog looks like this:

Dec 13 20:00:55 gemini milter-greylist: [ID 226885 mail.debug] iBDJ0rOa004257: addr = 151.156.192.51, from = <root@...>, rcpt = <kalle@...>
Dec 13 20:00:55 gemini milter-greylist: [ID 173742 mail.debug] created: 151.156.192.51 from <root@...> to <kalle@....se> delayed for 60s
Dec 13 20:00:55 gemini milter-greylist: [ID 928669 mail.info] iBDJ0rOa004257: addr 151.156.192.51 from <root@...> to <kalle@...> delayed for 00:01:00
Dec 13 20:00:55 gemini sendmail[4257]: [ID 801593 mail.info] iBDJ0rOa004257: milter=greylist, action=rcpt, reject=451 4.7.1 Greylisting in action, please come back in 00:01:00
Dec 13 20:00:55 gemini milter-greylist: [ID 795507 mail.debug] sync_sender running
Dec 13 20:00:55 gemini milter-greylist: [ID 634049 mail.error] local_addr: bind failed: Error 0
Dec 13 20:00:55 gemini milter-greylist: [ID 750011 mail.debug] sync_sender sleeping, done 0 entries in 0.010411s

Apparently "sync_sender" routine fails (problem binding a free port on the local machine?). I've also snoop:ed the network, and i can't see any milter-greylist "sync"-trafic. Has someone running Solaris noticed or fixed this problem for version 1.6rc1?
If so, please send a patch to Emmanuel Dreyfus...

I've noticed that most milter coding is done on BSD-systems.
But the company that i work for prefers Solaris :-(

TIA,
/P

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-14 by Hajimu UMEMOTO

Hi,

>>>>> On Tue, 14 Dec 2004 12:00:25 +0100
>>>>> <fredrik.pettai@...> said:

pettai> Dec 13 20:00:55 gemini milter-greylist: [ID 634049 mail.error] local_addr: bind failed: Error 0

It's strange.  It seems bind() returns an error without setting errno.
Please try following patch.  Solaris9 might not allow bind to port 0.

Index: sync.c
diff -u -p sync.c.orig sync.c
--- sync.c.orig	Fri Nov 12 23:22:22 2004
+++ sync.c	Tue Dec 14 23:21:44 2004
@@ -1176,12 +1176,12 @@ local_addr(sa, salen)
 	memcpy(&addr, sa, salen);
 	switch(sa->sa_family) {
 	case AF_INET:
-		SA4(&addr)->sin_port = 0;
+		SA4(&addr)->sin_port = 1;
 		break;
 
 #ifdef AF_INET6
 	case AF_INET6:
-		SA6(&addr)->sin6_port = 0;
+		SA6(&addr)->sin6_port = 1;
 		break;
 #endif
 

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@...  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by Matthias Scheler

On Tue, Dec 14, 2004 at 12:00:25PM +0100, fredrik.pettai@... wrote:
> Dec 13 20:00:55 gemini milter-greylist: [ID 795507 mail.debug] sync_sender running
> Dec 13 20:00:55 gemini milter-greylist: [ID 634049 mail.error] local_addr: bind failed: Error 0
> Dec 13 20:00:55 gemini milter-greylist: [ID 750011 mail.debug] sync_sender sleeping, done 0 entries in 0.010411s

Could you please provide output from "truss -f" for this bug?

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by Matthias Scheler

On Tue, Dec 14, 2004 at 11:29:36PM +0900, Hajimu UMEMOTO wrote:
> It's strange.  It seems bind() returns an error without setting errno.

It shouldn't. If it does it is a bug. But we need "truss -f" output to
know what's going wrong there.

> Please try following patch.

That patch is highly broken. The bind() call might be rejected because
port 1 is a privileged port and/or in use.

> Solaris9 might not allow bind to port 0.

It's part of the socket API and therefore supported.

[Yes, I'm 100% sure because I actually maintain that code in Solaris.]

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by Matthias Scheler

On Thu, Dec 16, 2004 at 05:09:28AM +0000, Matthias Scheler wrote:
> 
> On Tue, Dec 14, 2004 at 12:00:25PM +0100, fredrik.pettai@... wrote:
> > Dec 13 20:00:55 gemini milter-greylist: [ID 795507 mail.debug] sync_sender running
> > Dec 13 20:00:55 gemini milter-greylist: [ID 634049 mail.error] local_addr: bind failed: Error 0
> > Dec 13 20:00:55 gemini milter-greylist: [ID 750011 mail.debug] sync_sender sleeping, done 0 entries in 0.010411s
> 
> Could you please provide output from "truss -f" for this bug?

Better make that "truss -v all -o trussfile -f ...".

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by Matthias Scheler

On Thu, Dec 16, 2004 at 05:16:57AM +0000, Matthias Scheler wrote:
> > Could you please provide output from "truss -f" for this bug?
> Better make that "truss -v all -o trussfile -f ...".

Here is the output which Fredrik kindly provided:

7906/4:         so_socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP, "", 1) = 8
7906/4:         bind(8, 0x000632E8, 16, 3)                      Err#126 EADDRNOTAVAIL
7906/4:                 AF_INET  name = 151.156.192.100  port = 0

So bind() worked as expected. The question is why errno got overwritten.
Looking at the code the code in "sync.c" ...

	if (bind(sfd, sa, salen) == -1) {
		if (errno != EADDRNOTAVAIL) {
			syslog(LOG_ERR, "local_addr: bind failed: %s\n",
			    strerror(errno));
			islocal = -1;
		} else {
			islocal = 0;
		}
	} else {
		islocal = 1;
	}

... I cannot see why it was overwritten unless this code has been
interrupted by a signal handler.

	Kind regards 

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by egcrosser

--- In milter-greylist@yahoogroups.com, Matthias Scheler <tron@z...>
wrote:
> On Thu, Dec 16, 2004 at 05:16:57AM +0000, Matthias Scheler wrote:
> > > Could you please provide output from "truss -f" for this bug?
> > Better make that "truss -v all -o trussfile -f ...".
> 
> Here is the output which Fredrik kindly provided:
> 
> 7906/4:         so_socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP, "", 1) = 8
> 7906/4:         bind(8, 0x000632E8, 16, 3)                     
Err#126 EADDRNOTAVAIL
> 7906/4:                 AF_INET  name = 151.156.192.100  port = 0
> 
> So bind() worked as expected. The question is why errno got overwritten.
> Looking at the code the code in "sync.c" ...
> 
> 	if (bind(sfd, sa, salen) == -1) {
> 		if (errno != EADDRNOTAVAIL) {
> 			syslog(LOG_ERR, "local_addr: bind failed: %s\n",
> 			    strerror(errno));
> 			islocal = -1;
> 		} else {
> 			islocal = 0;
> 		}
> 	} else {
> 		islocal = 1;
> 	}
> 
> ... I cannot see why it was overwritten unless this code has been
> interrupted by a signal handler.

Could it be due to lack of some #define that would make errno
thread-safe?  Just a wild guess...

BTW, 'syslog(LOG_ERR, "local_addr: bind failed: %m")' is a bit shorter :)

Eugene

Re: [milter-greylist] Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by Matthias Scheler

On Thu, Dec 16, 2004 at 03:46:16PM -0000, egcrosser wrote:
> Could it be due to lack of some #define that would make errno
> thread-safe?  Just a wild guess...

Yes, indeed. The program should be compiled with "cc -mt ..." and linked
with "-pthread". I'm not sure what the correct options for GCC are.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by manu@netbsd.org

Matthias Scheler <tron@...> wrote:

> ... I cannot see why it was overwritten unless this code has been
> interrupted by a signal handler.

You would see it in the kernel trace, woudln't you?

-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@...

Re: [milter-greylist] Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by manu@netbsd.org

egcrosser <egcrosser@...> wrote:

> BTW, 'syslog(LOG_ERR, "local_addr: bind failed: %m")' is a bit shorter :)

I didn't know that one. That's nifty. Is it portable?

-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@...

Re: [milter-greylist] Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-16 by manu@netbsd.org

Matthias Scheler <tron@...> wrote:

> > Could it be due to lack of some #define that would make errno
> > thread-safe?  Just a wild guess... 
> Yes, indeed. The program should be compiled with "cc -mt ..." and linked
> with "-pthread". I'm not sure what the correct options for GCC are.

If someone wants to contribute patches to configure.ac so that
milter-greylist build automatically take care of that, don't hesitate.

-- 
Emmanuel Dreyfus
Il y a 10 sortes de personnes dans le monde: ceux qui comprennent 
le binaire et ceux qui ne le comprennent pas.
manu@...

Re: [milter-greylist] Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-17 by Dan Hollis

On Thu, 16 Dec 2004 manu@... wrote:
> egcrosser <egcrosser@...> wrote:
> > BTW, 'syslog(LOG_ERR, "local_addr: bind failed: %m")' is a bit shorter :)
> I didn't know that one. That's nifty. Is it portable?

It appears to be a gcc-specific extension.

-Dan

Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-17 by egcrosser

--- In milter-greylist@yahoogroups.com, Dan Hollis <goemon@a...> wrote:
> On Thu, 16 Dec 2004 manu@n... wrote:
> > egcrosser <egcrosser@y...> wrote:
> > > BTW, 'syslog(LOG_ERR, "local_addr: bind failed: %m")' is a bit
shorter :)
> > I didn't know that one. That's nifty. Is it portable?
> 
> It appears to be a gcc-specific extension.

Nope.
I beleive it's standard.  I still remember Unices that did not have
syslog() at all, but no one that had syslog() without "%m".

Eugene

FreeBSD xxx.xxxx.xx 4.10-STABLE
"The message is identical to a printf(3) format string, except that `%m'
     is replaced by the current error message."

SunOS xxxxx 5.7
"occurrences  of  %m  in  the  format
     string  pointed  to  by the message argument are replaced by
     the error message string associated with the  current  value
     of errno."

etc.

Re: [milter-greylist] Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-17 by Dan Hollis

On Fri, 17 Dec 2004, egcrosser wrote:
> --- In milter-greylist@yahoogroups.com, Dan Hollis <goemon@a...> wrote:
> > On Thu, 16 Dec 2004 manu@n... wrote:
> > > egcrosser <egcrosser@y...> wrote:
> > > > BTW, 'syslog(LOG_ERR, "local_addr: bind failed: %m")' is a bit shorter :)
> > > I didn't know that one. That's nifty. Is it portable?
> > It appears to be a gcc-specific extension.
> Nope.
> I beleive it's standard.  I still remember Unices that did not have
> syslog() at all, but no one that had syslog() without "%m".

I did some research, I guess you can safely use it for syslog _only_, but 
using %m in any other format strings (printf etc) cannot be guaranteed on 
anything other than gnu libc.

-Dan

Re: [milter-greylist] milter-greylist 1.6rc1 and Solaris 9 (sparc)

2004-12-17 by Matthias Scheler

On Thu, Dec 16, 2004 at 08:40:42PM +0100, Emmanuel Dreyfus wrote:
> > ... I cannot see why it was overwritten unless this code has been
> > interrupted by a signal handler.
> You would see it in the kernel trace, woudln't you?

Yes, I think so. That makes the "not compiled for threads" option most likely.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

Re: milter-greylist 1.6rc1 and Solaris 9 (sparc)

2005-03-23 by kihongchong

Hi, 
  I am new to this list and have been running milter-greylist for
about 2 weeks.  Now i am trying to sync between 2 MTAs and am getting
this same problem.  I have read all that I could find in this thread
but could not find a answer on how to fix this.  Could someone point
me in the right direction please.

Thanks
Keith



--- In milter-greylist@yahoogroups.com, <fredrik.pettai@v...> wrote:
> 
> Hello list!
> 
> I've compiled and installed milter-greylist-1.6rc1 on Solaris 9 (sparc).
> It works fine to compile if you install the following:
> - gcc
> - flex
> - bison
> (and add the option CFLAGS=-D__EXTENSIONS__ to the Makefile)
> 
> (This, because of that Solaris lex and yacc is missing to many
important feature)
> 
> Everything works fine, except for "peer" option (replication of
greylist/whitelist data between MX-peers). I've tried to truss and
"debug" as much as i can with the help from Emmanuel Dreyfus, but i'm
stuck...
> 
> The message i get in the syslog looks like this:
> 
> Dec 13 20:00:55 gemini milter-greylist: [ID 226885 mail.debug]
iBDJ0rOa004257: addr = 151.156.192.51, from = <root@b...>, rcpt =
<kalle@g...>
> Dec 13 20:00:55 gemini milter-greylist: [ID 173742 mail.debug]
created: 151.156.192.51 from <root@b...> to <kalle@g...> delayed for 60s
> Dec 13 20:00:55 gemini milter-greylist: [ID 928669 mail.info]
iBDJ0rOa004257: addr 151.156.192.51 from <root@b...> to <kalle@g...>
delayed for 00:01:00
> Dec 13 20:00:55 gemini sendmail[4257]: [ID 801593 mail.info]
iBDJ0rOa004257: milter=greylist, action=rcpt, reject=451 4.7.1
Greylisting in action, please come back in 00:01:00
> Dec 13 20:00:55 gemini milter-greylist: [ID 795507 mail.debug]
sync_sender running
> Dec 13 20:00:55 gemini milter-greylist: [ID 634049 mail.error]
local_addr: bind failed: Error 0
> Dec 13 20:00:55 gemini milter-greylist: [ID 750011 mail.debug]
sync_sender sleeping, done 0 entries in 0.010411s
> 
> Apparently "sync_sender" routine fails (problem binding a free port
on the local machine?). I've also snoop:ed the network, and i can't
see any milter-greylist "sync"-trafic. Has someone running Solaris
noticed or fixed this problem for version 1.6rc1?
Show quoted textHide quoted text
> If so, please send a patch to Emmanuel Dreyfus...
> 
> I've noticed that most milter coding is done on BSD-systems.
> But the company that i work for prefers Solaris :-(
> 
> TIA,
> /P

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.