On Thursday 11 December 2008 21:38:58 Victor Duchovni wrote:
> On Thu, Dec 11, 2008 at 09:34:31PM +0100, Gaute Amundsen wrote:
> > How about this?
> > Even more off topic!
> >
> > But so far this seems to work for me.
> > Kmail "could not write lockfile" when reading the mbox, but "FCNTL"
> > worked, whatever that means :)
> > Considerable room for improvement I'm sure, but in principle?
> >
> > Suggestions welcome :)
> >
> > Gaute
> >
> > /usr/bin/sendmail:
> >
> > #!/usr/bin/python
> >
> > import mailbox
> > import sys
> > import email
> > from time import gmtime, strftime
> >
> > mbox = mailbox.mbox('/var/mail/root', factory=None, create=True)
> >
> > msg = email.message_from_file(sys.stdin)
> > msg['From'] = 'r...@localhost'
> > msg['Date']= strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())
>
> The problem is that users other than the owner of the mailbox may
> need to send mail... So you need either a setuid sendmail(1) or
> a system like Postfix with multiple processes at different privilege
> levels and IPC between them.

Well, that could hardly be much of a problem in this case?
As long as there is only me and the daemons, and nobody else expects their 
mail to go out. After all I have not missed a mta on this laptop for years..
 
Actually I had just naively set a+wr on the mbox, but setuid might be better 
yes :) 

Btw. I don't think I am alone in this situation. I have noticed smartmontols 
on ubuntu jumps through all sorts of custom hoops with "smart-notifier" to get 
it's alerts raised. A utility like this hack would solve that for the general 
case...

Gaute

Reply via email to