[SA-exim] Re: SA-Exim timeout -> use SA 2.1 cvs, not 2.1
Marc MERLIN
marc at merlins.org
Tue, 22 Oct 2002 02:23:10 -0700
On Mon, Oct 21, 2002 at 10:03:46PM +0100, Tim Jackson wrote:
> Hi Marc,
>
> OK, I give up. write() seems to be stalling on the chunk that would
Well, I took over while you were sleeping :-) and fixed the problem with
what I should have done in the first place (See below)
> "overflow" the spamc size limit, but at this point I don't have the
> knowledge or C experience to know why. I'm going to write one less chunk
> for now so that at least my system works :) Please do keep me up to date
> with how the bugfix is developing, though, and what the solution turns out
> to be.
Honestly, I don't know why spamc stops reading from the pipe and hangs
my process. By all accounts it shouldn't especially in the middle of a
message body. I wouldn't be surprized if it's some subtle bug in spamc.
Anyway, it doesn't matter, I fixed the problem by skipping the message
altogether if it's bigger than what spamc will accept.
Let me know if this works for you (it works for me), and I'll probably
release a 2.1.1 or 2.2 this weekend with:
- this fix
- a fix I have yet to write on teergrube over SSL (not that it should
ever happen :-)
- Make SAmaxbody an config option and not a compile time value
- Allow SA-Exim to pass an truncated body to spamc instead of just
accepting big Emails.
- Clean the body save to a file code now that I save fdstart
BTW, if a real C programmer can answer this for me:
/* Ok, tell me what's the better way of getting the size of the file an fd
* points to */
fdstart=lseek(fd, 0, SEEK_CUR);
CHECKERR(fdstart,"lseek SEEK_CUR",__LINE__);
/* this is the body size plus a few bytes (exim msg ID) */
/* it should be 18 bytes, but I'll assume it could be more or less */
fdsize=lseek(fd, 0, SEEK_END);
CHECKERR(fdsize,"lseek SEEK_END",__LINE__);
/* Reset fd to the body start */
ret=(int) lseek(fd, fdstart, SEEK_SET);
CHECKERR(ret,"lseek SEEK_SET",__LINE__);
BTW, I did not use your ret=0 before wait(&ret), the man page makes it
clear that it's a write only value and setting it to 0 beforehand should
do nothing.
> Would it not be a good idea (if possible) to implement some kind of alarm
> around this point, as a safety measure in case this sort of thing happens
> (either because of a bug or some other oddity)?
I may move the timeout before I start writing to spamc
I'll study that after I get some sleep.
Marc
--
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | Finger marc_f@merlins.org for PGP key