Yahoo Groups archive

Milter-greylist

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

Message

RE: [milter-greylist] smfi_getpriv returns NULL

2006-07-05 by Wolf, Brian

I upgraded Sendmail to version 8.13.7 and rebuilt milter-greylist 2.0.2
with libmilter 8.51, and the problem described in my original post is
still occurring.  For the most part, everything works well, but
occasionally, it looks like mlfi_envfrom or mlfi_envrcpt gets called
before a call to mlfi_connect for the corresponding ctx pointer, such as
the example below.  This causes mlfi_envfrom to attempt to operate on a
null priv pointer, resulting in a segmentation fault.

This might still be a sendmail problem, but has anyone else encountered
this behavior, and does anyone know what might be causing it?  If this
is known behavior, it would be nice if the distribution version of
milter-greylist logged the error rather than just dying with no
explanation.

Again, this is on a Redhat Linux AS3 box.  "nospf" is set in the config
file, and this is the only milter in use.  Here are the milter
statements from sendmail.cf, generated by using
"FEATURE(`milter-greylist')dnl" in sendmail.mc:

	O InputMailFilters=greylist

	O Milter.macros.connect=j, _, {daemon_name}, {if_name},
{if_addr}
	O Milter.macros.helo={tls_version}, {cipher}, {cipher_bits},
{cert_subject}, {cert_issuer}, {verify}
	O Milter.macros.envfrom=i, {auth_type}, {auth_authen},
{auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, 	{mail_addr}
	O Milter.macros.envrcpt={rcpt_mailer}, {rcpt_host}, {rcpt_addr}

	Xgreylist, S=local:/var/milter-greylist/milter-greylist.sock


Here are some entries from the sendmail log showing this behavior.
Notice the entries with ctx=147314760, and specifically those annotated
with "==>>>".


==>>> (Start of normal connect/from/rcpt/close sequence with ctx =
147314760)
	Jul  5 11:43:51 ig3net58 milter-greylist: mlfi_connect: at start
- ctx = 147314760
	Jul  5 11:43:51 ig3net58 milter-greylist: mlfi_connect: after
malloc - ctx = 147314760  priv = 148785640
	Jul  5 11:43:51 ig3net58 milter-greylist: mlfi_connect: after
setpriv- ctx = 147314760  priv = 148785640
	Jul  5 11:43:52 ig3net58 milter-greylist: mlfi_envfrom: at start
- ctx = 147314760  noauth 1  nospf 1
	Jul  5 11:43:52 ig3net58 milter-greylist: mlfi_envfrom: after
getpriv- ctx = 147314760  priv = 148785640
	Jul  5 11:43:52 ig3net58 milter-greylist: mlfi_envfrom: get
queueid  - ctx = 147314760  priv = 148785640
	Jul  5 11:43:52 ig3net58 milter-greylist: mlfi_envfrom: got
queueid  - ctx = 147314760  priv = 148785640  queueid 	k65Ghpfg015204
	Jul  5 11:43:52 ig3net58 milter-greylist: mlfi_envrcpt: after
getpriv- ctx = 147314760  priv = 148785640
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_close  : at start
- ctx = 147314760
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_close  : dealloc
priv - ctx = 147314760  priv = 148785640
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_close  : set priv
NULL- ctx = 147314760
==>>> (priv struct deallocated normally for ctx 147314760 by mlfi_close)
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_envfrom: at start
- ctx = 147305968  noauth 1  nospf 1
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_envfrom: after
getpriv- ctx = 147305968  priv = 148783280
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_envfrom: get
queueid  - ctx = 147305968  priv = 148783280
	Jul  5 11:43:53 ig3net58 milter-greylist: mlfi_envfrom: got
queueid  - ctx = 147305968  priv = 148783280  queueid 	k65GhoAJ015202
	Jul  5 11:43:55 ig3net58 milter-greylist: mlfi_envrcpt: after
getpriv- ctx = 147305968  priv = 148783280
==>>> (no call to mlfi_connect for ctx 147314760 between the previous
mlfi_close and this mlfi_envfrom call)
==>>>	Jul  5 11:43:55 ig3net58 milter-greylist: mlfi_envfrom: at start
- ctx = 147314760  noauth 1  nospf 1
==>>>	Jul  5 11:43:55 ig3net58 milter-greylist: mlfi_envfrom: after
getpriv- ctx = 147314760  priv = 0
==>>>	Jul  5 11:43:55 ig3net58 milter-greylist: mlfi_envfrom: NULL
PRIV!   - ctx = 147314760
	Jul  5 11:43:55 ig3net58 milter-greylist: mlfi_envrcpt: after
getpriv- ctx = 147314760  priv = 0
	Jul  5 11:43:55 ig3net58 milter-greylist: mlfi_envrcpt: NULL
PRIV!   - ctx = 147314760
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : at start
- ctx = 147305968
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : dealloc
priv - ctx = 147305968  priv = 148783280
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : set priv
NULL- ctx = 147305968
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : at start
- ctx = 147306584
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : priv was
NULL- ctx = 147306584
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : at start
- ctx = 147314760
	Jul  5 11:43:56 ig3net58 milter-greylist: mlfi_close  : priv was
NULL- ctx = 147314760
	Jul  5 11:44:02 ig3net58 milter-greylist: mlfi_close  : at start
- ctx = 147305968
	Jul  5 11:44:02 ig3net58 milter-greylist: mlfi_close  : priv was
NULL- ctx = 147305968
==>>> (Next call to mlfi_connect for ctx 147314760 down here)
	Jul  5 11:44:04 ig3net58 milter-greylist: mlfi_connect: at start
- ctx = 147314760
	...
		



- Brian




-----Original Message-----
From: milter-greylist@yahoogroups.com
[mailto:milter-greylist@yahoogroups.com] On Behalf Of Wolf, Brian
Sent: Wednesday, June 28, 2006 5:25 PM
To: milter-greylist@yahoogroups.com
Subject: RE: [milter-greylist] smfi_getpriv returns NULL


Sorry, I hadn't meant to post the previous message just yet.  I'm
thinking that the problem might be in sendmail, so I will try to upgrade
that and see if it resolves the problem.  

- Brian
-----Original Message-----
From: milter-greylist@yahoogroups.com
[mailto:milter-greylist@yahoogroups.com] On Behalf Of Wolf, Brian
Sent: Wednesday, June 28, 2006 5:03 PM
To: milter-greylist@yahoogroups.com
Subject: [milter-greylist] smfi_getpriv returns NULL


I'm trying to get started with milter-greylist 2.0.2.  It worked okay
for a few test messages, but when I run it in production, it quickly
aborts, usually within a minute or two.  
The discussions of crashes I've found on this list seem to involve
either the use of the SPF option or bad macro definitions.  I did not
build it with the SPF option.  I have tried various sets of macro
definitions- those straight out of the README, the ones created by the
.m4 feature file, and those from the snert.com posting.  Same results in
all cases. 
I ran it in non-daemon mode and found that it was dying with a
segmentation fault.  I added some syslog statements to the distribution
source and found that it was dying in mlfi_envfrom because the call to
smfi_getpriv was returning a NULL value for priv, and then faulting when
it tried to assign priv->priv_queueid on the next statement.  It
sometimes happens in mlfi_envrcpt, too.
I also checked the return status from the smfi_setpriv calls but did not
get any MI_FAILURE results.  And I haven't seen any errors on the malloc
in mlfi_connect.
I have included some 
For now, I have just added a line after each call to smfi_getpriv to
return with SMFIS_CONTINUE if smfi_getpriv returns a NULL, and it seems
to be working.  But is this a problem others have encountered, and if
so, is there a resolution for it?  
My environment is a dual-processor RedHat AS3 system with the
2.4.21-40.Elsmp kernel and sendmail 8.12.11.  This is the only milter in
use.  Except for the debug syslog statements, I am using the 2.0.2
source.straight from the tarball and building with gcc 3.2.3.


- Brian 


Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_connect: at start     -
ctx = 164608872 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_connect: after malloc -
ctx = 164608872  priv = 164628488 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_connect: after setpriv-
ctx = 164608872  priv = 164628488 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_envfrom: at start     -
ctx = 164608872  noauth 1  nospf 1 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_envfrom: after getpriv-
ctx = 164608872  priv = 164628488 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_envfrom: get queueid  -
ctx = 164608872  priv = 164628488 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_envfrom: got queueid  -
ctx = 164608872  priv = 164628488  queueid k5SLl5MX027474
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_envrcpt: after getpriv-
ctx = 164608872  priv = 164628488 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_close  : at start     -
ctx = 164608872 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_close  : dealloc priv -
ctx = 164608872  priv = 164628488 
Jun 28 16:47:05 ig3net58 milter-greylist: mlfi_close  : set priv NULL-
ctx = 164608872 
Jun 28 16:47:10 ig3net58 milter-greylist: mlfi_envfrom: at start     -
ctx = 164608872  noauth 1  nospf 1 
Jun 28 16:47:10 ig3net58 milter-greylist: mlfi_envfrom: after getpriv-
ctx = 164608872  priv = 0 
Jun 28 16:47:10 ig3net58 milter-greylist: mlfi_envfrom: NULL PRIV!   -
ctx = 164608872

Attachments

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.