Subject: home-grown transport agent problems

From: "Marek Kowal" <[email-masked]>
Date: Mon, 28 Jan 2002 23:54:34 +0100

Hi there,

Due to the development of new propiretary mail system my company decided to
adopt ZMailer to suit our needs. This required the development of new
Transport Agent (TA), tailored to our own mail storage schema.

The TA is performing well, delivers mails as required, but I've encountered
the problem I cannot solve: once the mailbox quota is reached, I'd like to
return the letter (or at least -> the information) about unsuccesfull
delivery to the sender. I tried the following code in my TA:

void deliver(...){

  ....

 if (result==5){
    i = EX_UNAVALIABLE;
   diagnostic(startrp,i,0,"size of mailbox exceeds quota for the user");
         notaryreport(startrp->addr->user, "failed",
                 "4.2.2 (Destination mailbox full)",
                 "OnetTA; 500 (Attempting to deliver to full mailbox)");
    return;
  }
}

That's it - I am calling diagnostic() and notaryreport() - as seen in
mailbox.c from zmailer sources, which I tried to follow. When invoking the
TA from command line, it seems to work OK:

ps1:/var/spool/postoffice/transport# /root/bin/onetTA -l
/var/log/mail/onetta
#hungry
P/P/654097-21917
654097/196              ok3 Message delivered succesfully
#hungry
P/Q/654098-21916
654098/196              error2 size of mailbox exceeds quota for the user
#hungry

Unfortunately, the information letter for the second case is NOT sent back
to the sender! I have found out (in sheduler.perflog) the following line:
1012236984 654097-21916 7 8 error onetta/myslot_specification

(we have different storage "slots", TA delivers mails to one of them).
No other line was printed afterwards to any log in /var/log/mail/*

So apparently the scheduler gets informed about the fact, that there was
delivery error, and simply... discards the letter. I checeked in
/var/spool/postoffice directories - the letter is simply removed.

So the question is: what is it, that I am doing wrong? Should I exit() my
TA, returning EX_UNAVALIABLE after each unsccessfull delivery? Or rather,
the TA is ok, it is just zmailer which is misconfigured?

Please - help. I am getting desperate ;-))

Cheers,
Marek.

-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to [email-masked]

---

From: Matti Aarnio <[email-masked]>
Date: Tue, 29 Jan 2002 01:51:26 +0200

>                  "OnetTA; 500 (Attempting to deliver to full mailbox)");

   This order is wrong.

   First you do 'notaryreport()', which puts data into internal state,
   then you do diagnostics, which uses that internal state.

   Compare with this fragment from   mailbox.c:

	  if (pw == NULL) {
	    notaryreport(file,"failed",
			 "5.2.1 (Target file has no known owner)",
			 "x-local; 510 (Target file has no known owner)");
	    DIAGNOSTIC(rp, file, EX_NOPERM,
		       "File \"%s\" has no owner", file);
	    return 1;
	  }

  Your  diagnostic()  call is ok (it has different parameters than
  what macro DIAGNOSTIC has).

> mailbox.c from zmailer sources, which I tried to follow. When invoking
> the TA from command line, it seems to work OK:

> 654098/196              error2 size of mailbox exceeds quota for the user

    "error2" is transport-agent's way (libta library's) to inform
   the scheduler, that the transport-agent did error logging into
   the spool file, and when the scheduler gets around, it should
   analyze the file and report errors.

> 1012236984 654097-21916 7 8 error onetta/myslot_specification

   That might mean that there is something wrong in the scheduler.
   (grumble..  possible it always is...)

   Going thru the  u_error2(), and subsequent calls all the way
   into  unctlfile() do, I think, call  reporterrs() in all cases.

> the TA is ok, it is just zmailer which is misconfigured?

   Aside of doing those calls in wrong order I think your TA is ok.
   It should not manifest as disappearing diagnostics, though.

-- 
/Matti Aarnio	<[email-masked]>
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to [email-masked]