The segfault described at the top of this thread is in sink.c:
static int open_bsmtp_sink(struct query *ctl, struct msgblk *msg,
int *good_addresses, int *bad_addresses)
/* open a BSMTP stream */
{
struct idlist *idp;
if (strcmp(ctl->bsmtp, "-") == 0)
sinkfp = stdout;
else
sinkfp = fopen(ctl->bsmtp, "a");
/* see the ap computation under the SMTP branch */
fprintf(sinkfp,
"MAIL FROM: %s", (msg->return_path[0]) ? msg->return_path : user);
...
If the fopen fails, returning NULL, the fprintf segfaults; seen on
Red Hat 8 (with 5.9.0) and on Red Hat 9 (with 6.2.0 and 6.2.5).
Surprised this hasn't been seen before -- maybe other systems'
fprintf and fputs just return if the file pointer is NULL.
This will fix it:
*** sink.c.orig 2003-10-10 15:06:36.000000000 -0700
--- sink.c 2004-01-15 17:43:09.000000000 -0800
***************
*** 722,727 ****
--- 722,733 ----
else
sinkfp = fopen(ctl->bsmtp, "a");
+ if (sinkfp == NULL)
+ {
+ report(stderr, GT_("BSMTP file open failed\n"));
+ return(PS_BSMTP);
+ }
+
/* see the ap computation under the SMTP branch */
fprintf(sinkfp,
"MAIL FROM: %s", (msg->return_path[0]) ? msg->return_path : user);
***************
*** 758,764 ****
if (ferror(sinkfp))
{
! report(stderr, GT_("BSMTP file open or preamble write failed\n"));
return(PS_BSMTP);
}
--- 764,770 ----
if (ferror(sinkfp))
{
! report(stderr, GT_("BSMTP preamble write failed\n"));
return(PS_BSMTP);
}