[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: home-grown transport agent problems



Hi Matti,

Thanks for your prompt reply. I changed the order of invocation: first goes
notaryreport() and then diagnostic() and it sure helped. So this was the
reason.

Cheers,
marek.

-----Original Message-----
From: Matti Aarnio [mailto:mea@nic.funet.fi]
Sent: Tuesday, January 29, 2002 12:51 AM
To: Marek Kowal
Cc: zmailer@nic.funet.fi
Subject: Re: home-grown transport agent problems


On Mon, Jan 28, 2002 at 11:54:34PM +0100, Marek Kowal wrote:
> 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)");

   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).

> 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

    "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.

> 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

   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.


> 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?

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

> Please - help. I am getting desperate ;-))
> 
> Cheers,
> Marek.

-- 
/Matti Aarnio	<mea@nic.funet.fi>
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi